How to Build a Live Search using Laravel, Livewire, and Meilisearch

https://www.iankumu.com/blog/wp-content/uploads/2022/10/Laravel-Search.png

Free Laravel Guide

Grab your free Laravel Guide today and see how to boost your Laravel Experience

One of the most powerful features of Laravel is its ability to integrate with many different services. By default, Laravel integrates with the Meilisearch service. This allows you to easily query your data using the Laravel Eloquent ORM. But what if you want to build a custom search page? Well, it’s easy to do with a couple of tweaks. This article will show you how to create a custom search page using Laravel, Livewire, and Meilisearch.

What is Meilisearch?

Meilisearch is an open-source search engine that is built using Rust and can be integrated into any application to provide Full-Text Search. It comes with a lot of features that we can use to our advantage as developers. Because it is built using Rust, it is blazing fast making it a useful utility for any application. Laravel, through Laravel Scout, comes with an already implemented solution for meilisearch making it easy to use.

But What is Laravel Scout?

Laravel Scout is a first-party Package developed by Taylor Otwell that can be used to add Full-Text Search to your Eloquent Models. It makes it easy to search through your Eloquent Models and return the search results in a clean fashion.

Let’s get started.

How to integrate Full-Text Search into Laravel

Before we start, we need a couple of things;

Once you have created a new Laravel Application and downloaded and installed Meilisearch, you can now follow these steps.

Install Laravel Breeze

If you have created a new Laravel Application, you can install a starter kit. I will install Laravel breeze in this tutorial.

composer require laravel/breeze 

Prepare Model and Migration

We now need a Model to work with. I am going to use an Article Model which will contain an article name, author name and article content

php artisan make:model Articles -m

This command will create an Article Model and its corresponding migration file.

//App/Models/Articles.php
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Articles extends Model
{
    use HasFactory;

    protected $fillable = [
        'name', 'author', 'content'
    ];
}
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('articles', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->longText('content');
            $table->string('author');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('articles');
    }
};

Seed the Database

When testing, I usually use Factories and Seeders to speed up my development process. To do so, we can create an Article Factory

php artisan make:factory ArticleFactory 

We can use faker to seed the database and then register the factory in the Database seeder

//database/factories/ArticlesFactory.php
<?php

namespace Database\Factories;

use Illuminate\Database\Eloquent\Factories\Factory;

/**
 * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Articles>
 */
class ArticlesFactory extends Factory
{
    /**
     * Define the model's default state.
     *
     * @return array<string, mixed>
     */
    public function definition()
    {
        return [
            'name' => $this->faker->words(2, true),
            'content' => $this->faker->sentence(),
            'author' => $this->faker->name()
        ];
    }
}
//database/seeders/DatabaseSeeder.php
<?php

namespace Database\Seeders;

// use Illuminate\Database\Console\Seeds\WithoutModelEvents;

use App\Models\Articles;
use Illuminate\Database\Seeder;

class DatabaseSeeder extends Seeder
{
    /**
     * Seed the application's database.
     *
     * @return void
     */
    public function run()
    {
        Articles::factory(20)->create();
    }
}

To seed the database, db:seed command will be of help

php artisan db:seed 

Install and Configure Livewire

The next step is to install the livewire package. Livewire will be a major help in adding reactivity to our application.

composer require livewire/livewire

We then need to include the livewire Javascripts in the app.blade.php file in the resources/views/components folder.

...
    @livewireStyles
</head>
<body>
    ...
 
    @livewireScripts
</body>
</html>

Create Article Component

Livewire helps us scaffold components fast using the make:livewire command.

php artisan make:livewire Articles

This creates a Component which we can reuse in multiple places.

This command creates two files, one in the App/Http/Livewire Folder and another one in the resources/views/livewire folder. These two will be essential in creating our full-text search

Through laravel breeze, Laravel scaffolded authentication and a dashboard which we can now use to display the Articles.

We can fetch records from the database and display them using the Articles Component.


<x-app-layout>
    <x-slot name="header">
        <h2 class="font-semibold text-xl text-gray-800 leading-tight">
            
        </h2>
    </x-slot>

    <div class="py-12">
        <div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
            <div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
                <div class="p-6 bg-white border-b border-gray-200">
                   @livewire('articles')
                </div>
            </div>
        </div>
    </div>
