Making Movie Natural Disasters

https://theawesomer.com/photos/2021/09/making_natural_disaster_movies_t.jpg

Making Movie Natural Disasters

Link

Movies and TV shows use a mix of practical, optical, and digital visual effects to simulate natural disasters. Insider compiled behind-the-scenes footage from eight movies where VFX pros brought storms, earthquakes, tsunamis, and other acts of Mother Nature’s fury to life.

The Awesomer

Understanding the magic of Laravel macros


Using Laravel macros is a powerful way to extend default behavior of many classes in Laravel, such as Collections, Stringables and Reponses. In this article I’m going to explain how these macros work under the hood.

What are macros?

Using macros, you can extend default methods in a class. Take for example this macro:

Collection::macro('insertBetweenEach', function ($value) {
    return $this->flatMap(fn ($item) => [$item, $value])->slice(0, -1);
});

Now if you run this code:

collect([1, 2, 3])->insertBetweenEach(4)->dd();

You’ll get this output:

[1, 4, 2, 4, 3]

As you can see, it’s very simple to add macros and thus extend classes like Collection, Str, Stringable and Response. And if you would try to change the core classes in the vendor folder, you would loose all methods when updating or deploying.

The Macroable trait

All classes that offer macro-functionality, use the Illuminate\Support\Traits\Macroable trait. You can even add this to your own classes too!

The trait adds a protected property to the class, called $macros. When you register a macro using the macro() method, it will be saved in this array.

// vendor/laravel/framework/src/Illuminate/Macroable/Traits/Macroable.php

trait Macroable
{
    protected static array $macros = [];

    public static function macro(string $name, object|callable $macro): void
    {
        static::$macros[$name] = $macro;
    }
}

Calling methods

When you call a method that does not exist on a method, PHP will check for a __call() method and runs that instead of throwing an exception. In this method Laravel will check if there is a macro registered and run that.

// vendor/laravel/framework/src/Illuminate/Macroable/Traits/Macroable.php

trait Macroable
{
    protected static array $macros = [];

    public static function macro(string $name, object|callable $macro): void
    {
        static::$macros[$name] = $macro;
    }
    
    public function __call(string $method, array $parameters): mixed
    {
        if (!isset(static::$macros[$method])) {
            throw new BadMethodCallException(sprintf('Method %s::%s does not exist.', static::class, $method));
        }

        $macro = static::$macros[$method];

        if ($macro instanceof Closure) {
            $macro = $macro->bindTo($this, static::class);
        }

        return $macro(...$parameters);
    }
}

This method exists of four parts:

  1. It checks if the macro exists, and if not it throws an exception
  2. It finds the corresponding macro
  3. If the macro is callable (a Closure), it will bind the callback to the current class, so if the macro calls $this it works as expected
  4. It will run the macro

Static methods

When a static method is called that does not exist, PHP will execute the __callStatic() method instead of __call(). This will basically do the same thing as __call(), except not binding the callback to the current instance.

// vendor/laravel/framework/src/Illuminate/Macroable/Traits/Macroable.php

trait Macroable
{
    protected static array $macros = [];

    public static function macro(string $name, object|callable $macro): void
    {
        static::$macros[$name] = $macro;
    }
    
    public function __call(string $method, array $parameters): mixed
    {
        if (!isset(static::$macros[$method])) {
            throw new BadMethodCallException(sprintf('Method %s::%s does not exist.', static::class, $method));
        }

        $macro = static::$macros[$method];

        if ($macro instanceof Closure) {
            $macro = $macro->bindTo($this, static::class);
        }

        return $macro(...$parameters);
    }
  
    public static function __callStatic(string $method, array $parameters): mixed
    {
        if (!static::hasMacro($method)) {
            throw new BadMethodCallException(sprintf('Method %s::%s does not exist.', static::class, $method));
        }

        $macro = static::$macros[$method];

        if ($macro instanceof Closure) {
            $macro = $macro->bindTo(null, static::class);
        }

        return $macro(...$parameters);
    }
}

Conclusion

Although Laravel macros may seem hard to understand, they are actually very simple to understand and use.

