[How-To] Zero a Rifle Scope Quickly & Easily

[How-To] Zero a Rifle Scope Quickly & Easily

https://ift.tt/3sqsPIu

There are some basic life skills that everyone should have…how to change a tire, how to sharpen a knife, how to steal the Declaration of Independence. 

Steal Declaration of Independence
Nick Cage knows what’s up.

Sure, you could have someone do it for you — but it’s better to just learn the skill yourself.

The same can be said for zeroing your rifle scope.

It’s quick, it’s easy, and you’ll never need to rely on someone else to do it for you.

PA 1-8x through scope
View through the Primary Arms 1-8x SLx on a bright day.

In this article, we’re going to cover the important aspects of zeroing you need to know.

From basic terminology to the actual steps involved in getting your rifle on target, you’ll get a good grasp on what it takes to zero any scope.

So, read on to learn more…

Table of Contents

Loading…

Basic Terms And Important Info

If you want to learn to zero a scope, I’m going to bet that you’re either a very new shooter or at least very new to optics.

Either way, let’s cover some terms and other basic info that will help you out down the road.

POI vs. POA

Very simple, your point of impact and your point of aim.

They are both exactly what they sound like.

Point of impact (POI) is where your round hits the target.

Point of aim (POA) is where your reticle or sight is on the target.

POI Vs. POA
POI Vs. POA

Turrets

They come in many flavors but they should have some common characteristics. Turrets turn and should be marked with hash marks and maybe numbers.

Each mark should be one “click” and you should be able to feel the turret’s detent literally click as you turn the turret.

Some are more clicky than others though. The cheaper the scope the less likely you’ll get good firm clicks.

Each of those marks and clicks correspond to how much your reticle moves. While it depends on your scope, the most common adjustment increments are 1/4 MOA, 1/2 MOA, and 0.1 MILs. 

Normally on your turret or on the cap for the turret, it will tell you how much your clicks are.

Athlon BTR Gen II (8)
Athlon BTR Gen II, 1 click = 0.1 MIL

MOA vs. MIL

For zeroing your scope it really doesn’t matter if you’re in MILs or MOA.

If you’re counting and trying to math your way to a zero, then you’ll need to know what your scope is calibrated in.

But that’s about it.

Yards vs. Meters

Kind of like MOA and MIL, it’s not critical what unit of measurement you use.

Keep in mind that MOA and MILs are angler measurements. They can BOTH be used with EITHER yards or meters. It just changes the math a bit.

Family Guy Math

Normally — MOA is going to be in yards and this is the most common measurement in general. 

Whatever unit you pick, stick with it. It’s important to keep things consistent so that you don’t have to do conversion after conversion.

Bullets Travel in an Arc! (kind of but not really)

Something you might have been told or might think yourself is that bullets travel in an arc. That’s…not really true. Kind of.

Ballistic arc
Ballistic arc RifleShooter

If you’re aiming level, your bullet will not rise significantly before falling. Gravity is going to do what gravity does and start pulling that bullet down to earth as soon as it leaves the barrel.

A bullet fired level to the ground and a bullet dropped from the same height will hit the ground at the same time.

Where the arc comes from is in how we aim. Because we know gravity is a thing and it’s constant, it’s easy to account for.

gravity stick man physics
Gravity, yo

When you zero a rifle, you’re generally zeroing it so that the barrel is angled up and away from you. While your line of sight remains flat and on target, the barrel is pointed slightly up.

When you fire, the bullet leaves the barrel traveling upward first — then starts to fall thus giving an “arc.”

We can exploit this for our own gain, but more on that later.

What Distance Should I Zero?

Before you hit the range, think about what distance you want to zero your rifle.

The normal standard is generally 100-yards for a centerfire rifle and 25/50-yards for a .22 LR rimfire rifle.

If you’re not sure what to zero your rifle at or want to make it easy, just pick one of those.

600 Yards at Angeles Range, Marked
600-yards at Angeles Range. We still zero at 100!

Honestly, unless you’re trying to be fancy, it doesn’t matter which one you choose.

If you want to go a little deeper though, you might consider the Maximum Point Blank Range method.

Maximum Point Blank Range

Remember six sentences ago when I said we could exploit the arc for our gain? Well, this is how.

Draw a straight line through your ballistic arc and the lines will intersect twice — once closer to you and once further away. This gives you two zero points such as a 25/300, 36/300, etc.

bullet trajectory vs line of sight
Bullet trajectory vs line of sight…not to scale!

MPBR is the range that your rifle can shoot with minimal elevation change. Note, this is not for precision shooting. This is for kill-shot shooting. 

Think of it this way: if a whitetail deer’s heart and lung area is roughly a 7-inch circle, it’s not critically important if you hit the top, bottom, or center of that circle.

Champion Traps and Targets, Deer Target 25x25 (6 Pack)
If you’re getting ready for deer season, targets like this can help too.

With a little ballistic math, you can zero your rifle so that at any distance out to 200-, 300-, or even 400-yards your shot elevation will be within that circle.