</x-app-layout>

Install and Set up Laravel Scout

The next step is to install the Laravel scout package using composer

composer require laravel/scout

We can then publish the configurations

php artisan vendor:publish --provider="Laravel\Scout\ScoutServiceProvider" 

Laravel Scout allows us to use any search driver such as database, algolia or meilisearch etc Meilisearch is a popular search engine because it is open source and can be self-hosted. It makes search easy because it handles all the technical bits such as typos.

Laravel Scout helps with all the other factors in search including indexing, updating the index and returning the results in a Laravel Friendly way. Under the hood, Scout uses Model Observers to update the records and re-index the search results in Meilisearch.

To set up Scout in our Models, we will need to include the Searchable trait in our Model

//App/Models/Articles.php
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Laravel\Scout\Searchable; //import the trait

class Articles extends Model
{
    use HasFactory;
    use Searchable; //add this trait

    protected $fillable = [
        'name', 'author', 'content'
    ];
}

We also need to install a few packages to be able to interact with meilisearch

composer require meilisearch/meilisearch-php http-interop/http-factory-guzzle

We can then set the environment variables to now use Meilisearch

SCOUT_DRIVER=meilisearch
MEILISEARCH_HOST=http://127.0.0.1:7700
MEILISEARCH_KEY=masterKey

Add Search Logic

Before performing a Search, we need to index our records in meilisearch using the scout:import command

php artisan scout:import "App\Models\Articles"

Now, we can use Eloquent to perform a search on our records

We can update our Livewire Component to include the Search Logic

//App/Livewire/Articles.php
<?php

namespace App\Http\Livewire;

use App\Models\Articles as ModelsArticles;
use Livewire\Component;


class Articles extends Component
{

    public $search = '';
    public $articles;

    public function render()
    {
        if (empty($this->search)) {

            $this->articles = ModelsArticles::get();
        } else {
            $this->articles = ModelsArticles::search($this->search)->get();
        }

        return view('livewire.articles');
    }
}

Add Search Input Field

On the Articles Table, we can add a search input field that will receive the query and send it to the backend.

Livewire provides a cool way to perform data binding which we can use to our advantage. Using the wire:model property, we can pass the query onto the server and get the results back synchronously.

We can use one of the tailwind components templates to scaffold a view.

<!-- resources/view/livewire/articles.blade.php -->
<div>
     <!-- component -->
     <link rel="stylesheet" href="https://demos.creative-tim.com/notus-js/assets/styles/tailwind.css">
     <link rel="stylesheet" href="https://demos.creative-tim.com/notus-js/assets/vendor/@fortawesome/fontawesome-free/css/all.min.css">

       <section class="py-1 bg-blueGray-50">
           <div class="w-full xl:w-8/12 mb-12 xl:mb-0 px-4 mx-auto mt-24">
           <div class="relative flex flex-col min-w-0 break-words bg-white w-full mb-6 shadow-lg rounded ">
               <div class="rounded-t mb-0 px-4 py-3 border-0">
               <div class="flex flex-wrap items-center">
                   <div class="relative w-full px-4 max-w-full flex-grow flex-1">
                   <h3 class="font-semibold text-base text-blueGray-700">Articles</h3>
                   </div>
                   <div class="relative w-full px-4 max-w-full flex-grow flex-1 text-right">
                <input type="text" placeholder="Search..." wire:model="search">
                </div>
               </div>
               </div>

               <div class="block w-full overflow-x-auto">
               <table class="items-center bg-transparent w-full border-collapse ">
                   <thead>
                   <tr>
                       <th class="px-6 bg-blueGray-50 text-blueGray-500 align-middle border border-solid border-blueGray-100 py-3 text-xs uppercase border-l-0 border-r-0 whitespace-nowrap font-semibold text-left">
                                   Article name
                        </th>
                   <th class="px-6 bg-blueGray-50 text-blueGray-500 align-middle border border-solid border-blueGray-100 py-3 text-xs uppercase border-l-0 border-r-0 whitespace-nowrap font-semibold text-left">
                                   Content
                    </th>
                   <th class="px-6 bg-blueGray-50 text-blueGray-500 align-middle border border-solid border-blueGray-100 py-3 text-xs uppercase border-l-0 border-r-0 whitespace-nowrap font-semibold text-left">
                                   Author
                    </th>
                   </thead>

                   <tbody>
                        @if (!$articles->isEmpty())
                            @foreach ($articles as $article)

                                <tr>
                                    <th class="border-t-0 px-6 align-middle border-l-0 border-r-0 text-xs whitespace-nowrap p-4 text-left text-blueGray-700 ">
                                    
                                    </th>
                                    <td class="border-t-0 px-6 align-middle border-l-0 border-r-0 text-xs whitespace-nowrap p-4 ">
                                        
                                    </td>
                                    <td class="border-t-0 px-6 align-center border-l-0 border-r-0 text-xs whitespace-nowrap p-4">
                                        
                                    </td>
                                </tr>
                            @endforeach
                        @else
                            <td class="border-t-0 px-6 align-center border-l-0 border-r-0 text-xs whitespace-nowrap p-4">
                            No Results Found
                            </td>
                        @endif
                   </tbody>

               </table>
               </div>
           </div>
           </div>

       </section>