Laravel News Links

How To Automatically Apply the Laravel-PHP Coding Style (For Free)


If you work inside a team, do yourself a favor – decide on a coding style and get the entire team to use it.

Why Stick To a Standard Code Style?

Making all your teammates’ code look the same will make the codebase so much easier to review, merge and maintain:

  • it’ll be easier for you to judge only how the code works, without being distracted by how it looks;
  • you won’t have PRs bloated by striping spaces, removing spaces, converting tabs to spaces, moving parentheses on the next line… and so on; less to think about during review; fewer conflicts to fix;
  • even if you work solo – I’d argue it’s still very a good idea to do it; adopting PSR-12 in particular will make your code look the same as most well-maintained PHP projects; so when you go look at their code, it’ll actually start looking… a little more familiar; so it’ll be a little easier to learn from them;
  • plus, I bet you will adopt PSR-12 one day, so if you start now… you’ll thank yourself later on; be kind to your future self!

Which Code Style to Choose?

Fortunately, thanks to PHP-FIG, it’s easy to choose a standard to start from – PSR-12. Digging a little deeper though, the Laravel ecosystem has pretty much decided on a few rules on top of that. Personally I don’t agree with all of them… but… that’s normal. Ask 10 developers what they like and… you’ll get 10 different answers. So in this case, I found it’s better to just… stick to the Laravel standard. You don’t like X in particular, your coworker doesn’t like Y, and so on, but… you each give in a little bit, for the sake of standardization. Everybody compromises, nobody has a reason to make a fuss… it’s the fair way to go, if you ask me. But hey… you do you 😀

How Do I Automatically Enforce It?

There are quite a few ways to do this automatically:

Option 1. Use StyleCI

If you can use StyleCI, use that. This is why it exists, and it does an excellent job. When someone pushes code to the repo, StyleCI comes in and formats it, by changing their PR to match the code style. It’s simple and brilliant. In fact, we use StyleCI for all the public-source Backpack packages and it’s worked wonders. Just follow the prompts to set it up, then you can forget about it.

If your code is open-source, this is such a good option, that you don’t need to read any further!

However… if your code is closed-source (not public)… you might find your particular company/setup can’t use StyleCI. You might develop A LOT of private projects, that are not under continuous development or maintenance… so you don’t want to pay for a maintenance fee for legacy projects… we get it, we got there too. In that case, the StyleCI pricing won’t make sense for you. In that case…

Option 2. Use PHP-CS-Fixer in Your Editor/IDE

Use php-cs-fixer locally, on each developer’s computer. There are plug-ins for every major editor and IDE, so it should be easy to do. You can store a configuration file in your project root, to make sure you all enforce the same rules.

However, this does assume you can tell your developers “do this, we all need to use the same code style“. In most teams, you can. But even if they do, most developers switch editors, forget to install the plugin, so unstyled code does go through, sometimes. For that reason alone, I don’t trust this method alone. So what I prefer is to…

Option 3. Use PHP-CS-Fixer Inside a Github Action

If none of the above float your boat, there’s one super-simple solution that you can implement, then forget about. It has most of the benefits of StyleCI (it’s implemented where the code is stored, on Github) and most of the benefits of PHP-CS-Fixer (it’s free).

You can implement a Github Action. Every time code is pushed or a pull request submitted, you can run php-cs-fixer on that code and fix whatever is needed. That way, no matter what developers submit, the code will be styled according to the standard.

To be honest, this is the entire reason this article exists – so I get to document how I did this 😀 Hopefully it’ll save you some time (and future me too). Here’s how to go about it:

Step 1. Create a configuration file for PHP-CS-Fixer (.php-cs-fixer.dist.php in your root directory). Here’s the content we use for it, after digging quite a bit. Note that if you don’t have a directory mentioned at the end, you should comment them out, otherwise PHP-CS-Fixer will fail. If you have any comments/improvements on the code style, please suggest them in my gist, it’s open for improvements.

Step 2. Add .php-cs-fixer.cache to your .gitignore file.

Step 3. Add a PHP-CS-Fixer as a dev requirement: composer require --dev friendsofphp/php-cs-fixer