When you’re in the field, just account for wind and point and click on the center of your target to fill your freezer.

This is also how military zeros work, normally called Battlesight Zeros. 25/300-meters and 36/300-yards are the US Army and USMC standards for 5.56 NATO and work the same way as an MPBR.

Army
If it’s good enough for the military, it’s good enough for us.

Keep in mind that an MPRB only works if you have good data and use the same ammo consistently.

If you zero with .30-06 M2 ball and then hunt with .30-06 Hornady ELD-X, your zero is going to be wrong.

If you want to dive into the why and how behind it all, take a look at the Best AR-15 Battlesight Zero. But for now, just trust the magic.

magic

I use an MPBR for my home defense rifle off a 25/225-yard zero.

From 0-yards to 250-yards, I’m never more than 3-inches high or low from my point of aim. My rifle has a red dot, so 250-yards is at the upper limit that I would push the rifle.

What About REALLY Long Range?

100-yards for centerfire, 25/50 for rimfire.

Unless you’re shooting ELR at something crazy like 2,000+ yards, just zero at 100-yards.

sighting in rifle
100-yards is an adequate distance to zero.

There is no real advantage at zeroing past 100-yards even for long-range shooting and 100-yards gives you an easy base to go off of.

Unless…you can’t. If you’re using a 20, 30, or more MOA base — you might have a problem.

20, 30, 40 MOA Bases, Rails, and Rings

Okay, we’re starting to get in the weeds here but bear with me.

If your scope rings, base, or rail says it is 20, 30, 40, or really anything more than zero MOA this means it’s machined on an incline to allow for you to use more of your scope’s internal elevation adjustment.

For centerfire 20 MOA is pretty common, for rimfire 20-40 MOA can be found.

You can’t really tell just from looking, but this is a 40 MOA 1913 rail on this Bergara B-14r .22 LR rifle

If your bases/rail/rings don’t mention MOA or say zero MOA, then they are machined normally and you don’t have to worry about this.

Generally, I would recommend that you simply avoid the issue unless you know that you need it. If you’re not sure, then assume you don’t need it.

If you do use one and cannot zero at 100-yards, zero for 200.

How To Zero Your Scope

There are probably two dozen or so different ways of zeroing your scope. None of them are wrong and some of them are easier than others.

All of them are pretty quick and painless though so it really comes down to personal preference.

9 Tested Long Range Scopes
So many scopes…

Having zeroed loads of optics in my time at Pew Pew, I’ve tried many of the methods and have gradually built what I like best.

1. The No-Tech Method

Regardless of where your final zero will land, your first step is to just get your rifle on paper.

“On paper” meaning your point of aim and your point of impact is close enough that you’re at least on the target. 

Daniel Defense DDM4 V7 66-grain ammo target
We’re trying to get shots on the actual target.

It’s always best to zero a scope using a firm rest. Don’t try to do this off-hand or unsupported. Get some bags and shoot off them, use a shooting bench, use a shooting rest, use whatever you want — just do it supported.

PSA .224 Valkyrie At High Bar Homestead
PSA .224 Valkyrie At High Bar Homestead, bipod and rear bag for support

I normally use a front bag or bipod and a rear bag in either a sitting at a bench rest or prone position.

The simple way of doing this is to shoot first at a relatively short range and then work your way back to your zero distance. If I’m going no-tech, I start with 25-yards.

Aim for a bullseye, take a shot, and with the rifle still in a rested and secure position place your crosshair back on the bullseye. Then adjust your turrets until they are over the shot while moving the rifle as little as possible.

Getting On Paper
Not to scale example of shooting at 25-yards.

This takes a firm and steady hand, but once you do it a couple of times it’s super easy. Aim at the bullseye again and take a shot to confirm zero and readjust as needed.

Do it right and you can zero a rifle with just two shots.

Center Shot
Again, not to scale — but you get the idea now

Once you’re on at 25-yards, you can normally move your target back to wherever you want your final zero to be and zero at that range.

Math And Counting

If you find that your hand isn’t steady enough for this method, then switch to a target that has a grid on it.

A target with a grid makes counting inches a LOT easier.

Easy Button
We like easy.

Once you can count how far off your point of impact is from your point of aim, you can just convert that number into clicks and adjust your scope based on that.

For example, let’s say you’re using an MOA scope with .25 MOA click adjustments at 25-yards and your shot was 3-inches low and 2-inches to the left.

Getting On Paper
Using this as our example again, the grid lines make it easy to work out how much and what direction we need to adjust

1-inch at 100-yards is (roughly) 1 MOA. At 25-yards 1 MOA is 1/4-inch. 3-inches at 25-yards would be 12 MOA low. 

12 times 4 is 48 clicks.

Adjust “up” (normally counter-clockwise but check your scope and follow the up arrow) 48 clicks.

For the 2-inches to the left, 8 clicks “right” and you should be pretty on target.

Trigger hand to adjust scope
Making adjustments.