</div>

Livewire handles getting the query from the input field, makes an ajax request to the backend and returns the results back to the frontend.

This makes it easy to create a live search with minimal effort.

Live Search

Display Results

Once Scout returns the results, Livewire takes care of displaying them on the table.

Laravel Search
Searched Results

Conclusion

In this article, we have covered how to create a live search using Laravel Livewire and Meilisearch. We covered how to set up your application and include all the features needed for Full-Text Search. I hope this article was insightful. Thank you for reading

Free Laravel Guide

Grab your free Laravel Guide today and see how to boost your Laravel Experience

Laravel News Links

Are You Nuts? Know your Fishing Knots! – Alberto Knot

https://www.alloutdoor.com/wp-content/uploads/2022/11/20221117_203049-e1668736058426.jpg

This week I’m covering another line-to-line connection knot, the Alberto Knot. This knot was invented by “Crazy Alberto” Alberto Knie for the specific purpose of connecting braided lines to monofilament lines. Being an avid surf fisherman from the east coast, often fishing in windy conditions Alberto wanted a strong knot that you can easily tie in the wind. The Alberto knot is similar to the Albright Knot from last week in which it also is tied to a doubled leader line. They also share the trait of being able to run through guides easily. For demonstration purposes, the black paracord is a stand-in for the thicker monofilament leader and the pink braid is a stand-in for your braided mainline.

Editor’s Note: I’m a novice at knot tying and enjoyed this step-by-step writeup from Eugene. I have also found the Animated Knots website to be helpful in the past.

Alberto Knot – Step 1

Start off with your main braided line and your thicker monofilament leader line, and then double up your monofilament leader line into a loop.

Are You Nuts? Know your Fishing Knots! – Alberto Knot

Step 2

The braided line is then run through the loop of the thicker leader line. You want to run about 10″ of the braided line through that loop.

Are You Nuts? Know your Fishing Knots! – Alberto Knot

Step 3

Holding the loop of the leader line with your left hand, start wrapping the braided line around the doubled leader line. You want to make 7 even wraps around the doubled loop of line.

Are You Nuts? Know your Fishing Knots! – Alberto Knot

Step 4

Once you finish the first seven wraps up the loop, you’re going to make seven more wraps back down the loop. Make sure the wraps are going right over the previous loops. Then run the tag end of the braided line back through the loop of your leader.

Are You Nuts? Know your Fishing Knots! – Alberto Knot

Step 5

Once the tag end is back in the original loop, evenly start pulling the Alberto Knot to tighten up the wraps. Once the wraps are all tight you can then cut off the tag ends and your Alberto Knot is ready to be fished.

Are You Nuts? Know your Fishing Knots! – Alberto Knot

The post Are You Nuts? Know your Fishing Knots! – Alberto Knot appeared first on AllOutdoor.com.

AllOutdoor.com

Hidden #Laravel Tip – The Fluent Class