Step 4. Add a Github action/workflow for it, by creating a .github/workflows/format_php.yml file:

name: Apply PHP Code Style

on:
    push:
        branches:
            - 'master'
    pull_request:
        paths:
            - '**.php'

jobs:
    php-cs-fixer:
        runs-on: ubuntu-latest
        steps:
            - uses: actions/[email protected]
              with:
                  ref: $

            - name: Install
              run: composer install

            - name: Run php-cs-fixer
              run: ./vendor/bin/php-cs-fixer fix

            - uses: stefanzweifel/[email protected]
              with:
                  commit_message: Apply php-cs-fixer changes

That should be it. Once you push code to your repo, a new commit should automatically be created, fixing the style. This works particularly well if you work with PRs, because then you squash and merge them and you won’t bloat up your git history.


I hope this will be helpful to you. If you have a better way of doing this, let me know in the comments. I know there are a lot of ways, but this is what I found to be the best for us, in Sep 2021.

Laravel News Links

80% Lowers & Kit Sales Spike in 2021

https://www.pewpewtactical.com/wp-content/uploads/2020/03/Food-TP-Bullets-1024×683.jpg

I don’t think that anybody would argue that the past year and a half has been absolutely insane for gun sales.

I mean, seriously, we should all make congratulatory t-shirts or something. Part of the chaos of 2020-2021 has revolved around the gun industry as well.

Food TP Bullets
This just about sums up 2020 and 2021.

We all know that firearms, ammunition, black powder, and other components have virtually disappeared from shelves throughout the nation.

And President Biden has positioned the Department of Justice to tackle topics like pistol braces and 80% receivers.

Older AR-15 Pistol Braces
Pistol braces also came under fire.

But we wanted to know what kind of impact the past year and a half has had on the world of 80% receivers.

So, if you’ve been curious about how 80% receivers have fared recently, keep reading to learn more.

80% Arms GST-9 Parts
GST-9 Parts

80% Receiver Sales Spike

Since 2020 when guns began disappearing off gun store shelves, more Americans began turning to 80% receivers as it was one of the few options available.

As a result, people began buying them in droves. While Pennsylvania-based JSD Supply was already planning on expanding their capabilities before 2020, last year pushed them into expansion even further – almost accidentally, CEO and owner Jordan Vinroe stated.

Starting Pilot Hole, 80% Arms
Starting Pilot Hole

JSD Supply is primarily geared towards the do-it-yourself firearm maker, with a host of products revolving around the DIY sector — including 80% AR-15 lowers, AR-10 lowers, and the like.

Vinroe said business was booming. But what caused this increase?

Executive Actions

“It’s most certainly due to government overreach. Anytime people try to restrict a right, people exercise that right as much as they can.”

Vinroe noted that when politicians talk about guns, gun sales always increase exponentially. History has proven that politicians often make the best gun salesmen.

In April, President Biden issues several Executive Actions targeting both braces and 80% kits. (You can read more about that here.)

Biden Signs
President Joe Biden, joined by Vice President Kamala Harris, signs the American Rescue Plan Thursday, March 11, 2021, in the Oval Office of the White House. (Official White House Photo by Adam Schultz)

“We’ve been expecting (and preparing) for legislation and regulation to come to the national stage for a while now, and today’s press conference from the White House confirms it. 80% Lowers are the main target of an aggressive executive push to undermine the community of home builders,” 80% Arms said in a statement shared with Pew Pew Tactical at the time.

“We believe the best way to ensure 2nd Amendment rights is to provide a method that allows citizens to manufacture their own firearms at home,” the company added.

80% Arms GST-9 Parts

Following the Executive Actions, the ATF issued a 115-page set of proposals attempting to reclassify a firearm’s “frame or receiver.” You can read more about that in our ATF’s Proposed Rules on Firearms, Receivers [Guide].

Nathan Deters of Anderson Manufacturing explained his company saw a significant increase in 2021 in 80% lower purchases. He said it was “definitely due to the recent ATF proposed rule changes on 80% lowers.”

Best Value
50

at Brownells

Prices accurate at time of writing