Now personally, I hate this method because…numbers and math and counting and ugh. But hey, if your brain works better with numbers — go for it.

If you want to learn more about MOA or learn about MILs, take a look at the MOA Vs. MRAD article!

2. The Low-Tech Method

If you want to skip needing to paper the gun at a shorter range you might want to look at getting a bore sight.

For me, I have to zero and re-zero a LOT of guns and a LOT of scopes — so I have a Wheeler Pro Bore Sight and it was worth every penny of the $100 I spent. YMMV.

Wheeler Boresight (3)
Wheeler Pro Bore Sight

If you want a cheaper option, there are some decent ones in the $20ish range.

We have a ton more info on that in the Best Laser Bore Sights hands-on testing.

Simply install the bore sight per the instructions, turn it on, and at your zero range adjust your scope so that the dot matches your crosshairs.

Best Bore Sight
107

at Amazon

Prices accurate at time of writing

Prices accurate at time of writing

With this, you should be pretty close to a true zero and most definitely on paper. 

Then just zero your scope like normal and you’re good to go.

So which method do I use?

As you can probably guess, I use a bore sight and the 2-shot zero method. I normally bore sight at home and then final zero at the range. 

I have a back wall that is exactly 55-yards away from my backdoor. It’s easy for me to stand in the dining room with a rifle pointed at a piece of paper I keep in a ziploc on a stick at the base of the wall.

Bushnell Boresight mounted on the .270 Win
A Bushnell Boresight mounted on the .270 Win.

No disturbing the neighbors, no having to bore sight at the range, and I can almost always zero a rifle with literally two shots once I’m at the range.

Once I have my zero I always confirm with a 10-shot group.

Conclusion

Zeroing a rifle is easy to talk about and pretty easy once you do it once or twice, but that first time can be a ride. Maybe you’ll get it in a few shots, maybe you won’t.

If you don’t, it’s okay. If you need to reset and restart, do it.

Squeezing your rear bag to adjust your hight and aim while also giving yourself a solid shooting rest.
Keep at it and you’ll be a zeroing pro in no time!

While none of us like to admit it, most of us screw up zeroing our rifles at one time or another. So take it slow and don’t be too hard on yourself.

What’s your preferred zeroing method? Share your thoughts in the comments below. Meanwhile, check out our guide to the Best Rifle Scopes for All Budgets to find the perfect model for you.

The post [How-To] Zero a Rifle Scope Quickly & Easily appeared first on Pew Pew Tactical.

guns

via Pew Pew Tactical https://ift.tt/2m7cc0U

January 11, 2021 at 05:33PM

These 6 browser extensions will protect your privacy online

These 6 browser extensions will protect your privacy online

https://ift.tt/3sc4LZO

The internet is not a private place. Ads try to learn as much about you to sell your information to the highest bidder. Emails know when you open them and which links you click. And some of the biggest internet snoops, like Facebook and Amazon, follow you from site to site as you browse the web.

But it doesn’t have to be like that. We’ve tried and tested six browser extensions that will immediately improve your privacy online by blocking most of the invisible ads and trackers.

These extensions won’t block every kind of snooping, but they will vastly reduce your exposure to most of the efforts to track your internet activity. You might not care that advertisers collect your data to learn your tastes and interests to serve you targeted ads. But you might care that these ad giants can see which medical conditions you’re looking up and what private purchases you’re making.

By blocking these hidden trackers from loading, websites can’t collect as much information about you. Plus by dropping the unnecessary bulk, some websites will load faster. The tradeoff is that some websites might not load properly or refuse to let you in if you don’t let them track you. You can toggle the extensions on and off as needed, or you could ask yourself if the website was that good to begin with and could you not just find what you were looking for somewhere else?

HTTPS Everywhere

We’re pretty much hardwired to look for that little green lock in our browser to tell us a website was loaded over an HTTPS-encrypted connection. That means the websites you open haven’t been hijacked or modified by an attacker before it loaded and that anything you submit to that website can’t be seen by anyone other than the website. HTTPS Everywhere is a browser extension made by the non-profit internet group the Electronic Frontier Foundation that automatically loads websites over HTTPS where it’s offered, and allows you to block the minority of websites that don’t support HTTPS. The extension is supported by most browsers, including Chrome, Firefox, Edge, and Opera.

Privacy Badger

Another extension developed by the EFF, Privacy Badger is one of the best all-in-one extensions for blocking invisible third-party trackers on websites. This extension looks at all the components of a web page and learns which ones track you from website to website, and then blocks them from loading in the browser. Privacy Badger also learns as you travel the web, so it gets better over time. And it requires no effort or configuration to work, just install it and leave it to it. The extension is available on most major browsers.

uBlock Origin

Ads are what keeps the internet free, but often at the expense of your personal information. Ads try to learn as much about you — usually by watching your browsing activity and following you across the web — so that they can target you with ads you’re more likely to click on. Ad blockers stop them in their tracks by blocking ads from loading, but also the tracking code that comes with it.