http://img.youtube.com/vi/8PqgRoCe0N0/0.jpgHere, we will be looking at one of the hidden Laravel features that you might not know about. It is Fluent class. The best way to access array related data.Laravel News Links

10 Commandments of Concealed Carry

https://cdn.athlonoutdoors.com/wp-content/uploads/sites/8/2008/10/10-Commandments-of-Concealed-Carry-2.jpg

Carrying a lethal weapon in public confers a grave power that carries with it great responsibilities. Those who lawfully engage in the practice realize that. Those who are considering concealed carry need to know what those experienced people know.

1 – If You Carry Concealed, Always Carry

The criminal is the actor, and the armed citizen is the reactor. The typical violent criminal arms himself only when he intends to do something with it. He picks the time and place of the assault, and initiates the attack. Therefore, he doesn’t need to worry about self-defense.

The armed citizen, the intended victim, does not know when or where that attack will come. Therefore, he or she must be constantly prepared and constantly vigilant. The “pistol-packer” learns to pick a comfortable holster and an appropriately sized handgun, and “dress around the firearm.” After a few days, or a few weeks, it becomes second nature to wear it.

When the defender does not know when the attack will come, the only reasonable expectation of safety lies in being always armed.

2 – Don’t Carry Concealed If You Aren’t Prepared To Use It

There is a great irony that attaches to the defensive firearm. When you analyze a great many defensive gun usages (DGUs) you discover that the great majority of the time, the protection weapon does its job with no blood being shed. Usually, the offender who is confronted with the prospect of being shot in self-defense either breaks off and runs or surrenders at gunpoint.

“The person who is prepared to kill if he or she must, is the person who is least likely to have to do so…”

Its most important asset turns out to be its power to deter. The irony is the fact that its power to deter comes directly from its power to kill.

Understand that criminals do not fear guns. They are, after all, an armed subculture themselves. What they fear is the resolutely armed man or woman who points that gun at them. Criminals are predators, and their stock in trade is their ability to read people and recognize victims. They are very, very good at reading “body language” and determining another’s intent to fight, or lack thereof. In short, you’re not likely to bluff them.

The Message You Send

If you carry a gun, you must be absolutely certain that you can use deadly force. The person who is hesitant or unwilling to do so will, in the moment of truth, communicate that vacillation to the hardened criminal they are attempting to hold at gunpoint. In such a case, it is quite likely that the offender will jump them, disarm them, and use the hesitant defenders’ own weapons against them.

If, however, that same criminal realizes that he is facing a resolute person who will, in fact, shoot him if he takes one more transgressive step, he is most unlikely to take that step.

The irony: The person who is prepared to kill if he or she must, is the person who is least likely to have to do so.

3 – Don’t Let The Gun Make You Reckless

Circa 1970, armed citizen Richard Davis invented the Second Chance vest, concealable body armor that for the first time could be worn constantly on duty, under the uniform, by any police officer. Some alarmists speculated that “being made bulletproof” would cause cops to become reckless. Those fears turned out to be totally unfounded. As any officer who has worn armor can attest, the vest is a constant reminder of danger and, if anything, makes its wearer more cautious.

“Like an officer’s body armor, the armed citizen’s gun is a reminder of danger, a symbol of the need for caution…”

It is much the same with concealed firearms in the hands of responsible private citizens. People unfamiliar with the practice fear that “the trigger will pull the finger,” of the carrier. As a result, armed citizens will go looking for a chance to exercise their deadly power. This, too, is a largely unfounded belief.

A Symbol of the Need for Caution

The collective experience of ordinary, law-abiding people who carry guns is that they don’t feel a sudden urge to go into Central Park at three o’clock in the morning and troll for muggers. They learn that being armed, they are held to “a higher standard of care,” in the eyes of the law. And are expected to avoid situations like traffic arguments. This is because they could escalate and, with a deadly weapon present, turn into killing situations.

Like an officer’s body armor, the armed citizen’s gun is a reminder of danger. A symbol of the need for caution. The late, great big game hunter and gun writer Finn Aagard once wrote, “Yet my pistol is more than just security. Like an Orthodox Jewish yarmulke or a Christian cross, it is a symbol of who I am, what I believe, and the moral standards by which I live.”

