Chris Schwarz’ Latest Woodworking Workbench Book is FREE (PDF)

https://i1.wp.com/toolguyd.com/blog/wp-content/uploads/2021/04/Chris-Schwarz-Anarchist-Workbench-Book-Hero-Woodworking-Table-Image.jpg?resize=600%2C409&ssl=1

Chris Schwarz Anarchist Workbench Book Hero Woodworking Table Image

Christopher Schwarz is well-known in the woodworking industry, from his articles at Popular Woodworking, to his Lost Art Press publishing company.

You might have seen some of his books before, such as his book on workbench design, theory, construction, and use, which is available via Amazon.

I wrote about some of Schwarz’ “Anarchist” books before, and they’re quite good. They’re unlike any other woodworking or how-to books I’ve ever read before, and are somehow as conversational as they are informative.

Schwarz came out with a new book last year – The Anarchist’s Workbench. It seems I missed this news, as I only first learned of this book last night.

He describes The Anarchists’ Workbench as:

a detailed plan for a simple workbench that can be built using construction lumber and basic woodworking tools. But it’s also the story of Christopher Schwarz’s 20-year journey researching, building and refining historical workbenches until there was nothing left to improve.

There are two versions of The Anarchist’s Workbench – a hardcover copy, priced at $27, and a digital copy that Lost Art Press is giving away for free. That’s right, free, as in $0, and without any DRM or catches of any kind.

Why would Schwarz give this book away for free? In a blog post, he says that 1) he could afford to, 2) some people might hesitantly believe this new book too closely resembles his previous books, and so the free copy can serve as a sort of preview for them, and lastly:

Finally, I want this information – my last book on benches – to be free and widely available to everyone today and in the future. By putting it out there for free, I hope people will be inspired to build a bench, even if it’s not the bench in this book.

I’ve purchased some of the other books published by Lost Art Press, by the same and different authors, and they are very well-made. Even with a free PDF copy, I might eventually buy a hard copy (once I’m done with my currently very long reading list), and I imagine others will to.

I’ve read through some parts of The Anarchist’s Workbench already, and it’s an enjoyable book.

In this book, Schwarz discusses the how and why behind his design for a woodworking workbench sourced from home center lumber, and he also shares details about the personal and woodworking journey that has brought him here.

What is always refreshing about Schwarz’s writings these days is that he isn’t shackled by popular opinion, or the need to stay within anyone else’s lines.

This is a good book, and if it’s not quite your style, keep it in mind. Personally, I’m leaning towards a woodworking workbench direction I never would have thought I’d go in, and so never say never. If you like what you read, consider buying a physical copy.

Hardcover Book

Price: $25-27

Buy Now via Lee Valley
Buy Now via Lost Art Press

Where are the books made?

All of our books are printed in the United States on the best materials we can obtain. We manufacture all of our books to last at least a century. That means using expensive sewn bindings, fiber tape and thick hardbacks (when possible).

Digital Copy

Price: FREE

PDF Download

ToolGuyd

Treadmill Demolition Derby

https://theawesomer.com/photos/2021/04/treadmill_demolition_derby_t.jpg

Treadmill Demolition Derby

Link

“This is gonna be a quick race, folks.” YouTuber Steve Wilkins and his young sidekicks Tyler and Dylan have been posting a series of videos in which he races toy cars on his treadmill. In this clip, they put 100 cars on the belt, then cranked up the speed, resulting in a chaotic start that quickly culls the field.

The Awesomer

Who did it better

http://img.youtube.com/vi/IYjjWPvL9j0/0.jpg

A Left leaning US Army General getting a paycheck from CNN:

A Republican United States Senator from South Carolina:

This is why “I was in the [military branch] so I know more about how dangerous these guns are for civilians” is bullshit.

Who did it better

http://img.youtube.com/vi/IYjjWPvL9j0/0.jpg

A Left leaning US Army General getting a paycheck from CNN:

A Republican United States Senator from South Carolina:

This is why “I was in the [military branch] so I know more about how dangerous these guns are for civilians” is bullshit.

Eloquent relationships explained (with examples)


Eloquent relationships explained (with examples)

March 28, 2021

In my opinion, Eloquent is one of the most powerful features of Laravel. It is an API for interacting with your database, and it has a very nice and easy-to-remember syntax. For example:

$post->author->name;

Will give you the name of the post’s author.

This is an example of an Eloquent relationship. Relationships define how your models (tables) are connected. Although most are easy to understand, there are a few more complicated ones.

In this post, I’m going to show how every relationship works.

One to one (has one)