uBlock Origin is a lightweight, simple but effective, and widely trusted ad blocker used by millions of people, but it also has a ton of granularity and customizability for the more advanced user. (Be careful with impersonators: there are plenty of ad blockers that aren’t as trusted that use a similar name.) And if you feel bad about the sites that rely on ads for revenue (including us!), consider a subscription to the site instead. After all, a free web that relies on ad tracking to make money is what got us into this privacy nightmare to begin with.

uBlock Origin works in Chrome, Firefox, and Edge and the extension is open source so anyone can look at how it works.

PixelBlock & ClearURLs

If you thought hidden trackers in websites were bad, wait until you learn about what’s lurking in your emails. Most emails from brand names come with tiny, often invisible pixels that alerts the sender when you’ve opened them. PixelBlock is a simple extension for Chrome browsers that simply blocks these hidden email open trackers from loading and working. Every time it detects a tracker, it displays a small red eye in your inbox so you know.

Most of these same emails also come with tracking links that alerts the sender which links you click. ClearURLs, available for Chrome, Firefox and Edge, sits in your browser and silently removes the tracking junk from every link in your browser and your inbox. That means ClearURLs needs more access to your browser’s data than most of these extensions, but its makers explain why in the documentation.

Firefox Multi-Account Containers

And an honorary mention for Firefox users, who can take advantage of Multi-Account Containers, built by the browser maker itself to help you isolate your browsing activity. That means you can have one container full of your work tabs in your browser, and another container with all of your personal tabs, saving you from having to use multiple browsers. Containers also keep your private personal browsing separate from your work browsing activity. It also means you can put sites like Facebook or Google in a container, making it far more difficult for them to see which websites you visit and understand your tastes and interests. Containers are easy to use and customizable.

technology

via TechCrunch https://techcrunch.com

January 10, 2021 at 12:33PM

Video: A behind-the-scenes look at how Kodak manufactures its film

Video: A behind-the-scenes look at how Kodak manufactures its film

https://ift.tt/3hSKtzF

For anyone wondering what the inside of the Kodak film factory looks like Bill Manning’s video tour of parts of the plant might offer a bit of an insight. Bill, from film-enthusiast website Studio C-41, was invited to see the film manufacturing process at the company’s Rochester headquarters and made a video that combines a little history of the Yellow Giant as well as some behind the scenes footage that shows some of the steps.

In the film a Kodak guide explains what is going on and what certain machines do, while cut-away footage introduces the Kodak founder as well as some of the company’s historic cameras. While obviously the emulsion coating is done in the dark and can’t be shown, we do get to see preparation of the film base, the film in its cut form and parts of the process for making the film canisters.

Studio C-41 also has a podcast interview with Kodak staff from 2018 that goes into more depth about how its film is made.

photography

via News: Digital Photography Review (dpreview.com) https://ift.tt/2burdFr

January 7, 2021 at 09:36AM

Scrape a Website With This Beautiful Soup Python Tutorial

Scrape a Website With This Beautiful Soup Python Tutorial

https://ift.tt/38hRUx0

Beautiful Soup is an open-source Python library. It uses navigating parsers to scrape the content of XML and HTML files. You need data for several analytical purposes. However, if you’re new to Python and web scraping, Python’s Beautiful Soup library is worth trying out for a web scraping project.

With Python’s open-source Beautiful Soup library, you can get data by scraping any part or element of a webpage with maximum control over the process. In this article, we look at how you can use Beautiful Soup to scrape a website.

How to Install Beautiful Soup and Get Started With It

Before we proceed, in this Beautiful Soup tutorial article, we’ll use Python 3 and beautifulsoup4, the latest version of Beautiful Soup. Ensure that you create a Python virtual environment to isolate your project and its packages from the ones on your local machine.

To get started, you must install the Beautiful Soup library in your virtual environment. Beautiful Soup is available as a PyPi package for all operating systems, so you can install it with the pip install beautifulsoup4 command via the terminal.

However, if you’re on Debian or Linux, the above command still works, but you can install it with the package manager by running apt-get install python3-bs4.

Beautiful Soup doesn’t scrape URLs directly. It only works with ready-made HTML or XML files. That means you can’t pass a URL straight into it. To solve that problem, you need to get the URL of the target website with Python’s request library before feeding it to Beautiful Soup.

To make that library available for your scraper, run the pip install requests command via the terminal.

To use the XML parser library, run pip install lxml to install it.

Inspect the Webpage You Wish to Scrape

Before scraping any website you’re not familiar with, a best practice is to inspect its elements. You can do this by switching your browser to the developer’s mode. It’s pretty easy to use Chrome DevTools if you’re using Google Chrome.

However, it’s necessary to inspect a webpage to know more about its HTML tags, attributes, classes, and ids. Doing that exposes the core elements of a webpage and its content types.

It also helps you develop the best strategies you can use to get the exact data you want from a website and how you can get it.

How to Scrape a Websites’ Data With Beautiful Soup

