Let’s begin by learning how to visualize data as a chart. This might be useful for an…Laracasts
Y.M.C.A. as a Heavy Metal Song
https://theawesomer.com/photos/2022/08/ymca_heavy_metal_edition_t.jpg
Get yourself clean, have a good meal, and do whatever you feel. Leo Moracchioli is here to rock out a high-energy cover version of the Village People’s 1978 disco track Y.M.C.A.. The only thing better would have been if Leo had worn the original cop’s uniform.
The Awesomer
Uintah Precision Modern Sporting Muzzleloader
https://www.thefirearmblog.com/blog/wp-content/uploads/2022/08/Uintah-Precision-Modern-Sporting-Muzzleloader-1-180×180.jpg
Uintah Precision, a company primarily known for making bolt action AR uppers and complete firearms, has entered the muzzleloader market. However, what they make is not your great-great-grandfather’s muzzleloader. The new Uintah Precision Modern Sporting Muzzleloader can be easily mistaken for one of their AR bolt guns, but if you look closely, you’ll notice a ramrod […]
The post Uintah Precision Modern Sporting Muzzleloader appeared first on The Firearm Blog.
The Firearm Blog
This is how a gun manufacturer should respond
Amid an unprecedented and unjustified attack on the firearm industry, Smith & Wesson President & CEO issues strong statement: pic.twitter.com/6NHztbGIe4
— Smith & Wesson Inc. (@Smith_WessonInc) August 15, 2022
S&W learned its lesson from the Clinton capitulation. This S&W has a pair of balls on it.
Gun Free Zone
Woox Thunderbird Throwing Axe
https://www.ammoland.com/wp-content/uploads/2022/08/WOOX-AXE-500×333.jpg