For this example, we have two models: a User and an Address. The User model holds information such as name, email address, and password, and the Address model holds information like country, state, city, etc.

  • A User has one Address
  • An Address belongs to a User

We may have this table structure:

users
    id - integer
    name - string
    email - string
    password - string

address
    id - integer
    country - string
    city - string
    user_id - integer

You can define these relationships like this:

// app/Models/User.php

public function address()
{
    return $this->hasOne(Address::class);
}

Now you can access the user’s address using $user->address->city.

Note: for this to work, the Address model should have a user_id column.

Inverse (belongs to)

If you have an Address and want to find the corresponding User, then define this relationship:

// app/Models/Address.php

public function user()
{
    return $this->belongsTo(User::class);
}

One to many (has many)

In this example, we have two models: a Post and a Category.

  • A Post belongs to a Category
  • A Category has many Posts

And we have this table structure:

categories
    id - integer
    name - string

posts
    id - integer
    title - string
    category_id - integer

We can define this relationship like this:

// app/Models/Category.php

public function posts()
{
    return $this->hasMany(Post::class);
}

And you can access all the posts like this:

foreach($category->posts as $post) {
    //
}

Note: for this to work, the Post model should have a category_id column.

Many to one (belongs to)

In this example, we have two models: a Post and a Category.

  • A Post belongs to a Category
  • A Category has many Posts

And we have this table structure:

categories
    id - integer
    name - string

posts
    id - integer
    title - string
    category_id - integer

We can define this relationship like this:

// app/Models/Post.php

public function category()
{
    return $this->belongsTo(Category::class);
}

And you can access the Post‘s category like this:

$post->category->name;

Has many through

This relationship is a bit more difficult. In this example, we have three models: an Author, a Post, and a Language.

  • A Post belongs to an Author
  • An Author has many Posts
  • An Author “belongs” to a Language (speaks a language)
  • A Language has many Authors

For example, this is our table structure:

languages
    id - integer
    name - string

authors
    id - integer
    name - string
    language_id - integer

posts
    id - integer
    title - string
    author_id - integer

If we want to get all posts in a specific language, we can define this relationship:

// app/Models/Language.php

public function posts()
{
    return $this->hasManyThrough(Post::class, User::class);
}

Now, we can get all posts using:

foreach($language->posts as $post) {
    //
}

Inverse

If you now want to get the Language of a Post, you can just simply do this:

$post->user->language->name;

Many to many (belongs to many)

In this example, we have two models: a Product and a Tag.

  • A Product has many Tags
  • A Tag has many Products

And we may have this table structure:

products
    id - integer
    name - string
    price - integer

tags
    id - integer
    name - string

product_tag
    product_id - integer
    tag_id - integer

Note: in the table structure, we have a third table, product_tag. This table connects products to tags.

Now we can define the relationships like this:

// app/Models/Product.php

public function tags()
{
    return $this->belongsToMany(Tag::class);
}
// app/Models/Tag.php

public function products()
{
    return $this->belongsToMany(Product::class);
}

Now we can get all tags/products using:

foreach($product->tags as $tag) {
    //
}
foreach($tag->products as $product) {
    //
}

In the next post, I’m going to show what polymorphic relationships are and how to use them. Thanks for reading!

Laravel News Links

How Guns Work [Visual Guide]

https://www.pewpewtactical.com/wp-content/uploads/2020/03/Benelli-M2-CZ75-AR-15-3-2048×1365.jpg

A super quick explanation of how guns work.

Benelli M2, CZ75, AR-15 (3)
3-Gun: Benelli M2, CZ75, AR-15 Stacked

We’ll begin with the easy definition of what is a gun, different components of the bullet cartridge, some gun actions, and loading mechanisms.

Table of Contents

Loading…

What is a Gun?

At its core, guns are things that launch projectiles of some sort at high speed. The first guns were just tubes with explosives and a projectile…think cannons.

Cannon Blast, Smithsonian Channel
Cannon Blast, Smithsonian Channel

Modern guns have come a long way.

Cartridges

What most people think of as “bullets” are actually “cartridges” that include the bullet, a casing, powder, and a primer.

Deconstructed 9mm Cartridge
Deconstructed 9mm Cartridge

Of course there’s TONS of different calibers (size of bullets).

Common Calibers in Room
Common Calibers in Room

The primer is first ignited causing a small explosion, which then burns the rest of the powder, creating lots of pressure that moves the bullet out of the gun.  

Rimfire vs Centerfire Cartridges
Rimfire vs Centerfire Cartridges

The bullet is just the projectile that shoots out of a gun, not the entire object.

.308 (168gr vs 208gr)
.308 (168gr vs 208gr)