Now that you have everything up and ready, open up a preferred code editor and create a new Python file, giving it a chosen name. However, you can also make use of web-based IDEs like Jupyter Notebook if you’re not familiar with running Python via the command line.

Next, import the necessary libraries:

from bs4 import BeautifulSoup
import requests

First off, let’s see how the requests library works:

from bs4 import BeautifulSoup
import requests
website = requests.get('http://somewebpages.com')
print(website)

When you run the code above, it returns a 200 status, indicating that your request is successful. Otherwise, you get a 400 status or some other error statuses that indicate a failed GET request.

Remember to always replace the website’s URL in the parenthesis with your target URL.

Once you get the website with the get request, you then pass it across to Beautiful Soup, which can now read the content as HTML or XML files using its built-in XML or HTML parser, depending on your chosen format.

Take a look at this next code snippet to see how to do this with the HTML parser:

from bs4 import BeautifulSoup
import requests
website = requests.get('http://somewebpages.com')
soup = BeautifulSoup(website.content, 'html.parser')
print(soup)

The code above returns the entire DOM of a webpage with its content.

You can also get a more aligned version of the DOM by using the prettify method. You can try this out to see its output:

from bs4 import BeautifulSoup
import requests
website = requests.get('http://somewebpages.com/')
soup = BeautifulSoup(website.content, 'html.parser')
print(soup.prettify())

You can also get the pure content of a webpage without loading its element with the .text method:

from bs4 import BeautifulSoup
import requests
website = requests.get('http://somewebpages.com/')
soup = BeautifulSoup(website.content, 'html.parser')
print(soup.text)

How to Scrape the Content of a Webpage by the Tag Name

You can also scrape the content in a particular tag with Beautiful Soup. To do this, you need to include the name of the target tag in your Beautiful Soup scraper request.

For example, let’s see how you can get the content in the h2 tags of a webpage.

from bs4 import BeautifulSoup
import requests
website = requests.get('http://somewebpages.com/')
soup = BeautifulSoup(website.content, 'html.parser')
print(soup.h2)

In the code snippet above, soup.h2 returns the first h2 element of the webpage and ignores the rest. To load all the h2 elements, you can use the find_all built-in function and the for loop of Python:

from bs4 import BeautifulSoup
import requests
website = requests.get('http://somewebpages.com/')
soup = BeautifulSoup(website.content, 'html.parser')
h2tags = soup.find_all('h2')
for soups in h2tags:
print(soups)

That block of code returns all h2 elements and their content. However, you can get the content without loading the tag by using the .string method:

from bs4 import BeautifulSoup
import requests
website = requests.get('http://somewebpages.com/')
soup = BeautifulSoup(website.content, 'html.parser')
h2tags = soup.find_all('h2')
for soups in h2tags:
print(soups.string)

You can use this method for any HTML tag. All you need to do is replace the h2 tag with the one you like.

However, you can also scrape more tags by passing a list of tags into the find_all method. For instance, the block of code below scrapes the content of a, h2, and title tags:

from bs4 import BeautifulSoup
import requests
website = requests.get('http://somewebpages.com/')
soup = BeautifulSoup(website.content, 'html.parser')
tags = soup.find_all(['a', 'h2', 'title'])
for soups in tags:
print(soups.string)

How to Scrape a Webpage Using the ID and Class Name

After inspecting a website with the DevTools, it lets you know more about the id and class attributes holding each element in its DOM. Once you have that piece of information, you can scrape that webpage using this method. It’s useful when the content of a target component is looping out from the database.

You can use the find method for the id and class scrapers. Unlike the find_all method that returns an iterable object, the find method works on a single, non-iterable target, which is the id in this case. So, you don’t need to use the for loop with it.

Let’s look at an example of how you can scrape the content of a page below using the id:

from bs4 import BeautifulSoup
import requests
website = requests.get('http://somewebpages.com/')
soup = BeautifulSoup(website.content, 'html.parser')
id = soup.find(id = 'enter the target id here')
print(id.text)

To do this for a class name, replace the id with class. However, writing class directly results in syntax confusion as Python see it as a keyword. To bypass that error, you need to write an underscore in front of class like this: class_.

In essence, the line containing the id becomes:

my_classes = soup.find(class_ = 'enter the target class name here')
print(my_classes.text)

However, you can also scrape a webpage by calling a particular tag name with its corresponding id or class:

data = soup.find_all('div', class_ = 'enter the target class name here')
print(data)

How to Make a Reusable Scraper With Beautiful Soup

You can create a class and put all the previous code together into a function in that class to make a reusable scraper that gets the content of some tags and their ids. We can do this by creating a function that accepts five arguments: a URL, two tag names, and their corresponding ids or classes.

Assume you want to scrape the price of shirts from an e-commerce website. The example scraper class below extracts the price and shirt tags with their corresponding ids or classes and then returns it as a Pandas data frame with ‘Price’ and Shirt_name as the column names.

Ensure that you pip install pandas via the terminal if you’ve not done so already.

