What Is Tubi? The Best Free Streaming Service You’re Not Using

https://static1.makeuseofimages.com/wordpress/wp-content/uploads/2021/04/tubi-free-streaming-service-logo.jpg

When it comes to binge-watching movies or shows, most of us are content to log on to Netflix and work our way through an entire series. Well, there’s another streaming service you should check out—Tubi.

But what exactly is Tubi TV? In short, it’s a streaming service that offers thousands of movies and TV shows—all for free. With a library that includes everything from cult classics to recent Hollywood hits, Tubi TV has quickly become a must-have for anyone looking to stream content for free.

MAKEUSEOF VIDEO OF THE DAYSCROLL TO CONTINUE WITH CONTENT

But how does it work? And what makes Tubi TV stand out? Let’s find out.

What Is Tubi TV?

Tubi is a free streaming service owned by Fox Corporation. It has over 20,000 HD movies and TV shows. Not only this, but it’s also available on every major smart TV platform and all the popular streaming devices.

It features content from major studios, including MGM, Paramount, Lionsgate, as well as independent filmmakers. While it may not have the same buzz or extensive library as its competitors, it’s a great option for those looking for free streaming content.

To get started, you’ll need to sign up for Tubi with your email address or Google account. Next, you can create a watch list of your favorite movies, docuseries, TV shows, and more. You can access the service across Android and iOS devices, desktops, gaming consoles, and on the web as well.

Download: Tubi TV for Android | iOS | Web (Free)

What Content Can You Watch on Tubi TV?

From timeless classics to the latest releases, Tubi TV offers a diverse array of content. From anime series to TV shows to docuseries, it has an extensive library to cater to a variety of user preferences. It’s chock-full of age-appropriate entertainment available to keep kids engaged and entertained.

If you’re into action flicks or crime dramas, comedy or sci-fi flicks—you name it—you can find it on the site. It offers a vast collection of movies spanning various genres, including action, comedy, drama, horror, romance, and so on.

The content itself comes under several categories, including “Cult Classics,” “Award Winners and Nominees,” “Pre-School,” “Kids Shows,” “Highly Rated on Rotten Tomatoes,” and more.

How to Set Up and Use Tubi TV

To get started with Tubi, you’ll need to register for an account. Once you’ve signed in, open the app and hit Browse to bring up the main menu with the list of available titles, sub-categories, or channels.

With an interface similar to that of Netflix, each movie expands into its own viewer. This gives you more information about the film, including reviews, cast, and more. When you find one that interests you, just click it and start watching.

If you have a Roku streaming device or video game console like an Xbox One, just search for the native Tubi TV app using your device’s built-in search function.

In case you haven’t already, you’ll be prompted to create an account with your email address and password before browsing through available channels. You can always access Tubi TV on your web browser as well.

Since Tubi is supported in limited regions, such as the US, Canada, Mexico, Australia, and New Zealand, you can connect to a VPN and connect to US servers to view its content. We recommend checking out these privacy-friendly free VPNs to access geo-restricted content.

If you’re a parent, you can use the Parental controls feature to control what your children can watch on the app. It also allows you to edit how your subtitles appear, so you can customize the caption fonts and sizes to your liking.

Tubi is a tad different from other popular streaming services such as Netflix and Amazon Prime. First off, these services charge a hefty subscription fee for access to content, while Tubi is completely free.

Moreover, Tubi’s selection of titles is unique in that it focuses on providing obscure movies and foreign films that you may not have heard of or seen before.

Thirdly, Tubi TV is widely available across a range of devices, including Roku, Android TV, Amazon Fire TV Stick, Xbox One, Xbox Series S, Xbox Series X, smart TVs, Chromecast, Amazon Echo Show, Google Nest Hub, Blu-ray players, and HiSense TVs. This allows you to watch your favorite content from anywhere as long as you have an internet connection.

Tubi TV: Get a Huge and Free Collection of Movie Titles

While there are plenty of other sites that offer free content, Tubi TV is quickly rising through the ranks as one of the top-rated sites in this space.

Regardless of your streaming preferences, you should keep Tubi at the top of your list. Yes, it has advertising, but unlike other free providers who interrupt programming with ads, Tubi TV can offer content with minimal interruptions and fewer ad loads, which can truly improve your entertainment experience.

MakeUseOf

Let’s build a ChatGPT Plugin with Laravel

https://barreto.jp/assets/images/chatgpt-plugin-with-laravel/7-local-plugin-ip.png

Starting last week (May 12), OpenAI rolled out the plugins for ChatGPT plus users. This means that we can not only use the plugins from their store but also create our own plugins.

In this article, we will go through the process of creating a plugin for ChatGPT using Laravel.
The plugin will be a very simple web browser that will fetch the HTML content of a given URL, but this concept can be applied to any other use case.

Why a browser? Because it’s a simple example.

TL;DR: The code is available at github.com/juampi92/chatgpt-plugin-in-laravel.