To get a lot more in-depth…check out our Ammo 101: How Cartridges Work.

And here are cross-sections of a variety of pistol/rifle cartridges. Not to scale with each other.

Cross Section of a Bullet Cartridge
Cross Section of a Bullet Cartridge

And some cutaways for the different types of shotgun shells.

12ga Shotgun Shells, Opened (L to R: Bird, Buck, Slug)
12ga Shotgun Shells, Opened (L to R: Bird, Buck, Slug)

For more info:

How Guns Work

Different types of guns have different mechanisms of how to ignite the primer to burn the gunpowder, but there is almost always a rounded metal object called the “firing pin” which strikes the primer and starts the process.

Burning Smokeless Powder
Burning Smokeless Powder

Modern smokeless powders don’t even burn that fast…it’s the pressure of the confined space of the chamber that gives it the oomph to move the bullet down the barrel.

Below you can see that the firing pin is attached to a “hammer” in a revolver.

How a Revolver Works
How a Revolver Works

While in a rifle it could be by itself and held in a “bolt.”

Gas System Gun
Gas System Gun

Here’s some of me shooting!

Loading Mechanisms

Most guns will have a mechanism that gets rid of the spent casing and moves in a fresh cartridge.

Some of these include manual actions, using the recoil from the explosion, or using expended gas from the explosion.  We’ll go over these in detail in further lessons. But for now, here’s some slow-motion of guns in action.

Additional Learning

Looking for a comprehensive handgun video course that only goes over the most important stuff…with none of the attitude? Check out our very own Gun Noob to Gun Slinger course.

Pew Pew Tactical Handgun Course
Pew Pew Tactical Handgun Course

Want some of our gun suggestions?

The post How Guns Work [Visual Guide] appeared first on Pew Pew Tactical.

Pew Pew Tactical

Laravel Deployments using Deployer at no cost

Automating deployments for your Laravel 8 project (or any other version) on your dedicated or shared hosting sounds daunting at first. I have been at that place. For my job board back when I launched it, I started looking at tools that I could use for deployment for free. If you don’t have a budget, or you’re keen on learning how to deploy automatically or you like setting up things yourself, this is a decent option.

Setup

  • Ubuntu 20.04
  • PHP 8 & PHP FPM
  • Laravel 8.x
  • Deployer 7 by Anton Medvedev (wonderful open source tool) – we will use the latest beta with support for PHP 8

On your terminal in the Laravel project, install the package (watch out for the latest releases of Deployer)

composer require deployer/deployer"^v7.0.0-beta.16" --dev

Or if you prefer a distribution version

composer require deployer/dist:"^v7.0.0-beta.16"  --dev

Once that is done, let’s initiate which will create a deploy.php ideally at the root of the project which we’ll edit

dep init

Most of the

<?php

namespace Deployer;
require 'contrib/rsync.php';

// Include the Laravel & rsync recipes
require 'recipe/laravel.php';

set('application', 'dep-demo'); //for your reference
set('ssh_multiplexing', true); // Speed up deployment

set('rsync_src', function () {
    return __DIR__; // If your project isn't in the root, you'll need to change this.
});

// Files you don't want in your production server.
add('rsync', [
    'exclude' => [
        '.git',
        '/storage/',
        '/vendor/',
        '/node_modules/',
        '.github',
        'deploy.php',
    ],
]);

task('php-fpm:restart', function () {
    run('service php8.0-fpm restart');
});


// Hosts
host('your_website_or_IP')
->setRemoteUser('your_SSH_user') // SSH user
->setDeployPath('/var/www/website')  // Deploy path
->setIdentityFile('~/.ssh/id_rsa'); // Your SSH key

after('deploy:failed', 'deploy:unlock'); // In case your deployment goes wrong

desc('Deploy the application');
task('deploy', [
    'deploy:info',
    'deploy:prepare',
    'deploy:lock',
    'deploy:release',
    'rsync',
    'deploy:secrets', 
    'deploy:shared',
    'deploy:vendors',
    'deploy:writable',
    'php-fpm:restart',
    'artisan:storage:link',
    'artisan:view:cache',   
    'artisan:config:cache', 
    'artisan:optimize',     
    'artisan:migrate',     
    'deploy:symlink',
    'deploy:unlock',
    'deploy:cleanup',
]);

Deployer 7 has the recipes for most of your common tasks built-in, which is great. You can see the list of available recipes.

Once this is all setup, all you have to do is run and that should be do everything you’ve described

dep deploy