import pandas as pd
class scrapeit:
try:
def scrape(website=None, tag1=None, id1=None, tag2=None, id2=None):
if not (website and tag1 and id1 and tag2 and id2)==None:
try:
page = requests.get(website)
soup = BeautifulSoup(page.content, 'html.parser')
infotag1 = soup.find_all(tag1, id1)
infotag2 = soup.find_all(tag2, id2)
priced = [prices.text for prices in infotag1]
shirt = [shirts.text for shirts in infotag2]
data = {
'Price':priced,
'Shirt_name':shirt}
info = pd.DataFrame(data, columns=['Price', 'Shirt_name'])
print(info)
except:
print('Not successful')
else:
print('Oops! Please enter a website, two tags and thier corresponding ids')
except:
print('Not successful!')

The scraper you just made is a reusable module and you can import and use it in another Python file. To call the scrape function from its class, you use scrapeit.scrape(‘Website URL’, ‘price_tag’, ‘price_id’, ‘shirt_tag’, ‘shirt_id’). If you don’t provide the URL and other parameters, the else statement prompts you to do so.

To use that scaper in another Python file, you can import it like this:

from scraper_module import scrapeit
scrapeit.scrape('URL', 'price_tag', 'price_id', 'shirt_tag', 'shirt_id')

Note: scraper_module is the name of the Python file holding the scraper class.

You can also check the Beautiful Soup documentation if you want to dive deeper into how you can make the best use of it.

Beautiful Soup Is a Valuable Web Scraping Tool

Beautiful Soup is a powerful Python screen scraper that gives you control over how your data comes through during scraping. It’s a valuable business tool, as it can give you access to competitor’s web data like pricing, market trends, and more.

Although we’ve made a tag scraper in this article, you can still play around with this powerful Python library to make more useful scraping tools.

non critical

via MakeUseOf.com https://ift.tt/1AUAxdL

January 6, 2021 at 01:05PM

Manufacturing: How Do They Get the Bristles Into a Toothbrush?

Manufacturing: How Do They Get the Bristles Into a Toothbrush?

https://ift.tt/2L7lJrs

You probably realize toothbrush handles are injection-molded pieces of plastic. But how do they get the nylon bristles into the head? And without using adhesive, how do they get the bristles to stay put?

Here’s how. This is a shot of the machine that loads the bristles into the heads, at actual speed:

Here’s the process from a different angle, slowed down:

The close-up in slow motion, below, provides the answer. The tool that grabs the bristles also folds them in half (off camera) and binds them into a bunch by wrapping them with wire near the fold. In this shot below, you can see the wire binding that’s holding the butt end of the bristles.

The wire binding provides a friction fit in the molded holes, both keeping the bristles together and preventing them from falling out.

Video of the full process below.

fun

via Core77 https://ift.tt/1KCdCI5

January 6, 2021 at 11:49AM

Customize Views

Customize Views

https://ift.tt/2JO98ss


Jetstream allows you to publish all views and Blade components to your project folder, making it easy to customize the look and feel of your application. Let’s review how.

programming

via Laracasts https://ift.tt/1eZ1zac

January 6, 2021 at 10:25AM

Laravel Jetstream v2 is released

Laravel Jetstream v2 is released

https://ift.tt/2Lt3hJt

Laravel Jetstream v2 is now released and available for all. This release features team member invitations, Inertia Authentication Views, Team Switcher Improvements, Accessibility Improvements, Tailwind 2.0 support, and more.

The post Laravel Jetstream v2 is released appeared first on Laravel News.


Join the Laravel Newsletter to get Laravel articles like this directly in your inbox.

programming

via Laravel News https://ift.tt/14pzU0d

January 5, 2021 at 09:21PM

pavel-mironchik/laravel-backup-panel

pavel-mironchik/laravel-backup-panel

https://ift.tt/398sOzS


Laravel Backup Panel

Latest Version on Packagist
Build Status
Quality Score
StyleCI
Total Downloads

Laravel Backup Panel provides a dashboard for spatie/laravel-backup package.
It lets you:

  • create a backup (full | only database | only files)
  • check the health of your backups
  • list all backups
  • download a backup
  • delete a backup
  • monitor used disk storage

Screenshot

It resembles the look and functionality of another Spatie package: spatie/nova-backup-tool.
This was done on purpose, so users can easily migrate from one to another.
Only it doesn’t use polling.
A “real-time” updates of a backups list isn’t such a necessarily thing and an intensive polling can cause unexpected charges if you use services that require to pay per API requests, such as Google Cloud Storage.
Also, some users reported about hitting a rate limit of Dropbox API.

Requirements

Make sure you meet the requirements for installing spatie/laravel-backup.

Installation

First you must install spatie/laravel-backup into your Laravel app.
The installation instructions are here.
When successful, running php artisan backup:run on the terminal should create a backup and php artisan backup:list should return a list with an overview of all backup disks.

You may use composer to install Laravel Backup Panel into your project:

$ composer require pavel-mironchik/laravel-backup-panel

After installing, publish it resources using provided Artisan command:

$ php artisan laravel-backup-panel:install

