PyCharm – A Simple Illustrated Guide

PyCharm – A Simple Illustrated Guide

https://ift.tt/3oLo6PC

PyCharm is one of the most popular and widely used IDE for Python. This tutorial is a complete walkthrough of the PyCharm Integrated Development Environment to help Python Programmers use PyCharm and its features.

I have researched a lot on the topic and then compiled this PyCharm article/walkthrough for you so that you get a firm grip on using the most popular IDE when it comes to programming in Python. Not only have I added screenshots and images on numerous topics that have been discussed in this tutorial but also added numerous videos for your convenience and better understanding. So, are you ready to learn the ins and outs of PyCharm?

❖ Introduction to Integrated Development Environments (IDE)

A common question asked by most Python beginners is –

What environment should I prefer while programming in Python?

Answer: You can either use an IDE or a text editor for coding. You need an IDE or a text editor for writing/modifying code.

We have a plethora of choices when it comes to text editors, however, some of them are more popular than the others, majorly because of their ease of use and the features that they provide. Let us have a look at some of them.

➠ Some commonly used text editors for programming are:

  1. Sublime Text
  2. Atom
  3. Vim
  4. Visual Studio Code
  5. Notepad++

➠ Now, here is a list of some of the most commonly used IDE’s used for coding in Python:

  1. PyCharm
  2. IDLE
  3. Spyder
  4. PyDev
  5. Wing

Now that brings us to the next question –

Should we use an IDE or a Text editor?

Answer: This is one of the most debated questions among programmers. I prefer using an IDE over text editors. The reason being, IDEs provide numerous advantages over a simple text editor though one might argue that IDEs can be used as text editors, and text editors can be used as IDEs. However, strictly speaking, a text editor is used for writing/modifying text/code whereas, an IDE, enables us to do a lot more within that single program; running, debugging, version control, etc.

An IDE or Integrated Development Environment can be considered as a programming tool that integrates several specialized tools into a cohesive environment. These specialized tools may include:

  • A text editor
  • A code autocomplete function
  • A build procedure that includes a compiler, linker, etc.
  • A debugger
  • A file or project manager
  • A performance profiler
  • a deployment tool
  • and so on.

Advantages of using an IDE

  • Provide an Interactive interface which makes life easy for programmers as it ensures that syntactic or semantic errors are detected while developing without any hassle.
  • Reduces debugging time.
  • Provides an inbuilt version control mechanism.
  • Facilitates visual programming through flow-charts, block diagrams, etc.

Therefore it makes more sense to use an IDE instead of using a text editor. In order to use a text editor like an IDE, you must install numerous plugins so that it behaves the way an IDE does but all of that is already taken care of by an IDE without the need for extra plugins.

IDE Selection

Selecting an IDE is purely based on the developers requirement. Some of the factors governing the selection of an IDE can be –

  • If a developer has to code in multiple languages?
  • Whether an integrated debugger is required?
  • If a drag-drop GUI layout is required?
  • If features like autocomplete and class browsers are required? and so on.

Having said that, the most commonly used and preferred IDE by Python programmers is PyCharm.

❖ Introduction To PyCharm

As mentioned earlier PyCharm is the most popular IDE used by Python programmers. It is a cross-platform IDE developed by the Czech company JetBrains.

PyCharm Features

PyCharm offers the following features:

  • Syntax highlighting
  • Auto-Indentation and code formatting
  • Code completion
  • Line and block commenting
  • On-the-fly error highlighting
  • Code snippets
  • Code folding
  • Easy code navigation and search
  • Code analysis
  • Configurable language injections
  • Python refactoring
  • Documentation

What makes PyCharm special and more efficient than most other IDEs?

🧠 Intelligent Python Assistance

PyCharm provides:

  • smart code completion,
  • code inspections,
  • on-the-fly error highlighting and quick-fixes,
  • automated code refactoring and rich navigation capabilities.

🌐 Web Development Frameworks