Step 0 – Setup

Start by creating a new laravel project

composer create-project laravel/laravel chatgpt-browse-plugin
composer require guzzlehttp/guzzle

We will need the guzzlehttp/guzzle package to make HTTP requests using the Laravel HTTP Client.

Step 1 – Plugin configuration

ChatGPT requires us to have a plugin manifesto. This file is a JSON file that contains information about the plugin, such as the name, description, logo, etc.
We will need to locate it in the following URL localhost:8000/.well-known/ai-plugin.json.

For reasons that will be explained later, we will create the file inside resources/ instead of public.

mkdir resources/.well-known
touch resources/.well-known/ai-plugin.json
{
    "schema_version": "v1",
    "name_for_human": "My Local Web Browser Plugin",
    "name_for_model": "MyLocalWebBrowser",
    "description_for_human": "Plugin for browsing the web locally in the name of ChatGPT.",
    "description_for_model": "Plugin for browsing websites locally and getting their content.",
    "auth": {
        "type": "none"
    },
    "api": {
        "type": "openapi",
        "url": "http://localhost:8000/openapi.yaml",
        "is_user_authenticated": false
    },
    "logo_url": "http://localhost:8000/logo.png",
    "contact_email": "support@example.com",
    "legal_info_url": "http://www.example.com/legal"
}

Notes:

  • If you decide to use a different port, make sure to update the url fields (api.url and logo_url).
  • Also, if you decide to use a different name, make sure name_for_model doesn’t have any spaces.

To make the file available to the public, we need to do two things:

  1. Update the routes in routes/web.php:
Route::get('.well-known/ai-plugin.json', fn () =>
    File::get(resource_path('.well-known/ai-plugin.json')));
  1. Update config/cors.php to have 'paths' => ['*'],.

The reason why we can’t use the /public directory is because
the plugin will be hosted on a different domain and the browser
will block the request due to CORS.
If you intend to host the plugin on a server, you can use
the /public directory and configure apache/nginx to allow
CORS on static files.

Step 2 – Making it browse

Now we need to create the API that will be used by ChatGPT to browse the web.

Let’s create a new controller:

php artisan make:controller BrowseController

And the content of the controller should look something like this:

use Illuminate\Support\Facades\Http;

public function __invoke(Request $request): JsonResponse
{
    ['url' => $url] = $request->validate([
        'url' => 'required|url',
    ]);

    $response = Http::withHeaders([
            'User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36',
        ])
            ->get($url);

    return new JsonResponse([
        'response' => $response->body(),
    ]);
}

Add the controller to routes/api.php:

Route::get('/browse', BrowseController::class);

Step 3 – API Documentation

In order for ChatGPT to understand how to use our plugin,
we need to generate an OpenAPI specification.
GPT will read the specification and decide when and how to use your endpoints,
so it’s important that the API is clear.

To generate the actual yaml file, we will use the zircote/swagger-php package.

composer require zircote/swagger-php --dev

Now we need to update the Controller using the OpenApi Annotations:

/**
 * @OA\Info(title="MyLocalWebBrowserAPI", version="0.1")
 */