Prices accurate at time of writing

Demand for 80% lowers reached such heights in 2021 that Anderson Manufacturing moved some production capacity over to 80% lowers.

Anderson Manufacturing also noted an uptick in jig kits and complete lowers as well.

Ghost Gunner also saw a massive spike starting in April 2021. Cody Wilson attributes this to when “Biden made his ghost gun rule press conference.”

80% AR-15 Lowers, All Sides
80% AR-15 Lowers, All Sides

As a result, the company struggled to keep enough .308 and AR-15 style receivers in stock. They’re flying off shelves as soon as they get them in.

“We sell every Polymer80 frame we can get in stock. People are aware of the state and federal doors closing on this activity,” Wilson stated, as well as noting that they’re seeing a spike in the sales of jigs for 80% lowers as well.

80% Arms GST-9 Complete
GST-9 Complete

Akin to the other manufacturers I contacted, Ghost Gunner has also seen certain areas ordering more products than others.

Wilson noted that the demographics for sales have largely remained the same for the past five years. But said that California and cities such as Baltimore are overrepresented within his business.

30

at 80% Arms

Prices accurate at time of writing

Prices accurate at time of writing

Riots & Unrest

JSD Supply’s Vinroe explained that in addition to politics, cities hit with riots often saw customers calling JSD Supply “almost frantic” due to their inability to find a gun in local stores.

Missouri, in particular, saw an uptick in sales after riots broke out.

Portland Riot Police 2
Portland Riot Police

As far as customers themselves, JSD Supply said a large number of first-time gun owners purchased products and a significant number of burglary victims who believe that their homes were targeted as a result of local riots as well.

According to Vinroe, every product JSD Supply offers experienced an increase in sales over the past year and a half.

Conclusion

It should come as no surprise that 80% receiver sales are up. Virtually every item within the entire gun industry has seen spectacular sales for the past year and a half.

CMMG Lower Parts Kit and 80% Arms Completed Receiver
CMMG Lower Parts Kit and 80% Arms Completed Receiver

Driven both by civil unrest and politics, it seems as if the 80% trend isn’t slowing down anytime soon.

What do you think about 80% kits and lowers? Let us know in the comments below. Read up on 80% kits at What Are 80% Lower Receiver Kits and the Best 80% Receivers, Jigs & Frames.  

The post 80% Lowers & Kit Sales Spike in 2021 appeared first on Pew Pew Tactical.

Pew Pew Tactical

The 6 Best Open Source Lightroom Alternatives

https://static1.makeuseofimages.com/wordpress/wp-content/uploads/2021/08/Screenshot-(273).png

Adobe Lightroom is a non-destructive photo editing software. It’s part of the Adobe ecosystem and comes with great photo editing features. However, it doesn’t come cheap.

Its price tag is a bit off-putting if you’re looking for affordable editing software, but don’t worry. There are several free, open source alternatives that you can use to edit your images.

1. GIMP


GIMP is a free and open source bitmap graphics editor that’s excellent for retouching and editing photos, as well as image enhancement.

Developed by the GIMP Development Team, this software contains powerful photo manipulation features suitable for professional creators. It’s also considered one of the best alternatives to Photoshop.

When to Use It: GIMP is best used for basic graphic design needs and image editing. It’s especially great if you don’t have a lot of experience with advanced image editing and manipulation.

Features:

  • Free
  • Excellent image manipulation tools
  • Extensive graphic design toolset
  • Comes with color management features
  • Supports third-party plugins and customization options

Pros:

  • High-quality framework
  • Comes with tutorials and guides
  • Small learning curve
  • Multi-computer language support
  • Outstanding color reproduction
  • High customization levels
  • Has all the essential editing tools
  • Supports multiple file formats

Cons:

  • The selection tool isn’t precise
  • Lack of customer support
  • A limited number of layers

Download: GIMP for Windows, Mac, and Linux (Free)

2.DigiKam


DigiKam is an intuitive, open source photo management software that focuses on image organization and tag editing. The app comes with an editing package designed for importing, exporting, editing, and managing RAW images.