U.S.A. -(AmmoLand.com)- As soon as I received a Press Release from Chip Hunnicutt about the WOOX throwing axe I knew that I had to check one out. So, long story short-before long I was throwing a WOOX Thunderbird Axe at a dead tree in the backyard. I’ve messed around on a small-time basis with throwing knives. Years ago I met a girl that was the knife throwing queen with a major knife company at the SHOT Show. She was really good and the traffic at her booth was slow so she took some time and worked with me a bit. I learned quite a bit from her.
I’m not a knife-throwing expert but from what I can tell, here are the basics. It is imperative to release the knife at the exact same spot every time. You can’t release it one time with your arm fully extended and the next time with your elbow half bent. Or else one time, the knife will hit on its point and the next time on the end of the handle.
The next big pointer. If your knife hits the target on the hilt of the handle, then you need to either step backwards or forwards, which will correct the point of impact. So really, in a nutshell, it is that simple.
Now let’s switch gears and jump into axe throwing. I like throwing an axe more because since it has a convex cutting edge, it has a larger sticking surface. So even if my throw isn’t dead on it is more likely to stick.
I’m not a competition axe thrower by any means, but by chance, this week, I was over in South Dakota and noticed that there is an axe throwing facility named Hub City Axe Throwing located in the Aberdeen mall. In a short amount of time, I was meeting with the owner Ryan Perrion. He is #75 in the WATL (WORLD AXE THROWING LEAGUE). There are two major leagues. The other one is IATF (INTERNATIONAL AXE THROWING FEDERATION). When covering a topic that I’m not well versed in, I interview an expert. In talking to Ryan, here are a few insights he shared.
- He affirmed what I stated above that due to the convex edge, an axe is a little easier to stick than a knife.
- He demo’d how important it is to throw from the exact same distance every time. He threw and had a marginal stick. Then he stepped back 6-inches further and threw with the exact same form. Solid stick. It was amazing how much of a difference that 6-inches made.
- He suggested when getting an axe, be sure to get one that fits you. Look for the proper weight, handle size and length of handle that fits you personally. And if you plan on throwing competition, different leagues have different axe specs, so buy accordingly.
- In competition they throw from 10 feet and 15 feet.
I don’t foresee myself doing competition axe throwing, but it was interesting talking to Ryan, and I learned a lot from him. So, if you’re interested in axe throwing competitions, check and see if there is a venue near you. Or, more likely, you’re like me and would just like to throw one and mess around. When you’re up in the mountains camping, you need to have some activities for everyone to do when lounging around camp. I think it’d be fun to set up a log to throw at. Or you could cut a wafer out of a log and spray paint some circles on the end and throw at that. That’d be a great way to pass time in camp.
So I think throwing a WOOX Thunderbird Axe could be great fun while hanging out in camp. In another few weeks, I’ll have an elk camp set up in the mountains for the archery season. I think it’ll be fun getting to practice more with my new WOOX Thunderbird Throwing Axe. Who knows, my next article may be on how I filled my elk tag with my new WOOX Thunderbird Throwing Axe. I can’t be much worse of a shot with it than I am with my bow!
So grab a WOOX axe and see if you can pick an apple off of your mother-in-law’s head. The MSRP on the WOOX Thunderbird Axe is $69.00. it is offered in purple, orange, blue or black. According to Ryan they make some decent axes. I’d recommend you also get the leather sheath for $29.00, and as is usual, we will close with the company comments.
The Thunderbird from WOOX is a dedicated axe for throwing, featuring a lightweight head for more accuracy and precision. The tomahawk style is just as home as a one-handed wood cutter for those times when you need to make quick work of chopping projects.
The 14” handle is real American Appalachian hickory and the Italian tempered carbon steel head comes in your choice of four distinct colors, perfect for teams or distinguishing singles competition throwing. The Thunderbird meets ALL the National and International competition requirements (WATL & IATF).
Thunderbird accessories:
– Sheath – protect your sharp edge and prevent unintended cuts
– Whetstone Puck – maintain your Thunderbird’s edge with this dual grit whetstone
About Tom Claycomb
Tom Claycomb has been an avid hunter/fisherman throughout his life as well as an outdoors writer with outdoor columns in the magazine Hunt Alaska, Bass Pro Shops, Bowhunter.net, and freelances for numerous magazines and newspapers. “To properly skin your animal you will need a sharp knife. I have an e-article on Amazon Kindle titled Knife Sharpening for $.99 if you’re having trouble.”
AmmoLand Shooting Sports News
Everything You Need to Know to Start Writing Bash Programs
https://static1.makeuseofimages.com/wordpress/wp-content/uploads/2022/08/photo-of-a-command-line-interface-.jpg
Bash scripts come in handy for automating tasks, and you’ll find they’re great for building simple command line applications. The Bash shell interprets Bash scripts, so you won’t need to install any dependencies to write and run them. Bash scripts are also portable since most Unix-based operating systems use the same shell interpreter.
Knowledge of Bash scripting is a must for every developer, especially if you work with Unix-based systems.
Variables in Bash
Bash variables are case-sensitive. To declare variables, use an equals sign (=) with the name on the left and value on the right:
STATE=Washington
The value this declaration assigns to STATE is a single word. If you need spaces in your value, use quotes around it:
STATE="North Arizona"
You’ll need to use a dollar sign ($) prefix to reference variables in other variables or statements:
STATE=Washington
LOCATION="My Location is $STATE"
Printing Values in Bash
There are several ways you can print variables in Bash. You can use the echo command for basic output or the C-style printf command for string formatting.
STATE=Washington
LOCATION="My Location is $STATE"
echo $LOCATION
After declaring the STATE variable, this script defines LOCATION by referencing STATE. If then uses echo to print the final value of the LOCATION variable.
The printf keyword allows you to use formatting verbs to output data. The string formatting verbs are similar to the ones in C and Go but with limited verbs.
Verb | Functionality |
---|---|
%c | prints single characters |
%o | prints Octadecimals |
%s | prints strings, independent of casing |
%x | prints lowercase hexadecimal |
%X | prints uppercase hexadecimal |
%d | prints integers |
%e | prints scientific notion floats in lowercase |
%E | prints scientific notion floats in uppercase |
%f | prints floating point numbers |
%% | prints a single percentage symbol. |
Here’s an example of using a verb with the print keyword.
STATE=Lagos
printf "My Location is %s" $STATE
The printf function would substitute the STATE variable in the position of the %s verb, and the output would be “My Location is Lagos”.
You can make comments in Bash with the hash or pound (#) symbol. The shell automatically ignores comments.
#!/bin/bash
There are no multi-line comments. Most IDEs and text editors allow you to comment with the Ctrl/Command + forward slash(/) shortcut. You should be able to use the shortcut to create multiple single-line comments.
Receiving User Input in Bash
Like many other programming languages, you can receive user input in Bash to make your programs/scripts more interactive. You can use the read command to request the user’s input.
read response
In this case, the response variable will hold the user’s input on delivery.
echo "What do you want ?: "
read response
echo $response
The user input request will be on a new line in the example above.
You can add the -n flag to the echo print statement to retain the line where the user enters input.
echo -n "What do you want."
read response
echo $response
Declaring Arrays in Bash
Arrays in Bash are just like most languages. You can declare an array variable in Bash by specifying the elements in parentheses.
Countries=('USA' 'Russia' 'Ukraine', "England", "Taiwan", "China")
Accessing an array via reference to the variable name would fetch the first element. You can access the entire array by using the asterisk sign as the index.
echo ${Countries[*]}
You can also specify the index of the array to access a specific element. The index of an array starts at zero.
echo "${Countries[4]}"
Conditional Statements in Bash
Bash provides conditionals for decision-making in programs.
Here’s the anatomy of an if-else statement in Bash. You’ll have to use the semi-colon to specify the end of the condition.
if [[ condition ]]; then
echo statement1
elif [[condition ]]; then
echo statement2
else [[condition ]]; then
echo statement3
fi
You must end every if statement with the fi keyword.
if [ 1 == 2 ]; then
echo one
elif [ 2 == 3 ]; then
echo two
else [ 4 > 3 ];
echo "correct, 3"
fi
You can use case statements in your Bash programs using the case keyword. You’ll have to specify the pattern followed by ending parentheses before the statement.
CITY=Lagos
case $CITY in
"Washington")
echo "United States of America"
;;
"Lagos" | "Abuja")
echo "Nigeria"
;;
"Johannesburg" | "Cape Town")
echo "South Africa"
;;
*)
echo "Antarctica"
;;
esac
You can define the default case using the asterisk (*) sign as the pattern. Case statements must end with the esac keyword.
Loops in Bash
Depending on your needs, you can use a while loop, range for-loop, or a C-style for loop for recurring operations.
Here’s an example of the C style for-loop. For-loops must end with the done keyword, and you must end the for statement with a semicolon followed by the do keyword.
for ((a = 0 ; a < 10 ; a+2)); do
echo $a
done
The range for loop comes in handy for working with files and many other operations. You’ll need to use the in keyword with the range for-loop.
for i in {1..7}; do
echo $1
done
Here’s a simple infinite loop to demonstrate Bash while loops in action.
name=1
while [ 1 -le 5 ]
do
echo $name
done
The -le in the condition statement is the binary operator for less than.
Functions in Bash
You don’t need keywords to declare functions in Bash. You can declare functions with the name and then parentheses before the function’s body.
print_working_directory() {
echo $PWD
}
echo "You are in $(print_working_directory)"
Functions can return variables in Bash. All you need is the return keyword.
print_working_directory() {
return $PWD
}
The print_working_directory function returns the working directory of the file.
You Can Write Shell Scripts in Other Languages
Bash isn’t the only language you can use to interact with your operating system’s shell or build command-line applications. You can use many other languages like Go, Python, Ruby, and Rust.
Many operating systems have Python3 pre-installed, and Python is a prevalent language. If you need even more functionality than Bash scripts can offer, consider using Python.
MUO – Feed
Watch: Dude who’s wanted for murder calls cops over cold McDonalds fries, winds up tased
https://www.louderwithcrowder.com/media-library/image.png?id=30835904&width=980
Everyone one of you reading this has had a bad fast food experience. Orders are wrong. Food isn’t cooked the way you want. It looks nothing like the photo. We’ve all had these first-world problems. But we don’t get so angry we call the cops. Nor do we get so angry we forget we are wanted for murder before calling the cops. Antoine Sims was that angry, and he’s not loving it.
Not while screaming like a little girl after getting tased. After running from the cops. After realizing maybe calling them wasn’t one of his better ideas.
Dude was wanted for murder but called the cops on McDonalds serving him cold fries. Tried to run for it. Didn’t go well
I guess you could say it started as a cold case pic.twitter.com/RQlgFwsIwu
— Rosary Extremist Poso 🇺🇸 (@JackPosobiec) August 14, 2022
Antoine Sims is now in the lead for dumbest criminal of 2022. Third place is the guy who tried robbing a jewelry store in broad daylight, only he lacked the upper body strength to break glass. Second place is a man who almost got away from the cops if a traffic post didn’t get in his way. Sims just rocketed up the charts.
The details of why he was wanted are horrible. Sims and some other loser are accused of setting fire to a car with a woman’s body inside after a botched drug deal led to a gunfight. He failed to appear for a 2018 court date over it.
It all explains why Sims would call the cops over his cold french fries and then say he was afraid of the cops when they showed up. Somewhere between telling the cops, “I try the fries the fries, they’re lukewarm but they’re not hot," and yelling as a sudden jolt of electricity runs through his body, Antoine realized his tactical era.
All over french fries. Overrated french fries, too.
The Louder with Crowder Dot Com Website is on Instagram now! Follow us at @lwcnewswire and tell a friend!
Giga-Chad Traffic Pole VAPORIZES Criminal! | Louder With Crowder
youtu.be
b’Louder With Crowder’
Why don’t you start writing tests?
https://hashnode.com/utility/r?url=https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1659938824352%2FWP4qJbrxz.jpg%3Fw%3D1200%26h%3D630%26fit%3Dcrop%26crop%3Dentropy%26auto%3Dcompress%2Cformat%26format%3Dwebp%26fm%3Dpng
There are hundreds of articles on why you should write tests for your code. And I assume you have read them many times.
Many developers realize the importance of writing tests but just do not get started.
Why Not
Mainly because of some misunderstanding.
- They face the fear of doing it wrong.
- They think they’re not good enough (yet) to write tests.
- They are not sure which type of tests apply to their projects.
As someone who has been there, let me tell you these things are temporary. Once you start writing tests, all this will go away.
Why Not Today
If I were to tell you that it would take only 5-10 minutes of your time to get started with testing, would you mind starting now?
Let today be the start of something new.
Okay. So let’s kick off our testing journey with a Laravel application. You may use an existing web application or create a new one.
In fact, you can follow this article even for any other programming language/framework as we are going to discuss the high-level stuff only.
Default tests with Laravel
Laravel comes with a couple of tests out of the box. Open your terminal and type:
php artisan test
And if you haven’t messed anything up in your web app, you would be greeted with something like:
Great, we have a perfect starting point. Let’s write our own tests now.
Some web app code
If you have a fresh new Laravel web application, please append the following code to the routes/web.php
file before writing your first test.
use App\Models\User;
use Illuminate\Http\Request;
Route::post('/users', function (Request $request) {
$validated = $request->validate([
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'email', 'max:255'],
'password' => ['required', 'confirmed'],
]);
User::create($validated);
return back()->with('success', 'User created successfully.');
});
The following things are happening in this code:
- We validate the form data.
- We create the user in the database.
- We redirect the user back with a success message.
And our tests should cover all these.
Create a new test file
We’ll start by creating a new test file. Please execute the following command in your terminal:
php artisan make:test UserTest
A new test file should be created at tests/Feature/UserTest.php
.
Heads up – Resetting the database
If your code and tests play with the database, you should reset your database after each of your tests to ensure that one test cannot affect the results of another one. Laravel makes it effortless by providing a trait that you can add to your test classes.
Please add the following trait in the UserTest.php
file:
use Illuminate\Foundation\Testing\LazilyRefreshDatabase;
class UserTest extends TestCase
{
use LazilyRefreshDatabase;
With that done, let’s bake tests.
Your first test – the Happy path
The default test file already covers a test for a GET request. Thus, we can directly write a test for a POST request.
When the user submits the form from the browser, a POST request is made with the inputs and values. We are going to simulate the same thing in our tests.
Please append the following code to the UserTest.php
file:
public function test_new_user_can_be_added()
{
$response = $this->post('/users', [
'name' => 'Gaurav',
'email' => 'gauravmakhecha@gmail.com',
'password' => '123456',
'password_confirmation' => '123456',
]);
$response->assertRedirect('/')
->assertSessionHas('success', 'User created successfully.');
$this->assertDatabaseHas('users', [
'name' => 'Gaurav',
'email' => 'gauravmakhecha@gmail.com',
]);
}
Laravel provides an easy way to make a POST request from your test files using the post()
method. Using that, we make the request and verify that user details are added to the database and the response is a redirect with the proper message in the session.
Wasn’t this straightforward? Let’s try one more.
Test for the validation
How about adding a test to make sure that our validation works as expected? Please append the following code to the UserTest.php
file:
public function test_new_user_data_is_validated()
{
$response = $this->post('/users', [
'name' => '',
'email' => 'not_email_format',
'password' => '123456',
'password_confirmation' => '456789',
]);
$response->assertStatus(302)
->assertSessionHasErrors(['name', 'email', 'password']);
}
Here, we pass invalid data for the form inputs and confirm (assert) that there is a redirect response (HTTP status code 302) and that there are validation errors in the session.
Test for the unique email address
The business requirement is that the email address of each user has to be unique so let us add a test for the same. Append this test to the UserTest.php
file:
public function test_new_user_with_same_email_cannot_be_added()
{
User::factory()->create([
'email' => 'gauravmakhecha@gmail.com',
]);
$response = $this->post('/users', [
'name' => 'Gaurav',
'email' => 'gauravmakhecha@gmail.com',
'password' => '123456',
'password_confirmation' => '123456',
]);
$response->assertStatus(302)
->assertSessionDoesntHaveErrors(['name', 'password'])
->assertSessionHasErrors(['email']);
}
This test uses Laravel Factory to add a user to the database and then tries to make a POST request with the same email address. Let us run tests and see the results.
Oops, it failed. And the reason? We missed adding the unique validation in our code.
The Fix
Now your test is guiding you with the development. (Yes TDD!)
Please make the following update in the routes/web.php
file:
- 'email' => ['required', 'email', 'max:255'],
+ 'email' => ['required', 'email', 'max:255', 'unique:users'],
Once updated, give yourself a pat on the back and run the tests again (php artisan test
)
What more?
Did you realize you are now officially a developer who writes automated tests? Congrats!
Need more examples? Check this directory from the official Laravel repository for tests related to various modules.
The goal of this article is just to get you started with writing tests. Not to cover different use cases or scenarios. Hence, I limit the practical coding here and would like to share a few other things to help you progress with it.
Patterns that can help you
Many developers aren’t sure for which parts of their code should they write tests. The simplest answer is: Try to write automated tests for all the functionality that you check while manually testing your web app.
In this example, we would have checked the DB entry, the validation messages, and the redirect while manually testing the web app. And that is what our automated tests covered.
Here are a couple of patterns to help you plan your tests:
1. Given-When-Then
2. Arrange-Act-Assert
Both are similar so you can use any of them. The idea is:
- First, you set the scene (Add existing DB records, log in a user, etc.)
- Then you take an action (Visit a URL, submit a form, etc.)
- Finally, you verify the results/effects (A DB entry, a session call, response status code, etc.)
This way can generally help you in writing most of the test cases.
Moreover, we have a dedicated article about writing tests only for your code to guide you around the test boundaries.
(Not so) Complex Stuff
What we covered in this article are Feature tests. There are many other types of tests (Unit tests, Feature tests, Integration tests, Acceptance tests, etc.).
Do not hurry to learn/use all of them, you don’t have to. You will feel the need yourself if/when the time arrives.
Topics like mocking and stubbing fall in the same category. Believe me, it is not compulsory to use them. But keep in mind they are quite handy for medium to big-size projects. We use them in our projects and can’t live without them.
A Note on PEST
We use PEST for writing tests but I decided not to include that in this article to keep things simple. I wish (and am sure) it would come out of the box with Laravel.
To The Moon
I hope this article gets you started with writing tests and you never stop in the future. Feel free to comment below in case of any questions. May those tools give you more testing features 😉
And if any of your friends are also giving excuses to start writing tests, how about sharing this article with them for the push?
Cheers and regards.
Laravel News Links
Tulsi Gabbard filled in for Tucker Carlson Friday night and UNLEASHED on the FBI and DOJ for the Mar-a-Lago raid
https://media.notthebee.com/articles/62f7dcb09eee362f7dcb09eee4.jpg
This is a must-watch video.
Not the Bee
New Scorpion-X Pistol from Volquartsen Firearms
https://www.thefirearmblog.com/blog/wp-content/uploads/2022/08/ziM24NZg-180×180.jpeg
Volquartsen Firearms is very well known in the rimfire market for their high-quality, accurate pistols often used for varmint hunting or competition shooting. Volquartsen has just announced the addition of the new Scorpion-X to their line of complete pistols. The new Scorpion-X uses the all-new Volquartsen LLV-X upper which features multiple mounting hole locations so […]
The post New Scorpion-X Pistol from Volquartsen Firearms appeared first on The Firearm Blog.
The Firearm Blog