class BrowseController extends Controller
{
    /**
     * @OA\Get(
     *     path="/api/browse",
     *     summary="Get HTML content of an URL",
     *     @OA\Parameter(
     *         name="url",
     *         in="query",
     *         description="URL to fetch the HTML from",
     *         required=true,
     *         @OA\Schema(
     *             type="string",
     *             example="http://example.com"
     *         )
     *     ),
     *     @OA\Response(
     *         response=200,
     *         description="HTML content of the URL",
     *         @OA\JsonContent(
     *            type="object",
     *            required={"response"},
     *            @OA\Property(
     *              property="response",
     *              type="string",
     *              description="Raw HTML content of the URL"
     *           )
     *         )
     *     )
     * )
     */

To generate our OpenAPI specification, we run the following:

./vendor/bin/openapi app -o resources/openapi.yaml

And, for the same reasons mentioned before, add
the following route to routes/web.php:

Route::get('openapi.yaml', fn () =>
    File::get(resource_path('openapi.yaml')));

Step 4 – Serving

To run our plugin, simply call

php artisan serve --port=8000

Step 5 – Installing the plugin

Now that we have our plugin ready, we need to install it in ChatGPT.
When creating a new GPT-4 chat, you can click on the “Plugins” button and then go to the Plugin store.

GPT-4

From there, we go to the Plugin Store, and at the bottom, we click on Develop your own plugin.

Plugin Store

Here we are presented with a form to fill in the domain of our plugin. We input localhost:8000 (if you changed the port, make sure to use the correct one).

Enter Website Domain

If everything went well, you will see the following screen:

Found Plugin

New Plugin Selected

Step 6 – Using the plugin

Now that we have our plugin installed, we can use it in our chat.

ChatGPT will decide when to use your plugin depending on your description and OpenAPI specification,
so in the case of our browser plugin, simply giving a URL will do.

You might be wondering: why not just use WebPilot, the plugin that comes with ChatGPT?

The truth is that you can use WebPilot. The only difference is that
WebPilot uses a hosted server to browse. A server that can be rate-limited by websites, and you can’t customize.

This is an example using WebPilot:
WebPilot IP

And here is with our plugin:

WebPilot IP

Conclusion

In this simple article, we saw how to create a plugin for ChatGPT using Laravel.

If you would like to see the whole code, you can find it here: juampi92/chatgpt-plugin-in-laravel. I added a few more features, like transforming the content into markdown, so there is less content to send to ChatGPT, and so hitting the characters limit less often.

Laravel News Links

DOD Recommends Private Gun Registration, Centralized Storage & Min Age-to-Buy On Bases

https://www.ammoland.com/wp-content/uploads/2019/11/USA-flag-wooden-door-locked-padlock-border-wall-immigration-iStock-fermate-641331942-500×294.jpg

USA flag wooden door locked padlock border wall immigration IMG iStock/fermate 641331942
iStock/fermate 641331942

USA –

“Finding ‘common ground’ with the thinking of evil men is a fool’s errand” ~ Herschel Smith

As we witness our Armed Forces recruitment efforts repeatedly falling drastically short of even minimum maintenance goals, DOD in its infinite wisdom, now cynically manufactures yet another significant reason for young Americans not to enlist!

Under the laughable pretext of “lethal-means reduction,” a new DOD report, “Preventing Suicide in the U.S. Military: Recommendations from the Suicide Prevention and Response Independent Review Committee” [embedded below], consists of a demand for active-duty troops to “register” all privately-owned guns, even those troopers who are in possession of valid, state-issued CCW permits.

This will, of course, immediately bring about a demand on the part of “woke” base commanders that all privately-owned guns (now “registered”) be subsequently removed from homes (on-base or off) of troopers, including officers and NCOs, and locked-up “for safe-keeping” within a base armory.

Of course, rightful owners will never see their guns again!

Another part of this impending new policy is that “twenty-five” is to become the new minimum age for any Soldier, Sailor, Airman, or Marine to privately own any kind of gun, again, even when the trooper already has a valid CCW permit!

So, we put into the hands of eighteen-year-olds automatic weapons that we don’t teach them to use (because they’re all too busy attending “transgender sensitivity” classes), and then prohibit them from obtaining, nor training with, their own weapons.

Even when troopers reach the age of twenty-five (in the unlikely event they’re still around), guns that they do privately own they can’t keep with them, as all guns must be locked-up and under the control of the base commander.

At this rate, few you recruits will be joining up. Fewer still will re-enlist.

It makes one wonder whom DOD is really working for!

“Where there is trust, no proof is necessary. Where there is none, no proof is possible.”

/John

Preventing Suicide in the U.S. Military: Recommendations from the Suicide Prevention and Response Independe..


About John Farnam & Defense Training International, Inc

As a defensive weapons and tactics instructor, John Farnam will urge you, based on your beliefs, to make up your mind about what you would do when faced with an imminent lethal threat. You should, of course, also decide what preparations you should make in advance if any. Defense Training International wants to ensure that its students fully understand the physical, legal, psychological, and societal consequences of their actions or in-actions.

It is our duty to make you aware of certain unpleasant physical realities intrinsic to Planet Earth. Mr. Farnam is happy to be your counselor and advisor. Visit: www.defense-training.com

John Farnam
John Farnam

AmmoLand Shooting Sports News

Shred It: Shooting Paper Targets Provides Important Feedback

https://cdn.athlonoutdoors.com/wp-content/uploads/sites/6/2023/05/shooting-targets-03.jpg

All of us have met people at shooting ranges, gun shops or gun shows who love to give advice about the best handgun, cartridge or ammo. But have you ever seen anyone extolling the virtues of “the best” paper targets for shooting? I can count the times I have on one hand in the 60-plus years that I’ve been shooting.

Are Paper Targets an Important Aspect in Shooting?

The simple fact is that except for matches that require specific paper targets like IDPA and bullseye, targets are usually considered to be the least important aspect of shooting if they’re considered at all.

Most of us just focus on placing our shots into small groups no matter what the target looks like? This kind of thinking led to the development of “Center Mass” silhouette targets. Unfortunately, the center of mass in the human body is just above the spleen.

A wound in this area is serious and might eventually be fatal. But it’s not the most likely hit to cause rapid incapacitation. Therefore, target practice and tactical training are not at all about putting every shot in the middle of the target. They’re about putting shots where they will be the most effective.

Getting Started

There’s a process for learning how to do this. And it doesn’t exclude using bullseye targets and other targets that have scoring rings as first steps. After all, the good old bullseye is very useful for sighting in a new gun and building basic skills.

All new shooters need to build competence, and targets that have scoring rings or zones provide an important way of tracking a new shooter’s progress toward acquiring essential shooting skills like sight picture, grip, and trigger press.

The B-27 target used to be a popular police training and qualification target. But its 10 and X-rings are too low to indicate the best shot placement for quick incapacitation.

As the new shooter develops higher scores, self-confidence increases. This is critically important for using handguns for both self-defense and hunting.

This first stage in building competency with firearms begins with the shooter standing 5 to 7 yards from the target. As the trainee progresses, then he or she can move farther back. At the same time, it’s possible to see how well the shots are grouping.

If the center of the groups are consistently different than the trainee’s point of aim, a “correction” target like Thompson Targets’ “Group Shooter” can be very effective. It will immediately indicate any problems in aim, grip, or trigger press so that appropriate corrections can be made.

Targets like the Thompson Group Shooter help improve shooting accuracy.

Once the shooter displays competence at the distance he or she believes he or she will be shooting, it’s time for handgun hunters and tactical shooters to move on to targets that impart more specific skills.

Targets with Multiple Aiming Points

One example is the targets that have multiple aiming points, like the IQ target from RE Factor Tactical. These help shooters see the whole target rather than just focus on the center.

The IQ target has squares, triangles, and circles randomly numbered from 1-3 or randomly labeled A, B, or C. In addition, the squares, triangles, and circles are randomly colored blue, green, yellow, red, or white. There is no pattern to how the individual shapes, colors, letters, or numbers are displayed on the target. This makes the level of difficulty even higher.

I begin shooting this target with my eyes closed and the gun at low ready pointed at the berm, and my trigger finger in the register position off of the trigger. Then I simply say to myself, “Shoot all triangles,” or “Shoot the green number 3 targets,” etc. At the start signal from my Competition Electronics shot timer, I open my eyes and engage the target.

The author incorporates IQ targets in his shooting practice.

It’s not as easy as you might think. As an aside, nationally recognized trainer John Holschen has used this type of target to successfully train shooters to hit moving targets. One word of caution, however, be sure to ask the Rangemaster if the range you’re using is designed for the use of targets with multiple aiming points.

Tactical Targets

When training for self-defense, the targets available today allow for a three-step approach. Step one is a silhouette target with scoring areas that have different values and different colors. This makes it easy to identify where shots need to be placed to produce a high likelihood of incapacitation.

Once again, it’s best to start closer to the target and gradually move back to get an idea of the trajectory of the ammunition you’re using. Especially when shooting a large format pistol like those based on AR, AK and sub-machinegun platforms. These often have a 3-inch offset between the line of sight and the line of the bore.

Photographic Targets

After becoming familiar with shooting silhouettes, the shooter can progress to photographic targets. There are two types. The first has lightly drawn scoring zones, and the second has no scoring zones whatsoever.

Given that I’ve had quite a bit of training, I prefer to shoot those that do not have any scoring zones. This requires me to visualize and rely on anatomical landmarks to locate the vital zones.

Photographic targets open a whole new level of skills development. They normally have at least one armed individual presenting a threat. But these targets can get quite a bit more complicated and difficult to shoot.

The assailant in the target can be in a bladed stance or may be partially obscured by cover or concealment. So, you need to visualize very carefully. The armed offender may have an armed partner. So, which one do you shoot first? The guy with the shotgun or the one with the pistol who is closer to you?

This target waiting in ambush was repeatedly defeated as the author practiced precision shooting.

Or how about the would-be assassin who has his finger on the trigger and a gun pointed at an innocent party? In addition, what if there is a no-shoot target who is partially obscuring the armed offender? Then there’s the target that depicts an armed assailant who’s partially behind cover.

And there are a variety of targets depicting situations that cause the person shooting in self-defense to exercise good judgment. Furthermore, if the trainee has access to action bays with side berms like those at the Flagler Gun Club, you can use movable target frames and stackable plastic barrels to combine multiple targets and obstructions, creating complex tactical problems to resolve.

Use a shot timer to create a sense of urgency. It’s about as close as you can get to force-on-force training by using paper targets.

Hunt/Survive Targets

Those who hunt for recreation and for subsistence/survival purposes have a wide variety of targets for building their competence in taking North American big and small game.

There aren’t as many articles today about hunting and long-distance shooting with handguns as there were when Bob Milek, Steve Herrett and Elmer Keith were alive. However, handgun hunting articles and columns do appear in some gun magazines. And there are still a number of handgunners who hunt with their handguns and shoot in metallic silhouette matches.

In addition, there are hunters and hikers like myself who have regularly carried large bore or magnum handguns loaded with deep penetrating ammo and/or snake loads when out and about in the woods, swamps, and deserts.

My one complaint about targets depicting game animals is that many of these paper targets have either scoring zones or aim points printed on the front. I would prefer that they have scoring zones printed on the back of the target. Because animals encountered while hunting rarely offer broadside shots.

The deer target from Thompson Targets and varmint target from Birchwood Casey teaches novice hunters to learn where the quick incapacitation “ball” lies in a game animal.

Visualizing Vitals

Because of this, while practicing on game targets, it’s important to develop skills in visualizing where the vitals are from various angles. One of the best ways I’ve seen is the “ball” method.

Imagine the vital areas as a ball that rests just inside the chest cavity. Make sure that the size of the ball is appropriate to the size of the game you’re hunting. And then fire your shot so that it passes through the center of the ball. If you hunt reptiles, on the other hand, the ball is often very small and is located just behind the eyes.

Another method used when hunting four-legged mammals is to aim for the shoulder that is farthest from you. Usually, a shot for the far shoulder passes through at least part of the vitals ball. Then it moves on to limit the animal’s mobility. This is especially good for quartering shots taken by hunters using hard-cast semi-wadcutter or other bullets that penetrate deeply.

Regardless of the type of bullet chosen, the hunter should eventually use a target without scoring zones on its front. Because it forces the hunter to use anatomical landmarks as aiming points. As much as we might wish, there are no X-rings on game animals.

Respect The Paper

Targets are so much more than something you punch holes in. They’re valuable educational tools for maintaining perishable shooting skills, sharpening those skills, and developing new ones.

Given today’s rate of inflation, a lot of us won’t have the disposable income to acquire 500-1,000 rounds of ammo and pay up to $2,000 for travel and fees to attend shooting schools on a regular basis.

However, by properly using paper targets that depict hunting or tactical scenarios, we can do much to affordably preserve the skills we may have learned from professional trainers. Likewise, we can develop further skills in solving the types of potential threat scenarios that may exist in the communities where we work and reside.

For more information, please visit ActionTarget.com, BirchwoodCasey.com, ChampionTarget.com, RefactorTactical.com, and ThompsonTarget.com.

This article was originally published in the Combat Handguns July/August 2022 issue. Subscription is available in print and digital editions at OutdoorGroupStore.com. Or call 1-800-284-5668, or email subscriptions@athlonmediagroup.com.

Didn’t find what you were looking for?

The post Shred It: Shooting Paper Targets Provides Important Feedback appeared first on Personal Defense World.

Personal Defense World

Bungie revives ‘Marathon’ as a multiplayer shooter

http://img.youtube.com/vi/6y-e2krA3uE/0.jpg

What do you think Bungie would do for its first non-Destiny game in over a decade? A return to the franchise that helped make it a gaming giant, of course. The developer has unveiledMarathon, a follow-up to the classic first-person shooter series for Macs. This isn’t a sequel or remake, mind you. Instead, it’s a multiplayer "extraction shooter" that has mercenary Runners exploring a lost colony.

While there’s no single-player component, game director Chris Barrett says this will still "feel" like a Bungie game between the mechanics and rich universe. Player actions will also influence the plot — you might find an artifact that unlocks an area for all players. There are persistent zones and seasons, although we wouldn’t expect a repeat of similar elements in Destiny.

Marathon is in development for PC, PS5 and Xbox Series X/S. While there isn’t much more to share at this point, Bungie says the next update will be "much closer to launch" and include gameplay. It’s safe to say there’s a lot riding on this title. It’s proof that Bungie isn’t content to iterate on Destiny forever, and will show what the company can do with a multiplayer-only experience. And for old-time fans, this is a chance to return to a beloved franchise 27 years later.

This article originally appeared on Engadget at https://www.engadget.com/bungie-revives-marathon-as-a-multiplayer-shooter-212630605.html?src=rssEngadget

Laravel 10 Eloquent Mutators and Accessors

https://coderadvise.com/wp-content/uploads/2023/05/Laravel-10-Eloquent-Mutators-and-Accessors.jpg

Laravel 10 Eloquent Mutators and Accessors

The mutator modifies the value before inserting it into the database, while the accessor modifies the value after fetching it from the database. Mutator and accessor can be defined in the same method.

Let’s suppose, the customer’s name should be stored in lowercase and displayed in Pascal case (with space) even if the customer puts a name with capitalized letters. To do that, we will need to use a mutator and accessor in the Model. The mutator will be converting the customer name into lowercase before inserting it in the database and the accessor will be converting it into Pascal case before displaying it.

You can define a mutator and accessor in the Model file in the app/Models directory. We added two additional columns first_name and last_name into the users table through migration. By default, Laravel creates a name column in the users table.

Mutator

The Mutator allows you to modify the value before inserting it into the database. For example, if you want, the first and last should always be stored in lowercase in the database then mutator is the best way to do it.

Define Mutator:

To define a mutator it is necessary to create a method using the column’s name written in the camel case. Let’s take an example: if the column name is first_name then the method name should be firstName().

In the earlier versions of Laravel, it is required to add a set at the beginning of the method and an attribute keyword at the end of the method. But in Laravel versions 9 and 10 it is no longer required.

Let’s create a mutator for the first_name column in the User model class from app/Models directory.

Before adding the above mutator method in the model class make sure the Attribute class is imported. You can import the attribute class through the below namespace

use Illuminate\Database\Eloquent\Casts\Attribute;

protected function firstName(): Attribute
{
    return Attribute::make(
        set: fn (string $value) => strtolower($value),
    );
}

The above mutator method will be converting the value of the first_name column into lowercase before inserting it into the database.

In this method, we used the make() method of the Attribute class that takes two optional parameters get and set. We passed a callback function to the set parameter that takes a string and converts it into lowercase through PHP built-in function strtolower().

Now look at the below profile update form where the first name is in capitalized letters that should be inserted in the lowercase through the mutator.

Let’s check the inserted row in the database.

In the above screenshot of the users table the first_name value is inserted in lowercase.

Accessor

The accessor allows you to modify the value before being accessed. To define an accessor, similar to a mutator, it is essential to create a method using the column’s name in the camelcase.

Define Accessor:

Let’s create an accessor for the first_name column that should capitalize the first letter of each word.

protected function firstName(): Attribute
{
    return Attribute::make(
        get: fn (string $value) => ucwords($value),
    );
}

In the above accessor method, we used the make() method from the attribute class in which we passed a callback function to the get parameter. The callback function takes the value and converts capitalize the first letter of each word through the PHP built-in function ucwords().

To check if the accessor is working, we can print the first_name column’s value in the controller.

echo $request->user()->first_name;
// Output: Emily

As you can see the first_name value “Emily” is stored in the lowercase through the mutator, but in the controller accessor capitalized the first letter.

Accessor and mutator can be defined in the same method. Look at the below method in which we defined the accessor and mutator together.

protected function firstName(): Attribute
{
    return Attribute::make(
        get: fn (string $value) => ucwords($value),
        set: fn (string $value) => strtolower($value),
    );
}

Related Posts

Laravel News Links

Making $65 per Hour on Upwork with Pandas

https://blog.finxter.com/wp-content/plugins/wp-youtube-lyte/lyteCache.php?origThumbUrl=https%3A%2F%2Fi.ytimg.com%2Fvi%2FPJcJGWP8WH4%2F0.jpg

4/5 – (1 vote)

Pandas, an open-source data analysis and manipulation library for Python, is a tool of choice for many professionals in data science. Its advanced features and capabilities enable users to manipulate, analyze, and visualize data efficiently.

????‍???? Recommended: 10 Minutes to Pandas (in 5 Minutes)

YouTube Video

In the above video “Making $65 per Hour on Upwork with Pandas” ????, the highlighted strategy is centered on mastering this versatile tool and effectively communicating its benefits to potential clients. A key fact to remember is that Pandas is highly valued in various industries, including finance, retail, healthcare, and technology, where data is abundant and insights are critical.

For a freelancer, proficiency in Pandas can command an hourly rate of $65 or more, even if it’s just a side business to add an additional and independent income stream.

But it’s not just about the tool; it’s about showcasing your ability to drive business value.

???? Recommended: Python Freelancer Course – How to Create a Thriving Coding Business Online

Highlighting case studies where you’ve used Pandas to extract meaningful insights or solve complex business problems can significantly boost your profile’s appeal.

As for project bidding, understanding the client‘s requirements and tailoring your proposal to highlight how your Pandas expertise can meet those needs is vital. Negotiation, too, plays a critical role in securing a lucrative rate.

Mastering Pandas and marketing this skill effectively can unlock high-paying opportunities on platforms like Upwork, as demonstrated by the impressive $65 per hour rate (for a freelancer with very little practical experience). This reinforces the importance of specialized skills in enhancing your freelancing career.

???? Recommended: What’s the Average Python Developer Salary in the US? Six Figures!

Be on the Right Side of Change

Use This ‘Tears of the Kingdom’ Inventory Glitch for Unlimited Items

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/38be1fcd35f47d0fde3d749153567df9.jpg

The Legend of Zelda: Tears of the Kingdom features a lot of items. It carries over staples from Breath of the Wild like food and monster parts, and adds plenty of new options from bomb flowers to Zonai devices. You really can’t have enough items in this game, which makes this item duplication glitch so useful.

The glitch, as outlined by IGN, isn’t necessarily hard to pull off, but it does require precision. My advice is to read through the instructions first, then give it a shot. If you don’t get it right away, be patient and give it another go.

How to glitch your way to unlimited items in Tears of the Kingdom

To start, make sure you have a bow equipped. Draw your arrow by tapping R2, then attach the item you’re looking to duplicate by holding the up button. Personally, I’m not going to choose any brightbloom seeds because I have so many, but I could use more bomb flowers, so I went with that.

With your item equipped, wait a beat, press +, then head over to the Bows and Arrows section of the menu. Select the bow you have equipped, then Drop it. Without leaving the menu, equip a new bow, then press + two times as quickly as possible. You want to make it back to the menu without the bow falling to the ground. Now, drop the newly equipped bow, and finally exit the menu for good.

If done correctly, the two bows should be stacked on top of each other. Pick them both up, then check your items. You should have one extra item than you started with.

IGN details two other item duplication efforts—one for duplicating equipment in your inventory and another for copying equipment you haven’t come across before. But these methods are more complicated, and actually risk losing items in the process. For safe item duplication, stick to the first glitch.

There were fears that this glitch would be patched in the latest update, version 1.1.1., but that doesn’t appear to be the case. Even after installing the update, the game still lets you copy your items, which means Nintendo is either unaware of the glitch or feels it low priority enough not to fix yet. Hopefully they never fix it and allows the fun glitch to be among the very few bugs in a remarkably polished game.

Lifehacker

Family hit with $3,100 App Store bill after kid goes on Roblox spending spree

https://photos5.appleinsider.com/gallery/54528-110174-53631-107774-Roblox-xl-xl.jpg

Roblox in the App Store


A 10-year-old child spent over $3000 on Roblox via the family iPad, charges applied after the child changed the account password.

Stories of excessive spending in a game by a child regularly surface, with parents complaining about the seemingly unjust charges. In the latest iteration, a 10-year-old managed to run up a bill of more than 2,500 pounds ($3,115) on the game Roblox, without her mother’s knowledge.

Georgina Munday of Dyserth, Denbighshire, UK, had allowed her autistic daughter to play on an iPad for long periods, due to struggling in school, reports BBC News. Soon after, she started to see the transactions, and initially believed that the account had been hacked.

“We’d just seen hundreds of transactions, these payment confirmations, so then the panic set in – oh my gosh, whose card is this on?” the mother told the report.

Munday spent a week going between Tesco Bank and Apple to try and get a refund, but both sides refused.

“I rang up Tesco Bank and they said, because it was my daughter, they couldn’t do anything about it,” Minday said. “So I tried Apple again – they just read me their terms and conditions.”

After contacting the BBC, Tesco Bank said she would receive a refund. The bank said there was a “further review” of the case that prompted the refund, and added an additional payment as a gesture of goodwill on top of an apology.

In responding to the story, Apple reiterated previous advice that accounts can have alerts set up so parents could be warned before a purchase could be made. Also, they said that parents should not disclose passwords, avoid adding their child to Face ID and Touch ID, enable Ask to Buy, and to use Screen Time.

Roblox said it “has a robust policy for processing refund requests where there may have been unauthorized payments from a person’s account.” Parents also have access to parental controls that can limit spending and to issue spend notifications for “increased visibility.

Munday is not keen on allowing her daughter to play the game in future, but admitted while she knew what she was doing in changing the password, “I don’t think she understood the enormity of it.” The mother asked parents to “be vigilant” and to take note of what children do on their devices.

AppleInsider News

How to Build a Microservice in Python

https://static1.makeuseofimages.com/wordpress/wp-content/uploads/2023/01/add-video-player-in-react-js.jpg

Software design is an essential phase in software development. The design approach can affect the entire project and how you handle different requirements.

Developers have often used a monolithic architecture, bundling up all the software components into a single module. However, this approach can prove inefficient, particularly for larger applications.

MAKEUSEOF VIDEO OF THE DAYSCROLL TO CONTINUE WITH CONTENT

Microservices aim to address these limitations. A microservice is a small, modular application that performs specific functions. Unlike monolithic applications, microservices allow for independent deployment and scaling. As a result, they are more flexible and easier to maintain.

The Microservice Architecture

The microservice architecture is a software design approach that breaks down a large application into independent services, with each service designed to address a specific business requirement.

These services run on dedicated resources, including separate database instances and computing power. Unlike monolithic systems, microservice applications are loosely coupled allowing for greater flexibility.

In a distributed system, server nodes deploy and execute microservice applications as separate processes—communicating with each other using communication protocols such as HTTP or via message brokers like RabbitMQ.

Essentially, this architectural approach enables the services to maintain their independence from one another while effectively operating within the software system.

In this tutorial, we’ll guide you through implementing a simple user microservice that manages user data using Flask and PostgreSQL

Set Up a PostgreSQL Database

To get started, install PostgreSQL. If you don’t have PostgreSQL installed, you can find out how to install PostgreSQL on Windows or how to install PostgreSQL on macOS.

Alternatively, you can configure a remote PostgreSQL database instance.

This guide will use Render’s free tier to set up a PostgreSQL database. Follow these to spin up a PostgreSQL database instance on Render:

