I’m sorry, but I just can’t resist this!

I’m sorry, but I just can’t resist this!

https://ift.tt/31OnnU7

 

I may be in my sixties, but I still remember with joy the cartoons of my youth.  One of my favorites was Tom & Jerry, with the scheming cat regularly being handed his come-uppance at the hands of Jerry Mouse and his allies.  The series is criticized today for being too violent – but I don’t recall any blood ever being shown, despite Tom being sliced in half, Jerry folded, spindled and mutilated, and all parties being assaulted several times during the course of each cartoon.

I therefore giggled like a schoolboy yesterday when I came across this compilation of some of the best gags from early Tom & Jerry cartoons.  It’s 23 minutes of mayhem and laughter.  Enjoy!  (If the embedded cartoon won’t play, you’ll find it here on YouTube.)

Oh, the memories . . .

Peter

non critical

via Bayou Renaissance Man https://ift.tt/1ctARFa

October 28, 2020 at 06:56AM

Honest The Mandalorian Trailer

Honest The Mandalorian Trailer

https://ift.tt/3e1bn6m

Honest The Mandalorian Trailer

Link

The Mandalorian is returning to Disney+ on 10.30.2020, so it only makes sense that Screen Junkies would seize upon the chance to make an Honest Trailer for the hit series. Despite being such an excellent show, they still found plenty of reasons to poke fun at its characters and storylines.

fun

via The Awesomer https://theawesomer.com

October 27, 2020 at 07:15PM

Winners of the 2020 Epson International Pano Awards (23 photos)

Winners of the 2020 Epson International Pano Awards (23 photos)

https://ift.tt/3oyKDPp

The top-scoring panoramic photos entered in the eleventh Epson International Pano Awards have just been announced. The contest is meant to showcase the best work of panoramic photographers around the world. Organizers reported that they received 5,859 entries from 1,452 photographers in 96 countries this year, competing for the top spots in five categories, for several special awards, and for some of the cash prizes offered. Contest organizers were once again kind enough to share some of the winners and top scorers here.



Spring Hibernation, Overall Winner, and Winner, Open – Nature / Landscapes. Photographed near Squamish, BC, Canada.
(© Copyright Matt Jackisch / The 11th EPSON International Pano Awards)

via In Focus https://ift.tt/2hyaA18

October 27, 2020 at 02:05PM

Livewire File Uploads to Amazon S3

Livewire File Uploads to Amazon S3

https://ift.tt/2JfRldj


Many multi-tenant apps require image uploads, and may need to store those files in Amazon S3. Let’s create an Amazon S3 bucket from scratch and get it connected to our app. Then, we’ll leverage the powerful and simple file uploading functionality that Livewire provides.

programming

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

October 27, 2020 at 02:41PM

Wyze launches version 3 of its $20 security camera

Wyze launches version 3 of its $20 security camera

https://ift.tt/37Npg7k

Wyze first made a name for itself when it launched its $20 indoor security camera a few years ago. Since then, the company branched out into other smart home products, ranging from doorbells to scales. Today, it’s going back to its origins with the launch of the Wyze Cam V3, the third generation of its flagship camera.

The new version is still $20 (though that’s without shipping unless there’s a free shipping promotion in the Wyze store), but the company redesigned both the outside and a lot of the hardware inside the camera, which is now also IP65 rated, so you can now use it outdoors, too.

Image Credits: Wyze

The Cam V3 now also features new sensors that enable color night vision, thanks to an F1.6 aperture lens that captures 40 percent more light than the previous version. That lens now also covers a 130-degree field of view (up from 110 degrees in V2) and the company pushed up the frames per second from 15 during the day and 10 at night to 20 and 15 respectively.

The company also enhanced the classic black and white night vision mode — which you’ll still need when it’s really dark outside or in the room you are monitoring — by adding a second set of infrared lights to the camera.

Other new features are an 80dB siren to deter unwanted visitors. This feature is triggered by Wyze’s AI-powered person-detection capability, but that’s a feature the company recently moved behind its $2/month CamPlus paywall, after originally offering it for free. That’s not going to break the bank (and you get a generous free trial period), but it’d be nice if the company could’ve kept this relatively standard feature free and instead only charged for extra cloud storage or more advanced features (though you do get free 14-day rolling cloud storage for 12-second clips).

Wyze Cam V2 (left) and V3 (right).

Wyze provided me with a review unit ahead of today’s launch (and a Cam V2 to compare them). The image quality of the new camera is clearly better and the larger field of view makes a difference, even though the distortion at the edges is a bit more noticeable now (but given the use case, that’s not an issue). The new night color vision mode works as promised and I like that you can set the camera to automatically switch between them based on the lighting conditions.