PyCharm offers framework-specific support for modern web development frameworks such as Django, Flask, Google App Engine, Pyramid, and web2py.

🔬 Scientific Tools

PyCharm integrates with IPython Notebook, has an interactive Python console, and supports Anaconda as well as multiple scientific packages including matplotlib and NumPy.

🔀 Cross-technology Development

In addition to Python, PyCharm supports JavaScript, CoffeeScript, TypeScript, Cython, SQL, HTML/CSS, template languages, AngularJS, Node.js, and more.

💻 Remote Development Capabilities

With PyCharm you can run, debug, test, and deploy applications on remote hosts or virtual machines, with remote interpreters, an integrated ssh terminal, and Docker and Vagrant integration.

🛠 Built-in Developer Tools

PyCharm contains a huge collection of out of the box tools:

  • An integrated debugger and test runner;
  • Python profiler;
  • A built-in terminal;
  • Integration with major VCS
  • Built-in Database Tools.

PyCharm Editions

PyCharm is available in three editions:

  1. Community (open-source)
  2. Professional (paid)
  3. Educational (open-source)

Let’s compare the Community and Professional editions in the table given below:

  PyCharm Professional Edition   PyCharm Community Edition
Intelligent Python editor  ✔  ✔
Graphical debugger and test runner  ✔  ✔
Navigation and Refactorings  ✔  ✔
Code inspections  ✔  ✔
VCS support  ✔  ✔
Scientific tools  ✔  ❌
Web development  ✔  ❌
Python web frameworks  ✔  ❌
Python Profiler  ✔  ❌
Remote development capabilities  ✔  ❌
Database & SQL support  ✔  ❌

Now that we have gone through the basics of PyCharm, let us have a look at how we can install PyCharm.

❖ Installing PyCharm

✨ Installing PyCharm on Windows

1. The first step is to download the latest version of PyCharm for either of the professional or community version. Here’s the link to download it from the official website:

2. After the download is complete, run the executable installer file and follow the wizard steps that follow.

✨ Installing PyCharm on Mac

Step 1: Open PyCharm and download PyCharm for Mac for either of the Community or Professional version.

Step 2: Once the .dmg file has been downloaded, double click on the file to begin your installation.

Step 3: After the dmg file is launched, drag PyCharm into your Application folder.

Step 4: In the Applications Folder, double click on PyCharm to open the Application.

Step 5: On the first launch you will be asked to import settings. Tick the box: ☑ I do not have a previous version of PyCharm or I do not want to import my settings. Click on OK and Accept the Privacy Policy. Keep the Install Config as it is set by default. Click OK.

💡 On the Welcome screen, you can do the following:

  • Create a New Project.
  • Open an existing project or file.
  • Check out an existing project from a version control system.

✨ Installing PyCharm on Linux

Method 1: Using Snap Package 

PyCharm is available as a Snap package. If you’re on Ubuntu 16.04 or later, you can install PyCharm from the command line.

sudo snap install [pycharm-professional|pycharm-community] --classic

Note: If you are on some other Linux distribution, you can enable snap support first and then use the snap command to install the PyCharm Community Edition.

Method 2: Using official Linux installer from JetBrains 

1. Download the latest version of PyCharm (tar.gz file) for either of the Professional or Community version.

2. Go to the folder where you have downloaded your file.

cd ~/Downloads

3. Extract the tar.gz file.

tar -xzf pycharm-community-2020.1.1.tar.gz

4. Move into the the extracted PyCharm folder and then inside the bin folder.

cd pycharm-community-2020.1.1/bin

5. Add executable permissions to the script file inside the bin folder.

chmod u+x pycharm.sh

6. Then run the script file.

sh pycharm.sh

7. PyCharm starts running and in the first run, you will be asked you to accept the privacy policy. Then you will be asked whether you would like to send data about features, plugins, and other data. If you wish to send the data, you can hit the “Send Anonymous Statistics” button, or you can click on the “Don’t Send” button. And finally, PyCharm will ask you to set up the IDE. Start by choosing the UI theme, creating a launcher script, and adding plugins.