4 – Get The License!

You’ll hear some absolutists say, “No government has the right to permit me to carry a gun! I don’t need no stinking permit! The Second Amendment is my license to carry!”

“If you carry, make sure you carry legally…”

That is the sound of someone asking to go to jail. Like it or not, the laws of the land require, in 46 of the 50 states, a license to carry concealed. In two states, there is no legal provision for the ordinary citizen to carry at all. Realize that things are not as we wish they were; things are as they are. If things were as we wish they would be, we wouldn’t need to carry guns at all.

If you are diligent about studying carry license reciprocity, and about seeking non-resident concealed carry permits in states that don’t have reciprocity, you can become legal to carry in some forty or more states. It can get expensive, and it can get tiresome. However, allowing yourself to be made into a felon and being ramrodded through the courts is much more expensive. Not to mention far more tiresome.

Bottom line: if you carry, make sure you carry legally.

Know what to do with your carry gun. Above, the live-fire portion of an LFI-I class is in progress in Wisconsin.
Know what to do with your carry gun. Above, the live-fire portion of an LFI-I class is in progress in Wisconsin.

5 – Know What You’re Doing

You wouldn’t drive an automobile without knowing the rules of the road. Do not keep or carry lethal weapons for defense without knowing the rules of engagement. It is a myth to believe that you can shoot anyone in your home. When Florida rescinded the requirement to retreat before using deadly force if attacked in public, the anti-gun Brady Center introduced a publicity campaign claiming that the new law allowed Floridians to shoot anyone who frightened them. This, of course, was blatantly untrue, but a great many people believed it to be so because “they heard it on TV” or “they saw it in the paper.” Such dangerous misconceptions can cause the tragic death of people who don’t deserve to be shot, and can get good people sent to prison.

“A person who opens fire with a gun they don’t know how to shoot is a danger to all…”

It is the practitioner’s responsibility to “learn the rules of the road” when they take the path toward armed self-defense. There are many firearms training schools. At least one, the author’s Lethal Force Institute, specializes in teaching the rules of engagement. Information is available under the LFI section at www.ayoob.com. It is wise to take local classes that emphasize the rules of “deadly force decision-making.”

Understand the ramifications of concealed carry. Psychologist Aprill explains the emotional aftermath of using deadly force at an LFI-I class in Florida.
Understand the ramifications of concealed carry. Psychologist Aprill explains the emotional aftermath of using deadly force at an LFI-I class in Florida.

A Trained Shooter is a Safe Shooter

Similarly, a person who opens fire with a gun they don’t know how to shoot is a danger to all. If you need the firearm for its intended purpose, you will be under extreme stress. Learn to shoot under pressure. Quick drawing from concealment, safe holstering, proper tactics, and much more are on the curriculum. Likewise, they require practice if you’re serious about defending yourself and your loved ones to the best of your ability.

6 – Concealed Carry Means Concealed

A very few people carrying guns for the first time feel an irresistible urge to let others see that “they’ve got the power.” First-time carriers and rookie cops, usually young in both cases, may fall into this trap. It is a practice to avoid for several reasons.

“A harasser who has picked you as his victim and knows you carry a gun can create a situation where there are no other witnesses present…It is his word against yours…”

In most of this society, the only people the general public sees carrying guns in public are uniformed “protector figures,” such as police officers and security guards. When they see someone not identifiable as such, who is carrying a lethal weapon, they tend to panic. This makes no friends among the voting public for the gun owners’ rights movement—you do not make people into friends and sympathizers, by frightening them—and can lead to a panicky observer getting the wrong idea and reporting you to the police as a “man with a gun.” This can lead to all sorts of unpleasant confrontations.

False Accusations

Moreover, a harasser who has picked you as his victim and knows you carry a gun can create a situation where there are no other witnesses present. He can then make the false claim that you threatened him with the weapon. This is a very serious felony called Aggravated Assault. It is his word against yours. The fact that you are indeed carrying the gun he describes you pointing at him can make his lie more believable than your truth, to the ears of judge and jury.

MCRGO On Open Carry