The person detection has been close to 100% accurate — and unlike some competing cameras that don’t feature this capability, I didn’t get any false alarms during rain or when the wind started blowing leaves across the ground.

If you already have a Wyze Cam V2, you don’t need to upgrade to this new one — the core features haven’t changed all that much, after all. But if you’re in the market for this kind of camera and aren’t locked into a particular security system, it’s hard to beat the new Wyze Cam.

technology

via TechCrunch https://techcrunch.com

October 27, 2020 at 01:08PM

MagSafe 15W fast charging restricted to Apple 20W adapter

MagSafe 15W fast charging restricted to Apple 20W adapter

https://ift.tt/2Tup1FS


New testing shows Apple’s MagSafe charging puck does peak at 15W with iPhone 12, but only when paired with the company’s 20W adapter.

The apparent restriction was discovered by Aaron Zollo of YouTube channel Zollotech. In a comprehensive evaluation of Apple’s MagSafe device posted on Monday, Zollo found two Apple adapters — a new standalone 20W USB-C device and the 18W unit that came with iPhone 11 Pro handsets — achieved high charge rates.

Measuring energy throughput with an inline digital meter revealed MagSafe hits the advertised 15W peak charging rate (up to 16W in the video) when paired with Apple’s branded 20W adapter. Speeds drop to about 13W with the 18W adapter, and Zollo notes the system takes some time to ramp up to that level.

Older adapters and third-party models with high output ratings do not fare well in the test. Apple’s own 96W MacBook Pro USB-C adapter eked out 10W with MagSafe, matching a high seen by Anker’s PowerPort Atom PD1. Likewise, charging rates hovered between 6W and 9W when attached to Aukey’s 65W adapter, Google’s Pixel adapter and Samsung’s Note 20 Ultra adapter.

It appears third-party devices will need to adopt a MagSafe-compatible power delivery (PD) profile to ensure fast, stable energy delivery when connected to iPhone 12 series devices.

As can be expected with any charging solution, temperature plays a significant role in potential throughput. Zollo found MagSafe throttles speeds as temperatures rise, meaning actual rates are not a constant 15W even when using the 20W adapter. When heat rises, energy output decreases to protect sensitive hardware components and the battery itself. In some cases, this could prompt users to remove their iPhone from its case — including Apple-branded MagSafe models — to achieve maximum thermal efficiency.

Zollo also confirms older Qi-compatible iPhone models, like iPhone 8 Plus and iPhone 11 Pro Max, charge at about 5W with MagSafe. Apple previously said Qi devices would charge at 7.5W.

macintosh

via AppleInsider https://ift.tt/3dGGYcl

October 26, 2020 at 08:38PM

Device Tracking in Laravel

Device Tracking in Laravel

https://ift.tt/3otT1jj


Laravel Device Tracking is a package by Ivano Matteo that allows you to track different devices used by users of your application. You can use this package as a base for functionality like detecting users on new devices and managing the verified status between device and user. You could also possibly see device hijacking.

The package works by adding the UseDevices trait to your application’s User model:

use IvanoMatteo\LaravelDeviceTracking\Traits\UseDevices;

class User extends Authenticatable
{

    use HasFactory, Notifiable, UseDevices;
    // ...
}

The UseDevices trait gives you access to a devices() (belongs to many) relationship to get verified devices:

$user->device()

Here are some examples of methods you can access via the package’s facade:

use IvanoMatteo\LaravelDeviceTracking\LaravelDeviceTrackingFacade as DeviceTracker;

DeviceTracker::detectFindAndUpdate();

DeviceTracker::flagCurrentAsVerified();

// Flag as verified for the current user
DeviceTracker::flagCurrentAsVerified();

// Flag as verified for a specific user
DeviceTracker::flagAsVerified($device, $user_id);

// Flag as verified for a specific user by device UUID
DeviceTracker::flagAsVerifiedByUuid($device_uuid, $user_id);

You can learn more about this package, get full installation instructions, and view the source code on GitHub at ivanomatteo/laravel-device-tracking.


This package was submitted to our Laravel News Links section. Links is a place the community can post packages and tutorials around the Laravel ecosystem. Follow along on Twitter @LaravelLinks

Filed in:
News
/
laravel
/
packages

programming

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

October 27, 2020 at 09:22AM

Memes that made me laugh 29

Memes that made me laugh 29

https://ift.tt/3ms69U7

 

Gathered up over the past week on the Internet.

More next week!

Peter

non critical

via Bayou Renaissance Man https://ift.tt/1ctARFa

October 26, 2020 at 05:59AM

Stack Abuse: What Does if __name__ == “__main__”: Do in Python?