This will place assets into public/laravel_backup_panel directory, add config file config/laravel_backup_panel.php, and register service provider app/Providers/LaravelBackupPanelServiceProvider.php.

Upgrading

When upgrading the package, do not forget to re-publish assets:

$ php artisan vendor:publish --tag=laravel-backup-panel-assets --force

Configuration

Laravel Backup Panel exposes a dashboard at /backup. Change it in config/laravel_backup_panel.php file:

Sometimes you don’t want to run backup jobs on the same queue as user actions and things that is more time critical.
Specify your desired queue name in config/laravel_backup_panel.php file:

'queue' => 'dedicated_low_priority_queue',

By default, you will only be able to access the dashboard in the local environment.
To change that, modify authorization gate in the app/Providers/LaravelBackupPanelServiceProvider.php:

/**
 * Register the Laravel Backup Panel gate.
 *
 * This gate determines who can access Laravel Backup Panel in non-local environments.
 *
 * @return void
 */
protected function gate()
{
    Gate::define('viewLaravelBackupPanel', function ($user) {
        return in_array($user->email, [
            'admin@your-site.com',
        ]);
    });
}

Usage

Open http://your-site/backup. You’ll see a dashboard and controls to use.

Testing

Changelog

Please see CHANGELOG for more information about what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Development

Make sure you’ve prepared a dummy Laravel application to test the package in, because assets will be copied there by this line in webpack.mix.js:

.copy('public/vendor/laravel_backup_panel', '../laravel-backup-panel-test/public/vendor/laravel_backup_panel');

Security

If you discover any security related issues, please email mironchikpavel@gmail.com instead of using the issue tracker.

Support

If you like this package, consider supporting it. You can use this in such ways:

  1. If you don’t have a Digital Ocean account yet – use this link https://m.do.co/c/d9cd33e44510 to register one. You will get $100 in credit over 60 days, and once you spent $25 – I will get $25 too. This will cover the cost of hosting my nonprofit open-source projects there.
  2. If you have some Laravel/Vue project/work to be done, then contact me – mironchikpavel@gmail.com. I work as a freelancer (mostly at UpWork), and such a project can pay my bills.

And any other help will be appreciated.

Credits

License

The MIT License (MIT). Please see License File for more information.

programming

via Packalyst :: Latest Packages https://ift.tt/2OrBsQj

January 5, 2021 at 05:10PM

Why Are You Closed? Metal Edition

Why Are You Closed? Metal Edition

https://ift.tt/3olqgoo

Why Are You Closed? Metal Edition

Link

More than a decade ago, a video went viral featuring a rather hostile man who was really perturbed that the doors to a Toronto shopping mall were locked. Now, Andre Antunes has dusted off this Internet gem and given it the heavy metal soundtrack that it always deserved.

fun

via The Awesomer https://theawesomer.com

January 5, 2021 at 11:00AM

Laravel DataTables Tutorial With Example

Laravel DataTables Tutorial With Example

https://ift.tt/38dXkJu


In this tutorial, we will learn how to use Laravel DataTables step by step with an example. The Datatable is a very common functionality for most of the CMS.

Most of the DataTable plugin or package provides common functionalities like listing, filtering, searching, sorting, pagination, etc. If we create all these functionalities manually then it will take lots of time. Instead, we can use available Laravel DataTables like jQuery DataTable, yajra DataTable, etc. These two are mostly used in CMS.

Here I am going to share how can you easily install that package and use Laravel DataTables to list out the data. Are you ready guys?

Let’s start.

Please note that this Laravel Datatables demo has created in Laravel 8 version

Laravel DataTables Integration

01 Install Laravel

We are presuming that you already have a Laravel project set up on your machine either it’s a fresh installation or an existing Laravel application. If you don’t have it then run the following command to install a new Laravel application.

composer create-project --prefer-dist laravel/laravel datatable-demo

Or, you may install the Laravel Installer as a global Composer dependency after that you just need to run the laravel new datatable-demo to create a new Laravel application instead of the above long command.

composer global require laravel/installer

laravel new datatable-demo

You are now done with Laravel installations. Let’s move on next step.

02 Install Yajra Laravel Datatables Package

Most of the Laravel developers know the term “Packages”, if not then read the following definition:

A package is a piece of reusable code that can be dropped into any application and be used without any tinkering to add functionality to that code. You don’t need to know what is happening inside, only what the API for the class(es) are so that you can archive your goal

We don’t need to worry about the packages. It has some files and code inside it but one thing is for sure that it will solve our problem faster than we might think.

We hope you are now clear with the packages. Let’s go ahead.

Now, open your command-line tool and navigate it to the datatable-demo directory where we just installed the project. We are using Git Bash as a command-line tool, you can use your own or you can install Git Bash from here as per your OS: https://git-scm.com/downloads

Run the following commands:

composer require yajra/laravel-datatables-oracle

Now, wait until your installation finishes the process

yajra datatables

You are now done with packages installations. Let’s move on next step.

03 Register Service Provider In config/app.php