MCRGO, Michigan Coalition of Responsible Gun Owners, is directly responsible for getting reform concealed carry legislation enacted in their state. Likewise, it has been in the forefront of fighting for the rights of armed citizens in that state. MCRGO’s Steve Dulan, in the organization’s Weekly E’News of 6/23/08, had some cogent points to make on the topic of private citizens carrying handguns visibly in public:

“Open carry of firearms, subject to MCL 750.234d, it is legal to carry a visible pistol in public. MCRGO has not adopted an official position on this subject,” wrote Dulan, who continued, “I agree with Ted Nugent and many others that it is a bad idea in almost every situation. Tactically, you are giving up the element of surprise should you face a deadly force situation. Furthermore, you run the risk of being called in to 9-1-1 as a ‘man with a gun.’ I have been on police ride-alongs when this call comes over the radio. It creates a very dangerous situation for all concerned. I do not carry openly. I have a CPL (Concealed Pistol License) and take care to choose a gun and holster that, along with appropriate clothing, allow me to keep my gun concealed unless/until I need it to save a life.”

The Open Carry Emergency Option

As cogent and valid as Steve Dulan’s arguments are, it still makes sense to have legal open carry available as an emergency option. If the wind blows your coat open and reveals the gun, an open carry provision assures you’ve committed no crime. If someone who has not yet felt the need to get a concealed carry license suddenly begins getting death threats, open carry provides an emergency avenue of self-protection until the paperwork can be processed to acquire the license to carry the weapon discreetly out of sight.

7 – Maximize Your Firearms Familiarity

The more you work with the firearm, the more reflexively skilled you’ll become in its emergency use and safe handling. If your home defense shotgun is a Remington 870, then when you go claybird shooting or hunting, use an 870 pump gun with a barrel and choke appropriate for each task. However, if you are a target shooter who uses the 1911 pistol platform at bull’s-eye matches and have become deeply familiar with it, it makes sense to acquire a concealable 1911 to use as your concealed carry gun, so that the ingrained skill will directly transfer. Likewise, if a double-action .44 Magnum is your hunting revolver, and another double-action revolver is your home defense gun, it makes sense to choose a carry-size revolver as your concealment handgun when you’re out and about.

Consider training classes or competition shoots where your chosen defensive firearm is appropriate to the course of fire. This skill-building will translate to self-defense ability if you ever have to use your concealed carry gun for defense. If training ammunition is too expensive, consider a .22 conversion unit for your semiautomatic pistol. Or you can purchase a .22 caliber revolver the same size as your defensive .38 or .357. The more trigger time you have with a similar gun, the more confidence/competence you’ll have with your carry gun. Especially if you can’t afford to practice as much as you’d like with the carry gun itself.

It’s “asking for trouble” to “go where you’re not wanted.” Taking time to read the fine print on the door of this jewelry store in the usually gun-friendly NH…

8 – Understand The Fine Points

Every state has different laws insofar as where you can and can’t carry a gun. It’s your responsibility to know all the details. In one state, it may be against the law to carry a weapon in a posted “no-gun” zone. In another, that sign may have no weight of law at all behind it. However, in a third, they may ask you to leave if they spot your gun. If you do not depart, you will be subject to arrest for Trespass After Warning.

In New Hampshire, it’s perfectly legal to carry your gun into a bar and sit down to have a drink. If you do the same in Florida, it’s an arrestable offense. Although you may have a cocktail in a restaurant with a liquor license. However, you must sit in a part of the establishment that earns less than 50% of its income from selling alcoholic beverages by the drink. In North Carolina, you can’t even walk into a restaurant that has a liquor license, with a gun on. And, perhaps strangest of all, in the state of Virginia, it’s illegal to enter a tavern with a concealed handgun. But it’s perfectly legal to belly up to the bar and sip a whiskey while open carrying a loaded handgun.

You can find a superb current compendium of gun laws in the 50 states at www.handgunlaw.us. Review it frequently for possible changes.

9 – Carry An Adequate Firearm

If you carry a single-shot, .22 Short caliber derringer, law enforcement will consider you armed with a deadly weapon. However, you will not be adequately prepared to stop a predictable attack by multiple armed assailants. Most experts recommend a five-shot revolver as the absolute minimum in firepower. Likewise, the .380/9mm/.38SPL range is the minimum potency level in terms of handgun caliber.