Stack Abuse: What Does if __name__ == “__main__”: Do in Python?

https://ift.tt/37IeoYk

Introduction

It’s common to see if __name__ == "__main__" in Python scripts we find online, or one of the many we write ourselves.

Why do we use that if-statement when running our Python programs? In this article, we explain the mechanics behind its usage, the advantages, and where it can be used.

The __name__ Attribute and the __main__ Scope

The __name__ attribute comes by default as one of the names in the current local scope. The Python interpreter automatically adds this value when we are running a Python script or importing our code as a module.

Try out the following command on your Python interpreter. You may find out that __name__ belongs to the list of attributes in dir():

dir()

dir() output

The __name__ in Python is a special variable that defines the name of the class or the current module or the script from which it gets invoked.

Create a new folder called name_scripts so we can write a few scripts to understand how this all works. In that folder create a new file, script1.py with the following code:

print(f'The __name__ from script1 is "{__name__}"')

script1.py output

That’s a curveball! We’d expect that the name would be script1, as our file. What does the output __main__ mean?

By default, when a script is executed, the interpreter reads the script and assigns the string __main__ to the __name__ keyword.

It gets even more interesting when the above script gets imported to another script. Consider a Python file named script2.py with the following code:

import script1  # The print statement gets executed upon import

print(f'The __name__ from script2 is "{__name__}"')

script2.py output

As you can see, when the script is executed the output is given as script1 denoting the name of the script. The final print statement is in the scope of script2 and when it gets executed, the output gets printed as: __main__.

Now that we understand how Python uses the __name__ scope and when it gives it a value of "__main__", let’s look at why we check for its value before executing code.

if __name__ == "__main__" in Action

We use the if-statement to run blocks of code only if our program is the main program executed. This allows our program to be executable by itself, but friendly to other Python modules who may want to import some functionality without having to run the code.

Consider the following Python programs:

a) script3.py contains a function called add() which gets invoked only from the main context.

def add(a, b):
    return a+b


if __name__ == "__main__":
    print(add(2, 3))

Here’s the output when script3.py gets invoked:

script3.py output

As the script was executed directly, the __name__ keyword is assigned to __main__, and the block of code under the if __name__ == "__main__" condition is executed.

b) Here’s what happens when this snippet is imported from script4.py:

import script3

print(f"{script3.__name__}")

script4.py output

The block under if __name__ == "__main__" from script3.py did not execute, as expected. This happened because the __name__ keyword is now assigned with the name of the script: script3. This can be verified by the print statement given which prints the assigned value for the __name__ keyword.

How Does __name__ == "__main__" Help in Development?

Here are some use cases for using that if-statement when creating your script

  • Testing is a good practice which helps not only catch bugs but ensure your code behaves as required. Test files have to import a function or object to them. In these cases, we typically don’t want the script being run as the main module.
  • You’re creating a library but would like to include a demo or other special run-time cases for users. By using this if-statement, the Python modules that use your code as a library are unaffected.

Creating a __main__.py File for Modules

The point of having the if __name__ == "__main__" block is to get the piece of code under the condition to get executed when the script is in the __main__ scope. While creating packages in Python, however, it’s better if the code to be executed under the __main__ context is written in a separate file.

Let’s consider the following example – a package for performing calculations. The file tree structure for such a scenario can be visualized as:

calc                 # --> Root directory
├── __main__.py
├── script1.py
├── script2.py
├── script3.py
├── script4.py
└── src              # --> Sub-directory
    ├── add.py
    └── sub.py

The tree structure contains calc as the root directory and a sub-directory known as src. The __main__.py under the calc directory contains the following content:

from src.add import add
from src.sub import sub

a, b = input("Enter two numbers separated by commas: ").split(',')
a, b = int(a), int(b)

print(f"The sum is: {add(a, b)}")
print(f"The difference is: {sub(a, b)}")

The add.py contains:

def add(a, b):
    return a+b

And sub.py contains:

def sub(a, b):
    return a-b

From right outside the calc directory, the script can be executed and the logic inside the __main__.py gets executed by invoking:

python3 calc

script1.py output

This structure also gives a cleaner look to the workspace location, the way how the directories are organized, and the entry point is defined inside a separate file called __main__.py.

Conclusion

The __name__ == "__main__" runs blocks of code only when our Python script is being executed directly from a user. This is powerful as it allows our code to have different behavior when it’s being executed as a program instead of being imported as a module.

When writing large modules, we can opt for the more structured approach of having a __main__.py file to run a module. For a stand-alone script, including the if __name__ == "__main__" is a simpler method to separate the API from the program.

Python

via Planet Python https://ift.tt/1dar6IN

October 26, 2020 at 09:50AM