  1. Head over to Render’s website, sign up for an account, and log in to your dashboard page.
  2. On your dashboard page, from the list of services displayed, select the PostgreSQL service.
  3. On the database settings page, fill in the required details and make sure to select the free tier, and finally click Create database.

Create a Flask Microservice

  1. In your terminal, make a new directory and change into it:
     mkdir flask-microservice
    cd flask-microservice
  2. Next, install virtualenv, to create an isolated virtual development environment.
     pip install virtualenv 
  3. Create a virtual environment in your project:
     virtualenv venv 
  4. Finally, activate the virtual environment.
     # Windows: 
    .\venv\Scripts\activate
    # Unix or MacOS:
    source venv/bin/activate

Install the Required Packages

  1. Create a new requirements.txt file in the root directory and add these packages:
     flask
    psycopg2-binary
    sqlalchemy
  2. Next, install the packages.
     pip install -r requirements.txt 

Create a Flask Server

In the root directory, create a new file: service.py, and the following code:

  1. Make the following imports:
     from flask import Flask, request, jsonify
    from sqlalchemy import create_engine, Column, Integer, String
    from sqlalchemy.orm import sessionmaker
    from sqlalchemy.ext.declarative import declarative_base
    import psycopg2
  2. Create the Flask instance and configure the database connection.
     app = Flask(__name__)