It also has powerful tagging tools and filtering functionality. Photos are also put into albums, allowing you to quickly search for and find items.

When to Use It: DigiKam is best for organizing and comparing photos, or when preparing your pictures for publishing.

Features:

  • Supports all primary image file formats (JPEG, PNG, and RAW)
  • Add captions and ratings to images
  • Filter and sort photos into albums and sub-albums
  • Lets you easily export albums to social platforms
  • Light Table lets you compare images
  • Advanced image editing tools

Pros:

  • Free
  • Supports a large number of digital camera models
  • Supports USB storage devices
  • Is great for batch image editing

Cons:

  • Software is slow at times
  • Sophisticated interface
  • Has a complex image export process

Download: DigiKam for Windows, Mac, and Linux (Free)

3. PhotoFlow


PhotoFlow is an open source and non-destructive photo editing program that supports RAW images. It specializes in image retouching, but also has several tools that let you perform basic edits.

When to Use It: Use PhotoFlow when you want to manipulate RAW images using advanced non-destructive tools, such as HDR tone mapping.

Features:

  • Supports all major image formats
  • Real-time image previews
  • Freehand drawing
  • Basic editing tools
  • Color-correction features
  • Color space conversions

Pros:

  • Free
  • Non-destructive editing
  • Available for Linux, Windows, and macOS

Cons:

  • Rugged interface
  • Software doesn’t provide descriptions for editing tools

Download: PhotoFlow for Windows, Mac, and Linux (Free)

4. LightZone

LightZone is a free, open source editing software initially developed for commercial editing. However, it is now open to all users. It supports non-destructive editing, which allows you to edit an image without overwriting the original image data.

When to Use It: LightZone is best for editing RAW images, as it produces high-quality JPEGs.

Features:

  • Elegant user interface
  • Supports both JPEG and RAW image formats
  • Non-destructive RAW editor
  • Compatible with multiple operating systems
  • Great for batch processing
  • Advanced image adjustment settings

Pros:

  • No-fuss photo editing tools
  • Non-destructive editing
  • Has a community forum for technical assistance

Cons:

  • Lack of documentation
  • Difficult to use for beginners

Download: LightZone for Windows, Mac, and Linux (Free)

5. Photivo

Do you want to get the most out of your photos? Photivo is a great open source image editor that comes with a variety of filters and a large library of features.

And if you’re a fan of GIMP, Photivo comes with a button that lets you easily export your images to GIMP for further editing.

When to Use It: It’s best for editing high-quality RAW and bitmap files that require high attention to detail.

Features:

  • Supports bitmap images and RAW files
  • Elegant and straightforward interface
  • Advanced settings and adjustments
  • Channel mixer support
  • 16-bit internal processing
  • Batch mode
  • Multi-lingual support
  • Allows for cross-processing

Pros:

  • Feature-rich
  • Powerful internal processing
  • Supports multiple image formats
  • Batch processing capabilities

Cons:

  • Sophisticated
  • Requires image editing experience to use
  • Needs a powerful computer to run

Download: Photivo for Windows | Mac | Linux (Free)

6. BitMappery


Don’t want to download image editing software to your computer? Well, with Bitmappery, you can do all the editing from your web browser.

Bitmappery is a free, open source photo editing software that’s also web-based. It integrates with Dropbox, letting your easily import and edit images from the cloud. Bitmappery presents a quick solution for any editing project that needs to be done in a timely manner.

When to Use It: Bitmappery is great for quickly editing photos that are stored in Dropbox.

Features:

  • Layer management
  • Dropbox integration
  • Offline support
  • Keyboard shortcuts for faster editing
  • Transformation options

Pros:

  • Accessible on any device, since it’s web-based
  • Non-destructive editing
  • Only needs a web browser to run

Cons:

  • Limited editing options
  • Less refined than other software

Related: The Best Free Photo Editing Software to Try Today

Adobe Lightroom vs. Open Source Photo Editing Software

If you are looking to edit your photos, Adobe Lightroom is a great option. It is a non-destructive photo editor, and all edits are kept in your Lightroom catalog. It’s also much easier to use than Photoshop and has great photo management tools.