Now that brings us to the end of the first section of this comprehensive guide on PyCharm. In the next section, we will learn how to write our first code in Python using PyCharm. We will also discuss how to run, debug, and test your code. Let’s begin the next phase of our PyCharm journey!

Please click on the Next button/link given below to move onto the next section of this tutorial!

The post PyCharm – A Simple Illustrated Guide first appeared on Finxter.

Python

via Finxter https://ift.tt/2HRc2LV

November 1, 2020 at 03:56PM

Check Out These Extensive Breakdowns of Alita: Battle Angel’s Visual Effects

Check Out These Extensive Breakdowns of Alita: Battle Angel’s Visual Effects

https://ift.tt/2TFQUuA


Alita wrecking.
Image: 20th Century Fox

As a woman who is also at least part robot, I have a deep-held affinity for Alita. Her first film outing (hopefully not her last) didn’t check every box, but it was a lot of fun. And it sure was visually striking, with some intense and innovative visual effects work.

If you were also transfixed by the look of Alita: Battle Angel, you’re in for some hefty lucky, because recently Weta Digital posted a bunch of glimpses at its visual effects work, Ranging from its composting to the lush dreg heap of Iron City to Alita herself, Weta is eager to show off how Alita: Battle Angel made a story of cyborg self-actualization so visually unique.

What an absolutely striking film. It had foul luck, going up against Captain Marvel and also becoming the site of a weird reactionary crusade to keep people from seeing Captain Marvel, but it remains a unique, absolutely all-in big-budget experience. I am among those hoping for a sequel, but in the meantime, these breakdowns are a mighty satisfying watch.


For more, make sure you’re following us on our Instagram @io9dotcom.

G/O Media may get a commission

geeky,Tech

via Gizmodo https://gizmodo.com

November 1, 2020 at 04:57PM

Codementor: How I learned Python

Codementor: How I learned Python

https://ift.tt/2JqdYvz

This is the story of how I started off with python

Python

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

November 1, 2020 at 01:52AM

Trump supporter follows Biden campaign bus all over Houston in hearse called the “Democrat Cemetery Vote Collector”

Trump supporter follows Biden campaign bus all over Houston in hearse called the “Democrat Cemetery Vote Collector”

https://ift.tt/2HPSJlQ

While Joe Biden has been handling a light schedule of morning campaign stops and basement naps, his campaign bus has been driving throughout the southern US.

fun

via Not the Bee https://notthebee.com

October 29, 2020 at 06:58PM

Eloquent Encrypted Casting

Eloquent Encrypted Casting

https://ift.tt/2HO6EZX


A recent pull request by Jason McCreary which was released in Laravel 8.12 included the ability to encrypt a model attribute using an Eloquent cast.
The included encrypted cast option now also allows casting the attribute into an array, JSON, object or a collection after it has been decrypted.

class EncryptedCast extends Model
{
    public $casts = [
        'secret' => 'encrypted',
        'secret_array' => 'encrypted:array',
        'secret_json' => 'encrypted:json',
        'secret_object' => 'encrypted:object',
        'secret_collection' => 'encrypted:collection',
    ];
    ...
}

This encrypted cast uses Laravel’s Crypt facade to encrypt and decrypt the attribute from the database. There were earlier PRs back in Laravel 5.3 which were closed that attempted to bring this functionality into Laravel.
If you use Laravel’s built-in encrypted cast notation then it is important to realise this locks your app key. As this is the secret which Crypt uses under the hood to encrypt and decrypt everything in Laravel from sessions and cookies.

The same weekend that Laravel encrypted casts were added into Laravel core, I completed a hackathon hosted by my Employer UKFast where I created EloquentEncrypted. This uses 4096-bit RSA keys to cast model attributes into the database in an encrypted form.

This separates Eloquents encryption from the app key so that you are free to rotate this as needed, something that is advised by Tighten in their blog post APP_KEY And You. This package also includes migration helpers to set the encrypted field accordingly in your database.