    engine = create_engine("postgresql+psycopg2://flask_service_fe0v_user:4785MhjfkdjfhjfjyUx67O2Nuzjchb2MQIP@dpg-chffjfjdkgfk54d6mb7860-a.oregon-postgres.render.com/flask_service_fe0v")

    Copy the external database URL on Render’s database settings page. We’ll use the SQLAlchemy create_engine method and Psycopg2 to configure the database connection. Make sure to update and replace the database URL in the above code with the URL of your own PostgreSQL instance that matches the format specified above. If the URL format is incorrect, the code will throw an error.

  3. Create an SQLAlchemy model for the database.
     Base = declarative_base()
    class User(Base):
        __tablename__ = 'users'
        id = Column(Integer, primary_key=True)
        name = Column(String(50))
    Base.metadata.create_all(engine)
    print("Table 'users' created successfully.")
    Session = sessionmaker(engine)

    The code defines a data model for the users’ table. After defining the model, it creates the table using the SQLAlchemy create_all method which takes the database connection engine object as a parameter. Finally, it creates an instance of the session maker using the same engine object to enable interactions with the database.

  4. Lastly, define the API routes for the microservice.
     @app.route("/api/user", methods=["POST"])
    def create_user():
        data = request.get_json()
        name = data["name"]
        try:
            session = Session()
            new_user = User(name=name)
            session.add(new_user)
            session.commit()
            return {"id": new_user.id, "name": new_user.name, "message": f"User {name} created."}, 201
        except Exception as e:
            print(f"The error '{e}' occurred.")
            return {"error": "An error occurred while creating the user."}, 500
    @app.route("/api/user", methods=["GET"])
    def get_all_users():
        try:
            session = Session()
            users = session.query(User).all()
            if users:
                result = []
                for user in users:
                    result.append({"id": user.id, "name": user.name})
                return jsonify(result)
            else:
                return jsonify({"error": f"Users not found."}), 404
        except Exception as e:
            print(f"The error '{e}' occurred.")
            return {"error": "An error occurred while getting all users."}, 500
    if __name__ == "__main__":
        app.run(debug=True, host="0.0.0.0")

Test the Microservice

The above code demonstrates a simple user data microservice that adds and fetches data from a PostgreSQL database. Ideally, microservices mirror the REST API architecture since it allows for a flexible approach to building web services—this architecture fits well with the design pattern of microservices.

However, it’s important to note that microservices can use other types of design approaches and communication protocols as well, depending on the specific needs of the system.

To test the service, spin up the development server and head over to Postman to make HTTP requests to the defined endpoints.