“Once you’ve found a carry gun that works for your needs, it’s a good idea to acquire another that’s identical or at least very similar…”

It is a good idea to carry spare ammunition. Many people in their first gunfight have quickly found themselves soon clicking an empty gun. A firearm without spare ammunition is a temporary gun. Moreover, many malfunctions in semiautomatic pistols require a fresh (spare) magazine to rectify. Some fear that carrying spare ammo will make them look paranoid. They need to realize that those who don’t like guns and dislike the people who carry them, will consider carrying the gun without spare ammunition to still be paranoid. It’s an easy argument to win in court. Cops carry spare ammunition. So should you.

Carrying a Concealed Backup

Carrying a second gun has saved the lives of many good people. For example, when a criminal’s bullet hits the primary weapon, rendering it unshootable. Or when it is knocked out of the defender’s hand, or a criminal snatches it away. Also, when the first gun runs out of ammo and there is no time to reload. The list of reasons is endless. It suffices to remember the words of street-savvy Phil Engeldrum: “If you need to carry a gun, you probably need to carry two of them.”

At the very least, once you’ve found a carry gun that works for your needs, it’s a good idea to acquire another that’s identical or at least very similar. If you have to use the first gun for self-defense, it will go into evidence for some time. But you want something you can immediately put on to protect yourself from vengeful cronies of the criminal you had to shoot. If the primary gun has to go in for repair, you don’t want to be helpless or carrying something less satisfactory while you’re waiting to get it back.

10 – Use Common Sense

The gun carries with it the power of life and death. That power belongs only in the hands of responsible people who care about consequences. Likewise, those who are respectful of life and limb and human safety. Carrying a gun is a practice that is becoming increasingly common among ordinary American citizens. Common sense must always accompany it.

Didn’t find what you were looking for?

The post 10 Commandments of Concealed Carry appeared first on Tactical Life Gun Magazine: Gun News and Gun Reviews.

Tactical Life Gun Magazine: Gun News and Gun Reviews

The Best Air Fryer Toaster Oven

https://cdn.thewirecutter.com/wp-content/media/2022/11/airfryertoasterovens-2048px-1826-3×2-1.jpg?auto=webp&quality=60&width=630&dpr=2

The Best Air Fryer Toaster Oven

Air frying has come full circle. When we started testing pod-shaped air fryers in 2017, we concluded that they were too cramped and not versatile. We’ve since come around, but we still think convection toaster ovens (which use the same technology) can cook a wider variety of foods more evenly, if a little slower. Now, more and more companies are bridging the gap by making amped-up convection toaster ovens—sold as “air fryer toaster ovens”—with extra-powerful fans that produce crispy results in shorter times. After testing dozens of models, we think the Breville Smart Oven Air Fryer Pro is the only one that’s both an excellent air fryer and an excellent toaster oven—but it’s pricey.

Dismiss

Wirecutter: Reviews for the Real World

Are You Nuts? Know your Fishing Knots! – Albright Knot

https://www.alloutdoor.com/wp-content/uploads/2022/11/20221110_164657-e1668117566693.jpg

Today I’m going to cover another line-to-line connection with the Albright knot. A relatively simple knot that is moderately easy to tie. The Albright knot is a versatile knot that can be used to connect monofilament to braided line or braid to wire. It is also very useful for connecting monofilament lines that have a big difference in their line diameters. I know this knot is often used by surf fisherman in the northeast for connecting a heavy monofilament or fluorocarbon leader to the braid as they’re plugging in the surf. The knot is pretty low-profile making it great at sliding in and out of the line guides as you cast or when a big fish pulls enough drag to get your line to the backing. You can even use some glue to smooth the knot down even further to have a snag free option.

Step 1

Get your two lines side by side, the black cord is acting as a thicker leader line.

Are You Nuts? Know your Fishing Knots! – Albright Knot

Step 2

Double back the leader line and make a loop with it, then run the other line through the loop, making sure to have enough tag for the wraps that are coming up. You want the thicker line to be the line that forms the loop.