Schema::create('sales_notes', function (Blueprint $table) {
    $table->increments('id');
    $table->encrypted('private_data');
    $table->timestamps();
});

The Eloquent Encryption package also allows for casting after encryption with a couple of initial offers to show how this can be done. You can cast to a string using the default Encrypted cast, an Integer or float and even to a collection. Collections are serialised into JSON strings which are then encrypted.

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use RichardStyles\EloquentEncryption\Casts\Encrypted;
use RichardStyles\EloquentEncryption\Casts\EncryptedInteger;
use RichardStyles\EloquentEncryption\Casts\EncryptedFloat;
use RichardStyles\EloquentEncryption\Casts\EncryptedCollection;

class SalesData extends Model
{
    /**
     * The attributes that should be cast.
     *
     * @var array
     */
    protected $casts = [
        'private_data' => Encrypted::class,
        'private_int' => EncryptedInteger::class,
        'private_float' => EncryptedFloat::class,
        'private_collection' => EncryptedCollection::class,
    ];
}

I’ve also put together another package called Eloquent AES which allows you to use AES-256-CBC encryption for your eloquent model data. This creates a separate Eloquent key which is used to encrypt/decrypt during casting.

<?php
namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use RichardStyles\EloquentAES\Casts\AESEncrypted;

class SalesData extends Model
{
    /**
     * The attributes that should be cast.
     *
     * @var array
     */
    protected $casts = [
        'private_data' => AESEncrypted::class,
    ];
}

This simply creates another instance of the Encrypter class within laravel using a different config key. This second package was created because people should be able to choose the method of encryption and how that choice affects other areas of their applications.

Filed in:
News

programming

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

October 30, 2020 at 09:01AM

Trump Holds Press Conference To Announce He Got Cool New Calculator Watch

Trump Holds Press Conference To Announce He Got Cool New Calculator Watch

https://ift.tt/31U91Bz


WASHINGTON, D.C.—President Trump held an emergency press conference. While most expected it to be an update on either the coronavirus or the recent civil unrest, the conference was instead all about the cool new calculator watch Trump had obtained.

“Look at this thing!” Trump told the press, showing off the black Casio watch on his wrist. “I can do math anywhere. Even hard stuff. This changes everything.”

Trump then demonstrated, using the watch to calculate a 15% tip on a $60 well-done steak. “And like that, I can answer any math problem instantly,” he bragged. “I’m basically unstoppable now. Ask me anything.”

A reporter from the Washington Post stood up. “With the ongoing pandemic and protests still–”

“No, a math question, you dummies!” Trump interrupted. “And put decimals in it. Make it hard.”

“34.7 times 63.1,” offered a correspondent from OAN.

Trump plugged away at his watch. “2,189.57!” Trump proudly announced.

Trump then tried to calculate what each American’s personal share of the national debt was, but he had to give up, as the calculator watch only went up to eight digits.


fun

via The Babylon Bee https://babylonbee.com

October 29, 2020 at 11:02PM

Eloquent Encrypter

Eloquent Encrypter

https://ift.tt/35JZsWR


Eloquent Encryption

This package enables an additional layer of security when handling sensitive data. Allowing key fields of your eloquent models in the database to be encrypted at rest.

Latest Version on Packagist
Build Status
Quality Score
Total Downloads

Introduction

This open source package fulfils the need of encrypting selected model data in your database whilst allowing your app:key to be rotated. When needing to store private details this package allows for greater security than the default Laravel encrypter.
It uses default 4096-bit RSA keys to encrypt your data securely and Laravel model casting to dynamically encrypt and decrypt key fields.

Usually, you would use Laravel’s Encrypter to encrypt the data, but this has the limitation of using the app:key as the private secret. As the app key also secures session/cookie data, it is advised that you rotate this every so often – if you’re storing encrypted data using this method you have to decrypt it all first and re-encrypt whenever this is done. Therefore this package improves on this by creating a separate and stronger encryption process allowing you to rotate the app:key. This allows for a greater level of security of sensitive model data within your Laravel application and your database.