Open source photo editing software, on the other hand, can be up to par with the paid options. Most of the software above offer the same features as Adobe Lightroom. Some, like GIMP, have more features than Lightroom.

If you are looking for free-to-use photo editing software, be sure to check out the above. You can even use them to learn about photo editing before committing to a paid photo editing software.

MUO – Feed

The Wheel of Time’s First Trailer Brings Robert Jordan’s Fantasy World to Life

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/c8e1444f6e88a248794826ada5bddbac.jpg

Look what’s rolled into town! Why, it’s the first trailer (finally) for Amazon’s much-anticipated fantasy television series The Wheel of Time. It’s later than we expected, given the show is currently set to premiere on November 19, but was it worth the wait?

Based on Robert Jordan’s massive, best-selling, 15-book fantasy series (the last few of which were co-written by author Brandon Sanderson after Jordan’s death in 2007), The Wheel of Time serves as the “connective tissue between Lord of the Rings and Game of Thrones,” as showrunner Rafe Judkins put it at San Diego Comic-Con. We have been anxiously anticipating the trailer after a few very tiny teases and the first images being released just earlier this month. Well, what are you waiting for? Give it a watch!

The trailer delves into the bare bones of The Wheel of Time’s giant, sprawling tale: In a fantasy world where only women called Aes Sedai are allowed to use magic, the powerful sorcerer Moiraine (played by Rosamund Pike) comes across three boys and two girls—Rand al’Thor (Josha Stradowski), Mat Cauthon (Barney Harris), Perrin Aybara (Marcus Rutherfort), Nynaeve al’Meara (Zoë Robins), Egwene al’Vere (Madeleine Madden)—one of whom she suspects might be the reincarnation of the legendary Dragon, an entity so powerful he could destroy the world.

If you’re a lover of the books, you’ve likely immediately noted a discrepancy in the show. Originally, only the three male characters were seen as candidates to be the magic-wielding Dragon Reborn, as a sort of yin to the Aes Sedai’s yang. But the official synopsis makes it sound like Nyneave and Egwene are contenders as well: “Set in a sprawling, epic world where magic exists and only certain women are allowed to access it, the story follows Moiraine (Rosamund Pike), a member of the incredibly powerful all-female organization called the Aes Sedai, as she arrives in the small town of Two Rivers. There, she embarks on a dangerous, world-spanning journey with five young men and women, one of whom is prophesied to be the Dragon Reborn, who will either save or destroy humanity.”

The trailer also leans heavily into the Aes Sedai as wholly virtuous protectors of the world. In the books, while the Aes Sedai certainly saw themselves as protectors of the world, in reality, they were callous, supercilious, and often misandric. I’m not saying they need to be perfect angels in the TV series, but let’s just say Jordan’s portrayal of female characters left plenty of room for improvement, of which hopefully the show has taken advantage. As for the look of the show, the clips are so brief it’s hard to get a good read on it. The vivid colors are wonderful and the CG looks great, but some of the sets…well, they look very much like studio sets to me, as opposed to the beautiful, on-location scenes of Game of Thrones. Still, it’s worth remembering Amazon has liked what it’s seen of The Wheel of Time so much that it’s already filming a second season.

G/O Media may get a commission

Great Back-to-School Pick!
Long battery life perfect for students.

That’s good news for the rest of the show’s giant cast, which includes (takes a deep breath): Daniel Henney as al’Lan Mandragoran, Michael McElhatton as Tam al’Thor, Álvaro Morte as Logain Ablar, Priyanka Bose as Alanna Mosvani, Jennifer Cheon Garcia as Leane Sharif, Kate Fleetwood as Liandrin Guirale, Sophie Okonedo as Siuan Sanche, Kae Alexander as Min Farshaw, Clare Perkins as Kerene Nagashi, Orphan Black’s Maria Doyle Kennedy as Illa, and so, so, so many more. Please offer your effusive praise/constructive criticism/infuriated rants about the trailer in the comments. And, uh, don’t forget there’s a separate Wheel of Time movie trilogy also in the works now…


Wondering where our RSS feed went? You can pick the new up one here.

Gizmodo