Are You Nuts? Know your Fishing Knots! – Albright Knot

Step 3

Take the line that you ran through the loop and start wrapping it neatly around the loop about 10 times. Make sure the loops are tight against each other and don’t overlap each other.

Are You Nuts? Know your Fishing Knots! – Albright Knot

Step 4

Once you got the loops all done and neat keep everything pretty snug and neat like this.

Are You Nuts? Know your Fishing Knots! – Albright Knot

Step 5

Run the tag end of the wrapping line back through the original loop.

Are You Nuts? Know your Fishing Knots! – Albright Knot

Step 6

Once the line is back through the loop moisten the knot and pull the Albright knot up tight. Then trim the tag ends of the lines and it is finished. There is one last optional step of using some glue to secure the knot up even further and flatten the tags down. This will make for the smoothest and strongest knot possible but not needed every time.

Are You Nuts? Know your Fishing Knots! – Albright Knot

The post Are You Nuts? Know your Fishing Knots! – Albright Knot appeared first on AllOutdoor.com.

AllOutdoor.com

Fisher Cerakote Space Pens

https://theawesomer.com/photos/2022/11/fisher_cerakote_space_pens_t.jpg

Fisher Cerakote Space Pens

 | Buy

Fisher Space Pens are known for their longevity and ability to write in tough conditions. Fisher teamed up with NIC Industries to create Cerakote versions of their Bullet and Cap-O-Matic Space Pens. This ceramic coating protects against grime while improving grip. They come in matte black, tungsten, and Black Cherry.

The Awesomer

Tiny TV 2 + Tiny TV Mini

https://theawesomer.com/photos/2022/11/tiny_tv_sets_t.jpg

Tiny TV 2 + Tiny TV Mini

 | Pledge | Link

You can run to the Walmart or Costco and pick up an 85″ TV. But if you think that’s overkill, perhaps TinyCircuits’ miniature TV cabinets are more your thing. The TinyTV 2 has a 1″ screen with a 216×135 resolution, while the TinyTV Mini has an even smaller 0.6″ display with a 64×64 pixel grid. They play videos uploaded to an SD card.

The Awesomer

Your Mac Has a Hidden White Noise Generator

https://i.kinja-img.com/gawker-media/image/upload/c_fill,f_auto,fl_progressive,g_center,h_675,pg_1,q_80,w_1200/a1c777020d9b1f9dd584d56f5350bba7.jpg

Photo: Gorodenkoff (Shutterstock)

If you want to drown out environmental noise, or you just like having white noise in the background while you work, you should try your Mac’s white noise generator. The feature is actually built into every Mac that runs macOS Ventura, you just need to know where to find it.

How to enable Background Sounds on macOS Ventura

You can find the white noise generator in your Mac’s settings menu. Click the Apple logo in the top-left corner of the screen and select System Settings. Next, select Accessibility in the left sidebar and click Audio in the right pane. Go to the Background Sounds section to enable Background Sounds. Once you’ve done that, you can select from a bunch of different sounds for your Mac. Click the Choose button next to Background Sound and you’ll see the following options:

  • Balanced Noise
  • Bright Noise
  • Dark Noise
  • Ocean
  • Rain
  • Stream

Hit the download button next to the sounds you want to download. That’ll save them to your Mac so you can also play them if you’re offline.

On the previous settings page, there are a couple useful options you should also check out. The first is Background Sounds Volume, which lets you set the volume level for the audio files. Once you’ve picked a comfortable volume, enable Turn off Background Sounds when your Mac is not in use. This setting will stop the sounds when your Mac goes to sleep.

How to generate white noise on older versions of macOS

Unfortunately, Apple’s Background Sounds feature is restricted to the Macs that can run Ventura. If you have an older Mac, you can use other tools to play white noise in the background. Music streaming services usually have a pretty good collection of white noise. Here are some examples on Spotify, Apple Music, and YouTube. Alternatively, you can try white noise apps such as Noizio.

G/O Media may get a commission

Super stylish STEM learning.
These Mann Magnets Gear Toys are a simple and stylish way for kids to learn to problem solve in a STEM setting. With this set, kids can group and design, creating more complex gears as they learn.

 

Lifehacker