 flask --app service run 

In Postman, make a POST request to add user data.

Containerizing Microservices With Docker

Docker bundles applications and their dependencies in containers. This approach streamlines the development, deployment, and management of microservices in a production environment since each service can operate independently and communicate with other services using the configured communication protocol.

Before you get started, you need to first install Docker by following the steps on the Docker website. Then, build a Docker image from a Dockerfile that contains the necessary instructions for setting up the required dependencies to run the application in a container.

  1. Create a Dockerfile in your project folder’s root directory and add these instructions:
     FROM python:3.9-alpine
    WORKDIR /app
    COPY requirements.txt ./
    RUN pip install -r requirements.txt
    COPY . .
    EXPOSE 5000
    CMD ["python", "./service.py"]
  2. Run, the command below to build the Docker image.
      docker build -t flask-microservice . 
  3. Finally, run the Docker container.
     docker run -p 5000:5000 flask-microservice 

This will start a Docker container running the Flask microservice and expose port 5000 on the container to port 8000 on the host machine, allowing you to make HTTP requests from your web browser or Postman using the URL http://localhost:5000.

Adopting the Microservice Architecture

Microservices architecture has become a popular approach for developing scalable and robust software applications. By dividing the application into small, independently deployable services, microservices architecture makes it easier to maintain and scale the system.

While this architecture has potential benefits, it’s not suitable not for all use cases. In any case, the specific business requirements of the project should primarily influence the adopted design approach.

MakeUseOf