Installation

This package requires Laravel 8.x or higher.

You can install the package via composer:

composer require richardstyles/eloquentencryption

You do not need to register the ServiceProvider as this package uses Laravel Package auto discovery.
The Migration blueprint helpers are added using macros, so do not affect the schema files.

The configuration can be published using this command, if you need to change the RSA key size, storage path and key file names.

php artisan vendor:publish --provider="RichardStyles\EloquentEncryption\EloquentEncryptionServiceProvider" --tag="config"

In order to encrypt and decrypt data you need to generate RSA keys for this package. By default, this will create 4096-bit RSA keys to your storage/ directory. Do not add these to version control and backup accordingly.

php artisan encrypt:generate

⚠️ If you re-run this command, you will lose access to any encrypted data ⚠️

There is also a helper function to define your encrypted fields in your migrations.
There is nothing special needed for this to function, simply declare a encrypted column type in your migration files. This just creates a binary/blob column to hold the encrypted data. Using this helper indicates that the field is encrypted when looking through your migrations.

Schema::create('sales_notes', function (Blueprint $table) {
    $table->increments('id');
    $table->encrypted('private_data');
    $table->timestamps();
});

Usage

This package leverages Laravel’s own custom casting to encode/decode values.

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use RichardStyles\EloquentEncryption\Casts\Encrypted;
use RichardStyles\EloquentEncryption\Casts\EncryptedInteger;
use RichardStyles\EloquentEncryption\Casts\EncryptedFloat;
use RichardStyles\EloquentEncryption\Casts\EncryptedCollection;

class SalesData extends Model
{
    /**
     * The attributes that should be cast.
     *
     * @var array
     */
    protected $casts = [
        'private_data' => Encrypted::class,
        'private_int' => EncryptedInteger::class,
        'private_float' => EncryptedFloat::class,
        'private_collection' => EncryptedCollection::class,
    ];
}

There are additional casts which will cast the decrypted value into a specific data type. If there is not one that you need, simply make a PR including sufficient testing.

Testing

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Support

If you are having general issues with this package, feel free to contact me on Twitter.

If you believe you have found an issue, please report it using the GitHub issue tracker, or better yet, fork the repository and submit a pull request with a failing test.

If you’re using this package, I’d love to hear your thoughts. Thanks!

Security

If you discover any security related issues, please email richard@udeploy.dev instead of using the issue tracker.

Credits

License

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

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.

programming

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

October 29, 2020 at 08:24PM

Save hundreds on these Python, AI and data science courses

Save hundreds on these Python, AI and data science courses

https://ift.tt/3ea4MqA

In this age of big data, companies worldwide need to sift through the avalanche of information at their disposal to enhance their products, services and overall profitability. As such, there’s a growing demand in today’s job market for specialists who have the technical skills and knowledge to help businesses make sense of big data and turn it into actionable insights. Many companies rely on programming languages like Python and the advancements made in artificial intelligence (AI) and data science to get that job done.

Right now, you can save hundreds on The Ultimate Python & Artificial Intelligence Certification Bundle, featuring nine in-depth courses and 38 hours of video content that catches you up to speed on everything Python, AI and data science.

You learn the fundamentals of programming with Python and discover its practical applications throughout this comprehensive bundle. It kickstarts your training with step-by-step guidance on the basics of writing code with this valuable programming language. With a firm grasp of the essentials, you then get introduced to applying Python to AI and data science. That means learning new concepts, such as machine learning, deep learning and computer vision, as well as mastering the frameworks and underlying techniques that bring these advanced applications to life.  

Included courses:

  • Python for Beginners: Learn All the Basics of Python ($199 value)

  • Python: Introduction to Data Science and Machine Learning A-Z ($199 value)

  • Artificial Intelligence (AI) in Python: A H2O Approach ($199 value)

  • Master PyTorch for Artificial Intelligence Networks & Deep Learning ($199 value)

  • Image Processing & Analysis Bootcamp with OpenCV and Deep Learning in Python ($199 value)

  • Keras Bootcamp for Deep Learning & AI in Python ($199 value)

  • Practical Data Pre-Processing & Visualization Training with R ($199 value)

  • Pre-Process & Visualize Data with Tidy Techniques in R ($199 value)