You should see a new folder structure in your host, where it has releases and a release folder. Deployer syncs your code to your server using rsync, runs your tasks and then creates a symlink to point to the release folder which contains your latest code.

So make sure that you point your webserver to /var/www/website/release, restart your webserver, and you should be good to go.

If you’re looking for automating this using GitHub Actions, take a look at this great guide by Atymic – it’s what helped me discover this tool and guided me on the entire process.

Laravel News Links

You Can’t Fight a Guy with a Baby

http://img.youtube.com/vi/xYxEMalkzBA/0.jpg

You Can’t Fight a Guy with a Baby

Link

In this classic sketch from Key & Peele, a guy bumps into another guy on the playground and gets into an altercation. But will the baby that he’s carrying be a help or a hindrance as he takes on his foe? Click play and find out.

The Awesomer

Human vs. Airplane Engine Simulation

https://theawesomer.com/photos/2021/03/human_vs_airplane_engine_simulation_t.jpg

Human vs. Airplane Engine Simulation

Link

(Gore) You never want to stand directly in front of a jet engine, as its powerful vortex could suck you right into it. CG animator atomic marvel used a physics simulation to toss a particle-based digital body into an Airbus jet engine. We’re not sure about its accuracy, but the results are much like those Will It Blend? videos.

The Awesomer

Avoid Pivot Table and Use Json Column in Laravel


Avoid Pivot Table and Use Json Column in Laravel

Posted By

Mahedi Hasan

Category

Framework

Sub-category

Laravel 8.x

September 17, 2020

Hello devs

In this tutorial i show you how we can avoid pivot table and how we can do same stuff without making pivot table. Simply think we make many to many relationship then sometimes we need to make pivot table like one post has many categories and one categories has many post. That time we use pivot table like post_categories.

But in this table we will show our data like post with categories, or post according to category using json column in our post table. For avoiding pivot table we can reduce one table from our database schema and of course our database performance will be better than before.You will also learn how to insert json data into mysql using laravel. 

Which one is better for connection? Pivot table or JSON? You will be clear from this article that laravel remove pivot from json in laravel. So let’s start our tutorial laravel model json column.

Preview : Post table after inerting data

laravel-select-json-column

 

Preview : Post with category name

how-to-insert-json-data-into-mysql-using-laravel

 

Preview : Post according to category id

laravel model json column

 

Step 1 : Create Model

In this we need two model. One is category model and other is post model. So let’s create it.

php artisan make:model Post -m
php artisan make:model Category -m

 

Now open both model and update like below image.

app/Post.php

namespace App;

use Illuminate\Database\Eloquent\Model;
use App\Casts\Json;

class Post extends Model
{
    protected $guarded = [];

    protected $casts = [
        'category_id' => Json::class
    ];

}

 

and open migration file and update it like below.

database/migration/create_posts_table.php

public function up()
 {
   Schema::create('posts', function (Blueprint $table) {
      $table->id();
      $table->json('category_id');
      $table->string('title');
      $table->timestamps();
   });
 }

 

Step 2 : Create Route

We need many route for creating post or showing post according to category. So open web.php and update it like below.

routes/web.php

Route::name('admin.')->namespace('Admin')->prefix('admin')->group(function () {

//Post Route
   Route::get('post/create','PostController@show_post_form')->name('post.create');
   Route::post('post/create','PostController@store');
   Route::get('posts','PostController@index')->name('post.index');
   Route::get('category/{id}','PostController@category_post')->name('category');

});

 

Step 3 : Create Controller 

In this step we need to create post controller. So create it by the following command.

php artisan make:controller Admin/PostController

 

And update it like below.

app/Http/Controllers/Admin/PostController.php

namespace App\Http\Controllers\Admin;

use App\Category;
use App\Http\Controllers\Controller;
use App\Post;
use Illuminate\Http\Request;

class PostController extends Controller
{
    public function show_post_form()
    {
    	return view('admin.post.create');
    }

    public function store(Request $request)
    {
    	$request->validate([
          'category_id' => 'required',
          'title' => 'required'
    	]);

    	$post = new Post;
    	$post->category_id = json_encode($request->category_id);
    	$post->title = $request->title;
    	$post->save();
        
        return redirect()->back();

    }

    public function index()
    {   
    	$post = Post::all();

    	return view('admin.post.index',['posts' => $post]);
    }

    public function category_post($id)
    {   
      return Post::whereJsonContains('category_id',$id)->get();
    }
}

 

Step 4 : Create Blade File

Now we are in the final step. So how to insert json data into mysql using laravel we will know that now. No create below file and paste this code in your file.

resources/views/admin/post/create.blade.php


                  

     
    
    

Laravel News Links