To register the service provider, open the config/app.php file. And add the following line in 'providers' array at the end

'providers' => [
 .....
 Yajra\DataTables\DataTablesServiceProvider::class,
]

Also, add the following line to the 'aliases' array at the end. You can use any aliases as you want like we have used ‘DataTables’ but you can also use aliases like ‘DT’, ‘myTable’, ‘Table, etc.

We shouldn’t worry about the aliases, It’s just a short form of service provider class so that we don’t need to write the whole path while using it in Controllers. Hope you are getting it. Great!

'aliases' => [
 .....
 'DataTables' => Yajra\DataTables\Facades\DataTables::class,
]

04 Dummy Records

Follow this step only if you don’t have enough data in your system else skip this step. We will create some dummy data with the help of inbuilt tinker tool. If you don’t know about tinker then read following definition and use.

The php artisan tinker provides you a Psy Shell console. The tinker console allows you to interact with your application like you can generate fake data for your application, you can test Laravel relationship, you can perform CRUD operation on any Model (Create User, Delete User, etc.) and much more.

Hope you now got the basic idea of a tinker. Now, run the following command to enter into the tinker shell.

php artisan tinker

After entering into the tinker (REPL) shell, run the below command:

User::factory()->count(20)->create()

Above command will create new 20 users into our system. Let’s move ahead.

05 Register Route In routes/web.php

Open the routes/web.php file to add or register a new route. You can create routes as per your Controller and Method. Here, we have UserController, and in that, we have index() method. So now our route will look like as below:

Route::get('users', '[email protected]')->name('users.index');

06 Create Controller

Let’s now create a controller. You can create it by copying any other controller code or run the following command in your command-line tool.

php artisan make:controller UserController -r

After running the above command a new file has been created into your app/Http/Controllers/UserController.php.

Open the controller file and write down the following code into it.

app/Http/Controllers/UserController.php

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use DataTables;
use App\Models\User;

class UserController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index(Request $request)
    {
        if ($request->ajax()) 
        {
            $data = User::get();

            return Datatables::of($data)
                    ->addIndexColumn()
                    ->make(true);
        }
        return view('users');
    }
}

07 Create View

Now, create the users.blade.php file in resources/views/users.blade.php path.

<!DOCTYPE html>
<html>
   <head>
      <title>Laravel Datatables Tutorial | ScratchCode.io</title>
      <meta name="csrf-token" content=""/>
      <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css" />
      <link href="https://cdn.datatables.net/1.10.19/css/dataTables.bootstrap4.min.css" rel="stylesheet">
   </head>
   <body>
      <div class="container">
         <h1 class="mb-5 mt-5">Laravel Datatables Tutorial | ScratchCode.io</h1>
         <table class="table table-bordered data-table">
            <thead>
               <tr>
                  <th>ID</th>
                  <th>Name</th>
                  <th>Email</th>
               </tr>
            </thead>
            <tbody>
            </tbody>
         </table>
      </div>
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script>  
      <script src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
      <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
      <script src="https://cdn.datatables.net/1.10.19/js/dataTables.bootstrap4.min.js"></script>
      <script type="text/javascript">
         $(function () {
           var table = $('.data-table').DataTable({
               processing: true,
               serverSide: true,
               ajax: "",
               columns: [
                   {data: 'DT_RowIndex', name: 'DT_RowIndex'},
                   {data: 'name', name: 'name'},
                   {data: 'email', name: 'email'},
               ]
           });
         });
         
      </script>
   </body>
</html>

Hurray! we are now done with all the steps. Now, run the below command to serve our application.

php artisan serve

Now, access the below URL in your favorite browser.

http://127.0.0.1:8000/users

Laravel DataTables Output

You might be seeing the same output for Laravel Datatables as our like below:

laravel datatables ajax

Additionally, read our guide:

  1. Best Way to Remove Public from URL in Laravel
  2. Error After php artisan config:cache In Laravel
  3. Specified Key Was Too Long Error In Laravel
  4. AJAX PHP Post Request With Example
  5. How To Use The Laravel Soft Delete
  6. How To Add Laravel Next Prev Pagination
  7. cURL error 60: SSL certificate problem: unable to get local issuer certificate
  8. Difference Between Factory And Seeders In Laravel
  9. Laravel: Increase Quantity If Product Already Exists In Cart
  10. How To Calculate Age From Birthdate
  11. How to Convert Base64 to Image in PHP
  12. Check If A String Contains A Specific Word In PHP
  13. How To Find Duplicate Records in Database
  14. How To Convert Word To PDF In Laravel
  15. Laravel One To One Relationship Tutorial

That’s it for now. We hope this article helped you to learn Laravel DataTables.

Please let us know in the comments if everything worked as expected, your issues, or any questions. If you think this article saved your time & money, please do comment, share, like & subscribe. Thank you in advance. 🙂 Keep Smiling! Happy Coding!

programming

via Laravel News Links https://ift.tt/2dvygAJ

January 4, 2021 at 08:33PM