Python, AI and data science are in-demand skills companies need to make the most of big data in their daily operations and, ultimately, bottom line. Usually $1,791, The Ultimate Python & Artificial Intelligence Certification Bundle is on sale for $40, 97% off its original cost. 

Prices are subject to change.

Engadget is teaming up with StackSocial to bring you deals on the latest headphones, gadgets, tech toys, and tutorials. This post does not constitute editorial endorsement, and we earn a portion of all sales. If you have any questions about the products you see here or previous purchases, please contact StackSocial support here.

geeky,Tech,Database

via Engadget http://www.engadget.com

October 29, 2020 at 02:06PM

Complete Beginners Guide on Laravel Livewire Events

Complete Beginners Guide on Laravel Livewire Events

https://ift.tt/3jEGK8b


Complete Beginners Guide on Laravel Livewire Events

Posted By

Mahedi Hasan

Category

Framework

Sub-category

Laravel 8.x

October 24, 2020

Hello devs in this tutorial i am going to discuss about Laravel livewire events. You already know that Livewire components can communicate with each other through a global event system. As long as two Livewire components are living on the same page, they can communicate using events and listeners.

If you already worked with vue events then livewire events is going to be almost same thing i think. If you use larave livewire already then you know about that Laravel Livewire simplifies so many aspects of building out your Laravel application.

Livewire makes it easy to send data from the client to the server and from the server back to the client.In this quick example tutorial, I’ll show you how easy it is to send data back and forth from the client and the server.

Client To The Server with Livewire

In laravel livewire sending events from the client to the server can easily be accomplished with a wire:click event like

 

This is covered in the Livewire Actions Documentation, but what if we wanted to call a PHP function from vanilla javascript? Simple enough, we can utilize Livewire Events to do that like so:

 

After doing that steps, inside of our PHP code, you’ll need to register an event listener that maps to a function:

protected $listeners = ['say-hello' => 'sayHello'];

public function sayHello()
{
    // your code here
}

 

Recommended : Laravel 7.x Livewire Form Submit Example Tutorial

 

That’s the simplest and very easy way for your front-end to talk to your back-end. Next, we’ll see how we can send an event from the back-end to the front-end in this tutorial with laravel livewire events.

Server to the Client with Livewire

Sending events from the server to the client can be done by utilizing the dispatchBrowserEvent function in laravel livewire. See the example like so:

public function sayGoodbye()
{
    $this->dispatchBrowserEvent('say-goodbye', []);
}

 

Then, we can register an even listener in javascript to catch this event like below

 

And that’s it 🙌 Finally, you may like to know how to send data between the sever to clinet and client to server.

Sending Data to the Server

In our previous code example, we can easily pass data to the server with the following javascript code:

 

Read also : Laravel Livewire Dynamically Add More Input Fields Example

 

And we can access that data from the first argument in our function:

protected $listeners = ['say-hello' => 'sayHello'];

public function sayHello($payload)
{
    $name = $payload['name'];
    // your code here
}

 

That’s great, right? Next step, we’ll also need a way to pass data from our server to our client.

Sending Data to the Client

We already seen before that we can easily send data from our PHP code to our front-end by sending it in the array of our dispatchBrowserEvent function:

public function sayGoodbye()
{
    $this->dispatchBrowserEvent('say-goodbye', ['name' => 'John']);
}

 

And we can capture that data in javascript by fetching the event.detail variable.

 

Read also : Laravel 8.x Livewire CRUD Tutorial Step by Step

 

Hope it can help you to pass data from client to server and server to client. Now you know how to pass data client to server and server to clinet using Laravel livewire.

 

programming

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

October 28, 2020 at 08:18PM