Quantcast
Channel: Edureka
Viewing all 1753 articles
Browse latest View live

How To Avoid Indentation Error In Python

$
0
0

Python is one of the leading and emerging programming platforms in the world of programming today. With its vast array of features and great flexibility, one can achieve a lot on this platform, given they know how to operate it. In this Indentation Error in Python Following pointers will be covered.

One of the most interesting queries that we get from coders of all expertise level and experience is how to fix the indentation error in python and in this article we will discuss more in detail about just that.

Let’s Begin!

 

A Small Introduction to Indentation

Before we dive down into the specifics of why an indentation error happens in the first place, let us first get acquainted with a basic idea of Python.

Python as a programming language was first introduced in the year 1991 and since then programmers around the world have adapted to it and created various applications both for the web and mobile. In Python, all the code that you type is arranged via correct whitespaces and therefore if at any instance you have a bad indentation, the overall code will not run and the interpreter will simply return an error function.

A quick about the indentation error is that no matter if you are a pro or a newbie at programming, this is bound to happen to you at some point in time or the other.

Python follows the PEP8 whitespace ethics while arranging its code and therefore it is suggested that there should be 4 whitespaces between every iteration and any alternative that doesn’t have this will return an error.

Moving on with this article on Identation Error in Python

 

The cause of Indentation Error in Python

As mentioned in the introduction paragraph, one of the main reasons for the indentation error is the absence of tabs and or whitespaces between lines of code. Since python makes use of procedural language, if you miss out on adding tabs or spaces between your lines of code, then you will most likely experience this error. Although in some cases the entire program will run correctly, in others the error will come in the middle of the execution and therefore pause the entire process.

Mentioned below are some of the common causes of an indentation error in Python:

  • While coding you are using both the tab as well as space. While in theory both of them serve the same purpose, if used alternatively in a code, the interpreter gets confused between which alteration to use and thus returns an error.
  • While programming you have placed an indentation in the wrong place. Since python follows strict guidelines when it comes to arranging the code, if you placed any indentation in the wrong place, the indentation error is mostly inevitable.
  • Sometimes in the midst of finishing a long program, we tend to miss out on indenting the compound statements such as for, while and if and this in most cases will lead to an indentation error.
  • Last but not least, if you forget to use user defined classes, then an indentation error will most likely pop up.

 

 

A solution to the Indentation Error

Now that you know why this error is caused in the first place, let us explore some of the solutions to it.

#1 Solution

While there is no quick fix to this problem, one thing that you need to keep in mind while trying to find a solution for the indentation error is the fact that you have to go through each line individually and find out which one contains the error.

In Python, all the lines of code are arranged according to blocks, so it becomes easier for you to spot an error. For example, if you have used the if statement in any line, the next line must definitely have an indentation.

Take a look at the example below.

If you need guidance on how the correct form of indentation will look like, take a look at the example below.

 

 

#2 Solution

If the above-mentioned solution didn’t work for you, and you are having a hard time figuring out which line you have missed the indentation at, then follow these steps. Go to the setting of your code editor and enable the option which shows the tab and whitespaces. Once this feature in turned on, you will see small single dots in between your code, where each dot represents whitespace or a tab. If you see that a dot is missing somewhere that it needs to be, then that line probably has the indentation error.

To enable the option in order to view the tabs or whitespaces, take a look at the image below.

 

Another option to get out of this problem is to use the built in Indent Guide in the Python interpreter.

Enabling this option will guide through each line of code and show you exactly where your error lies. Although this method is highly inefficient taking into consideration that your program contains several lines of code, this is the surest way to find and fix all existing errors.

 

Conclusion

Python is one of the most popular and adaptable programming languages out there. With its support for a wide variety of programming styles and languages, it is easily one of the most preferred choices for developers and coders worldwide. But even so, indentation error in Python, that everyone faces once in a while.

Using the solutions mentioned above you can easily fix your indentation error in Python and continue programming efficiently into the future. All the best.

With this, we come to an end of this Indentation error in Python article. To get in-depth knowledge on Python along with its various applications, you can enroll here for live online training with 24/7 support and lifetime access.


What is Protected in Java and How to Implement it?

$
0
0

Java provides a set of keywords called Access Modifiers which helps us in setting the visibility of a class, interface, variable, data member, method, constructor, etc. There are 4 types of access modifiers, default, public, private and protected, which are supported in Java. In this article, I will be focusing solely on protected in Java and help you in getting clear insights into it.

Below are the topics I will be discussing in this article:

What is Protected in Java?

As mentioned before, protected in Java is an access modifier that helps a programmer in assigning the visibility of a class, its members, interfaces, etc. When class members are declared as protected in Java, they are accessible only within the same package as well as to the direct subclasses of the base class. While using protected keyword in Java, you must keep in mind that only class members can be declared as protected. Classes and interfaces can’t be declared as protected in Java.

Now you might be thinking why classes and interfaces can’t be made protected?

Well, if you think logically the answer becomes quite clear. If a class is made protected, then it will be only visible to the classes present within the same package. Now, as I have mentioned before, when anything is made protected in Java, it is visible to its subclasses as well.      

But, here is an ambiguity. For other classes to extend a protected class, the parent class has to be visible. How will you extend something which is not visible in the first place? Thus, this causes ambiguity and creating protected classes is not allowed in Java.

Now let’s understand why interfaces can’t be made protected. Well, in Java the elements are generally made protected so that their implementations can be shared among others. But in the case of interfaces, they have no implementation, so there is no point in sharing them. Thus all the methods present within the interfaces must be public so that any class or struts can easily implement them.

Thus, you can declare only the methods and the data members as protected in Java and not the classes or interfaces. This helps in encapsulating the code by restricting the accessibility to the class members. It also helps in preventing the misuse of data.

Protected Implementation

Let’s now try to implement what we have learned till now. So, here I will be creating two classes, each belonging to a separate package.

 

 

EduProtected.java in package edu1

package edu1;

public class EduProtected {
		 protected void message(String disp){
		     System.out.println("Package 1 message recieved: "+ disp);
		 }
}

EduSubClass.java in package edu2

package edu2;
import edu1.EduProtected;

public class EduSubClass extends EduProtected {
	public static void main(String[] args) {
		EduProtected show = new EduProtected();
        // invokes message() from EduProtected class
        show.message("Hello from package2 subclass");
	}
}

Output:

Package 1 message received: Hello from package2 subclass

This brings us to the end of this article. If you want to know more about Java you can refer to our other Java Blogs.

Now that you have understood what is protected in Java, check out the Java Certification Training by Edureka, a trusted online learning company with a network of more than 250,000 satisfied learners spread across the globe. Edureka’s Java J2EE and SOA training and certification course is designed for students and professionals who want to be a Java Developer. The course is designed to give you a head start into Java programming and train you for both core and advanced Java concepts along with various Java frameworks like Hibernate & Spring.

Got a question for us? Please mention it in the comments section of this article and we will get back to you as soon as possible.

What is the use of DECODE function in SQL?

$
0
0

In Oracle, DECODE function allows us to add procedural if-then-else logic to the query. In this blog, we will try to get a complete understanding of DECODE function in SQL. We will be learning the various ways to use DECODE, its syntax and understand it with examples. Stay with us until the end of the blog.

The topics which are going to be covered are:

Let’s start one by one. 

What is DECODE function in SQL?

In Oracle, DECODE function allows us to add procedural if-then-else logic to the query. DECODE compares the expression to each search value one by one. If expression is equal to a search, then the corresponding result is returned by the Oracle Database. If a match is not found, then default is returned. If default is omitted, then Oracle returns null.

The type of arguments can be:

  • Numeric types (NUMBER, BINARY_FLOAT, or BINARY_DOUBLE)

If the first search-result pair is numeric, then Oracle compares all search-result expressions and the first expr to find the argument with the highest numeric precedence, converts the remaining arguments implicitly to that datatype, and returns that particular datatype.

  • Character types

If expr and search are character data, then Oracle compares them using non-padded comparison semantics. expr, search, and the result can be any of the datatypes CHAR, VARCHAR2, NCHAR, or NVARCHAR2. The returned String is of VARCHAR2 datatype and is in the same character set as the first result parameter.

Oracle Database uses short-circuit evaluation. It evaluates search values only before comparing it to expression rather than evaluating all search values. If a previous search is equal to expression, the evaluation is terminated.

Oracle converts expr and search values to the datatype of the first search value before comparison. And converts the return value to the same data type as the first result.

Example:  If the first result has the datatype CHAR or if the first result is null, then Oracle converts the return value to the data type VARCHAR2.

Two nulls are considered to be equivalent by Oracle. If expr is null, then Oracle returns NULL which is the result of the first search.

The maximum number of components that can be contained in the DECODE function is 255. This includes the expression, search, and result arguments. 

The DECODE function can be used in the following versions of Oracle or PLSQL:

Oracle 12c, Oracle 11g, Oracle 10g, Oracle 9i

A basic example:

In the following example, the Oracle DECODE() function compares the first argument with the second argument. Since they are equal, the function returns the second argument which is the string ‘One’.

SELECT
DECODE(1, 1, 'One')
FROM
dual;

The syntax for the DECODE function is:

DECODE(expression , search , result [, search , result]… [, default(optional)])

expression

The value which has to be compared. It automatically gets converted to the data type of the first search value before comparing.

search

The value that is compared against the expression.

result

The value that is returned, if expression=search.

default

If there are no matches, the DECODE function will return default and if default is omitted, then the function will return NULL.

Examples of DECODE function

  • The DECODE function can be used in Oracle/PLSQL as follows
SELECT bank_name,
DECODE(bank_id, 001, 'SBI',
                    002, 'ICICI',
                    003, ‘Dena',
                    'Gateway') result
FROM banks;

Equivalent IF-THEN-ELSE statement for the above DECODE() statement:

IF bank_id = 001 THEN
   result := 'SBI';

ELSIF bank_id = 002 THEN
   result := 'ICICI';

ELSIF bank_id = 003 THEN
   result := 'Dena';

ELSE
   result := 'Gateway';

END IF;

The DECODE function will compare each bank_id value, one by one.

  • DECODE function to compare two dates (date1 and date2), where, if date1 > date2, the DECODE function should return date2. Otherwise, the DECODE function should return date1
DECODE((date1 - date2) - ABS(date1 - date2), 0, date2, date1)

The formula below equals 0, if date1 is greater than date2:

(date1 - date2) - ABS(date1 - date2)

The date example illustrated above can also be modified as follows:

DECODE(SIGN(date1-date2), 1, date2, date1)
  • DECODE statement that will return the following:

If hours_of_work < 1 then return 0.04
If hours_of_work >= 1 and < 5 then return 0.04
If hours_of_work > 5 then return 0.06

Here, you need to create a formula that will evaluate to a single number for each one of your ranges.

SELECT emp_name,
DECODE(TRUNC (( hours_of_work + 3) / 4), 0, 0.04,
                                          1, 0.04,
                                          0.06) as perc_value
FROM employees;

This is all about DECODE function, by now you must have got a clear picture of how it works and how useful this function is. Now, try using them whenever any IF-ELSE logic is required while working on SQL. I hope the article helped you with the concepts of the DECODE statement.

If you wish to learn more about MySQL and get to know this open-source relational database, then check out our MySQL DBA Certification Training which comes with instructor-led live training and real-life project experience. This training will help you understand MySQL in-depth and help you achieve mastery over the subject.

Got a question for us? Please mention it in the comments section of ”DECODE in SQL” and I will get back to you.

Linux commands in DevOps: Must Know For Every DevOps Professional

$
0
0

Linux fundamentals and Scripting is one of the most essential skills of a DevOps Professional. Most of the companies have their environment on Linux, also many CM tools like – Puppet, Chef and Ansible have their master nodes on Linux. So in this blog, I will be covering the entire command line part which is an essential part of DevOps. The topics that we will cover here are as follows –

    1. What is Linux?
    2. Why is Linux popular?
    3. Linux Commands in DevOps.
    4. Shell Scripting
    5. Git Commands.

So let us get started,

What is Linux?

Linux is an open-source and community-developed operating system for computers, servers, mainframes, mobile devices, and embedded devices. It has support on almost every major computer platform including x86, ARM etc, making it one of the most widely supported operating systems.

The design of Linux is similar to UNIX but it has evolved to run on a wide variety of hardware from phones to supercomputers. Every Linux-based OS contains the Linux Kernel—which manages hardware resources—and a set of software packages that make up the rest of the operating system.

Why Linux is popular?

Linux is different from the rest of the operating systems in many important aspects. Some of them are as follows

1. Free First, and perhaps most importantly, Linux is free. You do not have to spend any amount to download and use it, unlike windows.

2. Open SourceLinux is open-source software. The code used to create Linux is free and available to the public to view, edit, and—for users with the appropriate skills—to contribute to.

3. Secure – Once you have Linux installed on your system, there is no need to use an antivirus! Linux is a highly secure system. Moreover, there is a global development community constantly looking at ways to enhance its security. Each upgrade makes the OS becomes more secure and robust.

4. Stability and Performance – Linux provides very high stability i.e. it does not need a reboot after a short period of time. Your Linux system rarely slows down or freezes.You can work without any disturbance on your Linux systems. Linux provides remarkably high performance on various networks and workstations.

Linux Commands in DevOps

In this section, we will have a look at the most frequently used Linux commands that are used while working in DevOps.

ls

This command lists all the contents in the current working directory.

syntax:

$ ls <flag>

Command Description

ls <path name>

By specifying the path after ls, the content in that path will be displayed

ls –l

Using ‘l’ flag, lists all the contents along with its owner settings, permissions & time

stamp (long format)

ls –a

Using ‘a’ flag, lists all the hidden contents in the specified directory

sudo

This command executes only that command with root/ superuser privileges.

syntax:

$ sudo <command>

Command Description

sudo useradd <username>

Adding a new user

sudo passwd <username>

Setting a password for the new user

sudo userdel <username>

 Deleting the user

sudo groupadd <groupname>

Adding a new group

sudo groupdel <groupname>

 Deleting the  group

sudo usermod -g <groupname> <username>

Adding a user to a primary group

cat

This command can read, modify or concatenate text files. It also displays file contents.

syntax:

$ cat <flag> {filename}

Command

Description

cat -b

This adds line numbers to non-blank lines

cat -n

This adds line numbers to all lines

cat -s

This squeezes blank lines into one line

cat –E

This shows $ at the end of line

grep

This command searches for a particular string/ word in a text file. This is similar to “Ctrl+F” but executed via a CLI.

syntax:

$ grep <flag or element_to_search> {filename}

Command Description

grep -i

Returns the results for case insensitive strings

grep -n

Returns the matching strings along with their line number

grep -v

Returns the result of lines not matching the search string

grep -c

Returns the number of lines in which the results matched the search string

sort

This command sorts the results of a search either alphabetically or numerically. It also sorts files, file contents, and directories.

syntax:

$ sort <flag> {filename}

Command

Description

sort -r

the flag returns the results in reverse order;

sort -f

the flag does case insensitive sorting

sort -n

the flag returns the results as per numerical order

tail

It is complementary to head command. The tail command, as the name implies, print the last N number of data of the given input. By default, it prints the last 10 lines of the specified files. If you give more than one filename, then data from each file precedes by its file name.

syntax:

tail [OPTION]... [FILE]...

tail -n 3 state.txt or tail -3 state.txt => -n for no. of lines

tail +25 state.txt

-c num: Prints the last ‘num’ bytes from the file specified.

chown

Different users in the operating system have ownership and permission to ensure that the files are secure and put restrictions on who can modify the contents of the files. In Linux there are different users who use the system:

  • Each user has some properties associated with them, such as a user ID and a home directory. We can add users into a group to make the process of managing users easier.
  • group can have zero or more users. A specified user is associated with a “default group”. It can also be a member of other groups on the system as well.

Ownership and Permissions: To protect and secure files and directory in Linux we use permissions to control what a user can do with a file or directory. Linux uses three types of permissions:

  • Read: This permission allows the user to read files and in directories, it lets the user read directories and subdirectories stores in it.
  • Write: This permission allows a user to modify and delete a file. Also, it allows a user to modify its contents (create, delete and rename files in it) for the directories. Unless you give the execute permission to directories, changes does not affect them.
  • Execute: The write permission on a file executes the file. For example, if we have a file named sh so unless we don’t give it execute permission it won’t run.

Types of file Permissions:

  • User: This type of file permission affects the owner of the file.
  • Group: This type of file permission affects the group which owns the file. Instead of the group permissions, the user permissions will apply if the owner user is in this group.
  • Other: This type of file permission affects all other users on the system.

Note: To view the permissions we use:

ls -l

chown command is used to change the file Owner or group. Whenever you want to change ownership you can use chown command.

Syntax:

chown [OPTION]… [OWNER][:[GROUP]] FILE…

chown [OPTION]… –reference=RFILE FILE…

Example: To change owner of the file:

chown owner_name file_name

chown master file1.txt

where the master is another user in the system. Assume that if you are user named user1 and you want to change ownership to root (where your current directory is user1). use “sudo” before syntax.

sudo chown root file1.txt

chmod

This command is used to change the access permissions of files and directories.

Syntax:

chmod <permissions of user,group,others> {filename}

4 read permission

2 write permission

1 execute permission

0 no permission

lsof

While working in Linux/Unix system there might be several file and folder which are being used, some of them would be visible and some not. lsof command stands for List Of Open File. This command provides a list of files that are opened. Basically, it gives the information to find out the files which are opened by which process. With one go it lists out all open files in the output console.

Syntax:

$lsof [option][user name]

Options with Examples:

  • List all open files: This command lists out all the files that are opened by any process in the system.

~$ lsof

  • Here, you observe there are details of the opened files. ProcessId, the user associated with the process, FD(file descriptor), size of the file all together gives detailed information about the file opened by the command, process ID, user, its size, etc.

  • FDrepresents as File descriptor.
  • cwd: Current working directory.
  • txt: Text file.
  • mem: Memory file.
  • mmap: Memory-mapped device.

List all files opened by a user: There are several users of a system and each user has different requirements and accordingly they use files and devices. To find a list of files that are opened by a specific user this command is useful.

  • Syntax:

  • lsof -u username

Along with that we can see the type of file here and they are:

  • DIR: Directory
  • REG: Regular file
  • CHR: Character special file

ifconfig

ifconfig(interface configuration) command is used to configure the kernel-resident network interfaces. It is used at the boot time to set up the interfaces as necessary. After that, it is usually used when needed during debugging or when you need system tuning. Also, this command is used to assign the IP address and netmask to an interface or to enable or disable a given interface.

Syntax:

ifconfig [...OPTIONS] [INTERFACE]

Options:

  • -a : This option is used to display all the interfaces available, even if they are down.

Syntax:

ifconfig -a

-s : Display a short list, instead of details.

Syntax:

ifconfig -s

id

id command in Linux is used to find out user and group names and numeric ID’s (UID or group ID) of the current user or any other user in the server. This command is useful to find out the following information as listed below:

  • User name and real user id.
  • Find out the specific Users UID.
  • Show the UID and all groups associated with a user.
  • List out all the groups a user belongs to.
  • Display security context of the current user.

Syntax:

id [OPTION]… [USER]

Options:

  • -g: Print only the effective group id.
  • -G: Print all Group ID’s.
  • -n: Prints name instead of a number.
  • -r: Prints real ID instead of numbers.
  • -u: Prints only the effective user ID.
  • –help: Display help messages and exit.
  • –version: Display the version information and exit.

Note: Without any OPTION it prints every set of identified information i.e. numeric IDs.

Examples:

  • To print your own id without any Options:

id

The output shows the ID of current user UID and GID.

  • Find a specific users id: Now assume that we have a user named master, to find his UID we will use the command:

id -u master

  • Get a specific users GID: Again assuming to find GID of master, we will use the command:

id -g master

  • Know the UID and all groups associated with a username: In this case, we will use the user “master” to find UID and all groups associated with it, use the command:

id master

  • To find out all the groups a user belongs to: Displaying the UID and all groups a user “master” belongs to:

id -G master

cut

Cut command is used for extracting a portion of a file using columns and delimiters. If you want to list everything in a selected column, use the “-c” flag with cut command. For example, lets select the first two columns from our demo1.txt file.

cut -c1-2 demo1.txt

sed

Sed is a text-editor that can perform editing operations in a non-interactive way. The sed command gets its input from standard input or a file to perform the editing operation on a file. Sed is a very powerful utility and you can do a lot of file manipulations using sed. I will explain the important operation you might want to do with a text file.

If you want to replace a text in a file by searching it in a file, you can use the sed command with a substitute “s” flag to search for the specific pattern and change it.

For example, lets replace  “mikesh” in test.txt file to “Mukesh”

sed 's/mikesh/mukesh/' test.txt

diff

diff command is used to find the difference between two files. This command analyses the files and prints the lines which are not similar. Lets say we have two files test and test1. you can find the difference between the two files using the following command.

Syntax –

  diff test.txt test1.txt

history

history command is used to view the previously executed command. This feature was not available in the Bourne shell. Bash and Korn support this feature in which every command executed is treated as the event and is associated with an event number using which they can be recalled and changed if required. These commands are saved in a history file. In Bash shell history command shows the whole list of the command.

Syntax:

$ history

To show the limited number of commands that executed previously as follows:

$ history 10

dd

dd is a command-line utility for Unix and Unix-like operating systems whose primary purpose is to convert and copy files.

  • On Unix, device drivers for hardware (such as hard disk drives) and special device files (such as /dev/zero and /dev/random) appear in the file system just like normal files.
  • dd can also read and/or write from/to these files, provided that function is implemented in their respective drivers
  • As a result, dd can be used for tasks such as backing up the boot sector of a hard drive, and obtaining a fixed amount of random data.
  • The dd program can also perform conversions on the data as it is copied, including byte order swapping and conversion to and from the ASCII and EBCDIC text encodings.

Usage : The command line syntax of dd differs from many other Unix programs, in that it uses the syntax option=value for its command line options, rather than the more-standard -option value or –option=value formats. By default, dd reads from stdin and writes to stdout, but these can be changed by using the if (input file) and of (output file) options.

Some practical examples on dd command :

  1. To back up the entire hard disk :To backup an entire copy of a hard disk to another hard disk connected to the same system, execute the dd command as shown. In this dd command example, the UNIX device name of the source hard disk is /dev/hda, and device name of the target hard disk is /dev/hdb.

  2. # dd if = /dev/sda of = /dev/sdb
  • “if”represents input file, and “of” represents output file. So the exact copy of /dev/sda will be available in /dev/sdb.
  • If there are any errors, the above command will fail. If you give the parameter “conv=noerror”then it will continue to copy if there are read errors.
  • Input file and output file should be mentioned very carefully. Just in case, you mention source device in the target and vice versa, you might loss all your data.

 find

The find command in UNIX is a command-line utility for walking a file hierarchy. It can be used to find files and directories and perform subsequent operations on them. It supports searching by file, folder, name, creation date, modification date, owner and permissions. By using the ‘-exec’ other UNIX commands can be executed on files or folders found.

Syntax :

$ find [where to start searching from]

[expression determines what to find] [-options] [what to find]

Options :

  • -exec CMD:The file being searched which meets the above criteria and returns 0 for as its exit status for successful command execution.
  • -ok CMD :It works same as -exec except the user is prompted first.
  • -inum N :Search for files with inode number ‘N’.
  • -links N :Search for files with ‘N’ links.

free

In LINUX, there exists a command-line utility for this and that is free command which displays the total amount of free space available along with the amount of memory used and swap memory in the system, and also the buffers used by the kernel.

This is pretty much what free command does for you.
Syntax:

$free [OPTION]

OPTION: refers to the options compatible with free command.

As free displays the details of the memory-related to your system, its syntax doesn’t need any arguments to be passed but only options which you can use according to your wish.

Using free Command

You can use the free command as: $free

/*free command without any

option shows the used

and free space of swap

and physical memory in KB */

When no option is used then free command produces the columnar output as shown above where column:

  1. total displays the total installed memory (MemTotal and SwapTotal e present in /proc/meminfo).
  2. used displays the used memory.
  3. free displays the unused memory.
  4. shared displays the memory used by tmpfs(Shmen epresent in /proc/meminfo and displays zero in case not available).
  5. buffers displays the memory used by kernel buffers.
  6. cache displays the memory used by the page cache and slabs(Cached and Slab available in /proc/meminfo).
  7. buffers/cache displays the sum of buffers and cache.

Options for free command

  • -b, – -bytes :It displays the memory in bytes.
  • -k, – -kilo :It displays the amount of memory in kilobytes(default).
  • -m, – -mega :It displays the amount of memory in megabytes.
  • -g, – -giga :It displays the amount of memory in gigabytes

ssh-keygen

Use the ssh-keygen command to generate a public/private authentication key pair. Authentication keys allow a user to connect to a remote system without supplying a password. Keys must be generated for each user separately. If you generate key pairs as the root user, only the root can use the keys.

The following example creates the public and private parts of an RSA key:

ssh-keygen -t rsa

Use the –t option to specify the type of key to create. Possible values are “rsa1” for protocol version 1, and “dsa“, “ecdsa“, or “rsa” for protocol version 2.

You have the option of specifying a passphrase to encrypt the private part of the key. If you encrypt your personal key, you must supply the passphrase each time you use the key. This prevents an attacker, who has access to your private key and can impersonate you and access all the computers you have access to, from being able to do so. The attacker still needs to supply the passphrase.

ip

ip command in Linux is present in the net-tools which is used for performing several network administration tasks.This command is used to show or manipulate routing, devices, and tunnels. This command is used to perform several tasks like assigning an address to a network interface or configuring network interface parameters. It can perform several other tasks like configuring and modifying the default and static routing, setting up a tunnel over IP, listing IP addresses and property information, modifying the status of the interface, assigning, deleting and setting up IP addresses and routes.

Syntax:

ip [ OPTIONS ] OBJECT { COMMAND | help }

Options:

-address: This option is used to show all IP addresses associated with all network devices.

ip address

-link: It is used to display link-layer information, it will fetch characteristics of the link-layer devices currently available. Any networking device which has a driver loaded can be classified as an available device.

ip link

nslookup

Nslookup (stands for “Name Server Lookup”) is a useful command for getting information from DNS server. It is a network administration tool for querying the Domain Name System (DNS) to obtain domain name or IP address mapping or any other specific DNS record. It is also used to troubleshoot DNS related problems.

Syntax:

nslookup [option]

Options of nslookup command:

  • nslookup google.com:

    nslookup followed by the domain name will display the “A Record” (IP Address) of the domain. Use this command to find the address record for a domain. It queries to domain name servers and get the details.

curl

curl is a command-line tool to transfer data to or from a server, using any of the supported protocols (HTTP, FTP, IMAP, POP3, SCP, SFTP, SMTP, TFTP, TELNET, LDAP or FILE). This command is powered by Libcurl. This tool is preferred for automation since it is designed to work without user interaction. It can transfer multiple file at once.

Syntax:

curl [options] [URL...]

The most basic uses of curl is typing the command followed by the URL.

curl https://www.python.org

-o : saves the downloaded file on the local machine with the name provided in the parameters.

Syntax:

curl -o [file_name] [URL...]

Example:

curl -o hello.zip ftp://speedtest.tele2.net/1MB.zip

tr

The tr command in UNIX is a command-line utility for translating or deleting characters. It supports a range of transformations including uppercase to lowercase, squeezing repeating characters, deleting specific characters and basic find and replace. It can be used with UNIX pipes to support more complex translation. tr stands for translate.

Syntax:

$ tr [flag] SET1 [SET2]

Options

-c : complements the set of characters in string.i.e., operations apply to characters not in the given set
-d : delete characters in the first set from the output.
-s : replaces repeated characters listed in the set1 with single occurrence
-t : truncates set1

Sample Commands

  1. How to convert lower case to upper case
    To convert from lower case to upper case the predefined sets in tr can be used.

iptables

The iptables is a command-line interface used to set up and maintain tables for the Netfilter firewall for IPv4, included in the Linux kernel. The firewall matches packets with rules defined in these tables and then takes the specified action on a possible match.

  • Tables is the name for a set of chains.
  • Chain is a collection of rules.
  • Rule is a condition used to match packet.
  • Target is action taken when a possible rule matches. Examples of the target are ACCEPT, DROP, QUEUE.
  • Policy is the default action taken in case of no match with the inbuilt chains and can be ACCEPT or DROP.

Syntax:

iptables --table TABLE -A/-C/-D... CHAIN rule --jump Target

apt-get

apt-get is a command-line tool that helps in handling packages in Linux. Its main task is to retrieve the information and packages from the authenticated sources for installation, upgrade and removal of packages along with their dependencies. Here APT stands for the Advanced Packaging Tool.

syntax:

apt-get [options] command

update: This command is used to synchronize the package index files from their sources again. You need to perform an update before you upgrade.

apt-get update

df,du

The df (disk free) command reports the amount of available disk space being used by file systems. The du (disk usage) command reports the sizes of directory trees inclusive of all of their contents and the sizes of individual files.

The aim is to make sure you are not overshooting the 80% threshold. If you exceed the threshold it’s time to scale or clean-up the mess, because running out of resources you have the change your application show some fickle behavior.

To check in a human-readable format:

$ sudo df -h

But in most cases, you want to check which part of your system is consuming lots of disk space. Use the following command:

$ sudo du -h -d 1 /var/

htop

htop command in the Linux system is a command-line utility that allows the user to interactively monitor the system’s vital resources or server’s processes in real-time. This is a newer program compared to top command, and it offers many improvements over top command. It supports mouse operation, uses color in its output and gives visual indications about processor, memory and swap usage. htop also prints full command lines for processes and allows one to scroll both vertically and horizontally for processes and command lines respectively.

syntax –

htop <flag>

  • -d –delay :Used to show the delay between updates, in tenths of seconds.
  • -C –no-color –no-colour : Start htop in monochrome mode.
  • -h –help :Used to display the help message and exit.
  • -u –user=USERNAME :Used to show only the processes of a given user.

ps

Every process in Linux has a unique ID and can be seen using the command ps.

  • $ sudo ps aux
  • a = show processes for all users
  • u = display the process’s user/owner
  • x = also show processes not attached to a terminal

kill

kill command in Linux (located in /bin/kill), is a built-in command which is used to terminate processes manually. This command sends a signal to a process that terminates the process. If the user doesn’t specify any signal which is to be sent along with kill command then default TERM signal is sent that terminates the process.

kill -l :To display all the available signals you can use below command option:

Syntax:$kill -l

  • Negative PID values are used to indicate the process group ID. If you pass a process group ID then all the processes within that group will receive the signal.
  • A PID of -1 is very special as it indicates all the processes except kill and init, which is the parent process of all processes on the system.
  • To display a list of running processes use the command ps and this will show you running processes with their PID number. To specify which process should receive the kill signal we need to provide the PID.

Syntax:

$ps

 kill pid: To show how to use a PID with the kill command.

Syntax:

$kill pid

telnet

Telnet helps to –

  • connect to a remote Linux computer
  • run programs remotely and conduct administration

Syntax

  • telnet hostname=”” or=””
  • Example:
  • telnet localhost

Shell Scripting

What is Shell?

An Operating system contains many components, but its two prime components are the Kernel and the Shell.

You can consider a Kernel as a nucleus of a computer. It makes communication between the hardware and software possible. The Kernel is the innermost part of an operating system whereas a shell is the outermost one.

A shell in a Linux operating system takes input from the user in the form of commands, processes it, and then gives an output. It acts as an interface through which a user works on the programs, commands, and scripts. A terminal accesses the shell and also runs the commands.

When the terminal is run, the Shell issues a command prompt(usually $)where it is possible to type your input, after which the terminal executes it when you hit the Enter key. The terminal then displays the output of your commands.

The Shell wraps as a covering around the delicate interior of an Operating system protecting it from accidental damage. Hence the name is Shell.

There are two main shells in Linux:

  1. The Bourne Shell: The prompt for this shell is $ and its derivatives are as follows:
  • POSIX shell also is known as sh
  • Korn Shell also knew as sh
  • Bourne Again SHell is also known as bash (most popular)

2.The C shell: % denotes the prompt for this shell and its subcategories are as follows:

  • C shell also is known as csh
  • Tops C shell is also known as tcsh

What is Shell Scripting?

Shell scripting is writing a series of commands for the shell that can be executed. It can combine both lengthy and repetitive sequences of commands into a single and simple script. You can store this script and execute it whenever you want. This significantly reduces the effort required by the end-user.

Following are the steps to create a Shell Script –

  • Create a file using a text editor such as the vi or any other editor. Name script file with extension .sh
  • Start the script with #! /bin/sh
  • Write some code.
  • Save the script file as filename.sh
  • For executing the script type bash filename.sh

“#!” is an operator called shebang that points the script to the interpreter location. So, if we use”#! /bin/sh” the script points to the bourne-shell.

We will now create a file using an editor like vi and save it with .sh extension. Copy the following program that adds and prints the sum of digits of a number entered by the user. Then run this program using the command bash filename.sh.

#!/bin/sh

echo "Enter a number"
read Num
g=$Num

# store the sum of
# digits
s=0

# use while loop to
# caclulate the sum
# of all digits
while [ $Num -gt 0 ]
do
# get Remainder
k=$(( $Num % 10 ))

# get next digit
Num=$(( $Num / 10 ))

# calculate sum of
# digit
s=$(( $s + $k ))

done
echo "sum of digits of $g is : $s"

Git Commands

What is Git?

Git is a free, open-source distributed version control system. This tool handles everything from small to very large projects with speed and efficiency. Linus Torvalds created it in 2005 to develop the Linux Kernel. Git has the functionality, performance, security, and flexibility that most teams and individual developers need.

Tools like Git enable communication between the development and the operations team. When you are developing a large project with a huge number of collaborators, it is very important to have communication between the collaborators while making changes in the project. Commit messages in Git plays a very important role in communicating among the team. The bits and pieces that we all deploy lie in the Version Control system like Git. To succeed in DevOps, you need to have all of the communication in Version Control. Hence, Git plays a vital role in succeeding at DevOps.

Git Commands

git init

Usage: git init [repository name]

This command creates a new repository.

git config

Usage: git config --global user.name “[name]”

Usage: git config --global user.email “[email address]”

This command sets the author name and email address respectively. This is useful information with the commits.

git clone

Usage: git clone [url]

This command lets you get a copy of a repository from an existing URL.

git add

Usage: git add [file]

This command adds a file to the staging area.

Usage: git add *

This command adds one or more to the staging area.

git commit

Usage: git commit -m “[ Type in the commit message]”

This command records or snapshots the file permanently in the version history.

Usage: git commit -a

This command commits any files you’ve added with the git add command and also commits any files you’ve changed since then.

git status

Usage: git status

The git status command displays the state of the working directory and the staging area.This command lets you see the changes that are in the staging, those that are not staged and are not tracked by Git.

git show

Usage: git show [commit]

This command shows the metadata and content changes of the specified commit.

git rm

Usage: git rm [file]

This command deletes the file from your working directory and stages the deletion.

git remote

Usage: git remote add [variable name] [Remote Server Link]

This command connects your local repository to the remote server.

git push

Usage: git push [variable name] master

This command sends the committed changes of the master branch to your remote repository.

Usage: git push [variable name] [branch]

This command sends the branch commits to your remote repository.

Usage: git push –all [variable name]

This command pushes all branches to your remote repository.

Usage: git push [variable name] :[branch name]

This command deletes a branch on your remote repository.

git pull

Usage: git pull [Repository Link]

This command fetches and merges changes on the remote server to your working directory.

git branch

Usage: git branch

This command lists all the local branches in the current repository.

Usage: git branch [branch name]

This command creates a new branch.

Usage: git branch -d [branch name]

This command deletes the feature branch.

git checkout

Usage: git checkout [branch name]

This command lets you switch from one branch to another.

Usage: git checkout -b [branch name]

This command creates a new branch and also switches to it.

git merge

Usage: git merge [branch name]

This command merges the specified branch’s history into the current branch.

git rebase

Usage: git rebase [branch name]

git rebase master – This command will move all our work from the current branch to the master.

With this, We have come to the end of the blog on Linux commands in DevOps. I have tried to cover as many commands as possible here. This blog will definitely help you kick-start your journey with DevOps.

Now that you have understood what are the Linux commands in DevOps, check out this DevOps training by Edureka, a trusted online learning company with a network of more than 250,000 satisfied learners spread across the globe. The Edureka DevOps Certification Training course helps learners to understand what is DevOps and gain expertise in various DevOps processes and tools such as Puppet, Jenkins, Nagios, Ansible, Chef, Saltstack and GIT for automating multiple steps in SDLC.

Got a question for us? Please mention it in the comments section and we will get back to you

How To Rename a Column Name in SQL?

$
0
0

It may often happen that, we see a requirement to change the name of the column in the database to serve their purpose. With the help of SQL or Structured Query Language, the Database Administrators store, update, manipulate and retrieve data in relational databases. So, in this article let us understand how to rename a column name in SQL.

The following topics will be covered in this article:

    1. What is SQL?
    2. What is RENAME command in SQL?
    3. Rename column name in MySQL, MariaDB, Oracle and PostgreSQL
    4. Rename column  name in MS SQL Server
    5. Rename table name  MySQL, MariaDB, Oracle

So let us get started then,

What is SQL?

SQL or most commonly known as SEQUEL is a Structured Query Language used for managing and accessing the databases. It is based on the English language and is designed in a way to easily retrieve, manipulate and access the data. If you wish to know more about the basics of SQL in-depth, you can refer to the article on SQL Basics. In SQL, there are various statements/ commands used to manipulate data. One such manipulation, which is quite popular in databases is renaming the column name in SQL. 

So, let us understand how to use the RENAME command in SQL.

What is RENAME command in SQL?

This command is used to change the name of a column to a new column name. It is also used to change the table to a new table name. Let us understand how to use this command in different databases. But, before that, let us consider the following table to understand all the examples:

BID BName Genre Price

1

Trick Mirror

Psychology 

200

2

Daisy Jones

Mystery

350

3

Lady in the lake

Mystery

250

4

Miracle Creek

Thriller

450

5

Disappearing Earth 

Drama

300

Rename column name in SQL

Rename column name in MySQL, MariaDB, Oracle, and PostgreSQL

To rename a column name in MySQL, MariaDB, Oracle, and PostgreSQL, you can follow the below syntax:

Syntax

ALTER TABLE TableName
RENAME COLUMN OldColumnName TO NewColumnName;

Example:

Write a query to rename the column name “BID” to “BooksID”.

ALTER TABLE Books;
RENAME COLUMN BID TO BooksID;

On executing the above query, you will see the following output:

Output:

BooksID BName Genre Price

1

Trick Mirror

Psychology 

200

2

Daisy Jones

Mystery

350

3

Lady in the lake

Mystery

250

4

Miracle Creek

Thriller

450

5

Disappearing Earth 

Drama

300

You can also use the CHANGE keyword to rename a column name as follows:

Syntax

ALTER TABLE TableName
CHANGE COLUMN OldColumnName NewColumnName Data Type;

Example:

Write a query to rename the column name “BID” to “BooksID”.

ALTER TABLE Books;
CHANGE COLUMN BID BooksID INT;

On executing this query, you will see the output the same as the above output.

Rename column name in MS SQL Server

The process of renaming column name is MS SQL Server is different when compared to the other databases. In MS SQL Server, you have to use the stored procedure called sp_rename.

Syntax

sp_rename 'TableName.OldColumnName', 'New ColumnName', 'COLUMN';

Example:

Write a query to rename the column name “BID” to “BooksID”.

sp_rename 'Books.BID', 'BooksID', 'COLUMN';

The resulting output will be the same as that for the above queries. Now, that you have understood how to rename a column name in various databases, let us see how you can rename a table name.

Rename table name MySQL, MariaDB, Oracle

To rename a table name, you can use the RENAME command in SQL, in the following manner:

Syntax:

ALTER TABLE OldTableName
RENAME TO NewTableName;

Example:

ALTER TABLE Books
RENAME TO ListOfBooks;

Now, if you execute the below query to see the details in the table  ListOfBooks, you will see the following output:

Query:

SELECT * FROM ListOfBooks;
BooksID BName Genre Price

1

Tricky Mirror

Psychology 

200

2

Daisy Jones

Mystery

350

3

Lady in the lake

Mystery

250

4

Miracle Creek

Thriller

450

5

Disappearing Earth 

Drama

300

With that, we come to an end to this article on Rename column name in SQL. I hope you found this article informative. I hope you understood how to use the above commands. If you wish to learn more about MySQL and get to know this open-source relational database, then check out our MySQL DBA Certification Training which comes with instructor-led live training and real-life project experience. This training will help you understand MySQL in-depth and help you achieve mastery over the subject.

Got a question for us? Please mention it in the comments section of this article on “Rename column name in SQL” and I will get back to you.

Learn How To Use Java Command Line Arguments With Examples

$
0
0

Java programming language is versatile in every aspect, being platform-independent it makes Java a clear cut winner for any developer. The execution of any Java program is hustle-free and precise. We can even pass arguments during execution of a program using the command-line arguments. In this article, you will learn how you could use command-line arguments in Java. Following are the topics discussed in this blog:

What Are Command Line Arguments?

The command-line arguments are passed to the program at run-time. Passing command-line arguments in a Java program is quite easy. They are stored as strings in the String array passed to the args parameter of main() method in Java.

class Example0{
public static void main(String[] args){
System.out.println("edureka" + args[0]);
}
}

Output:

To compile and run a java program in command prompt follow the steps written below.

  • Save your program in a file with a .java extension

  • open the command prompt and go to the directory where your file is saved.

  • Run the command – javac filename.java

  • After the compilation run the command – java filename

  • Make sure the Java path is set correctly.

Java Command Line Arguments Example

Here are a few examples to show how we can use the command-line arguments in a Java program.

The beauty relies on the parseInt method in the Integer class. Every Number classes such as Integer, Float, Double and so on have parseXXX methods that convert String into the respective object of their type.

As we all know that array starts its index with zero. Therefore args[0] is the first index in this String[] array which is taken from the console. Similarly, args[1] is second, args[2] is the third element and so on.

When an application is launched, the run-time system passes the command-line arguments to the application’s main method via an array of Strings

Factorial of a number using command-line arguments

class Example1{
public static void main(String[] args){
int a , b = 1;
int n = Integer.parseInt(args[0]);
for(a = 1; a<= n ; a++)
{ 
b = b*a;
}
System.out.println("factorial is" +b);
}
}

Output:

Sum of two numbers using command-line arguments

class Example2{
public static void main(String[] args){
int a = Integer.parseInt(args[0]);
int b = Integer.parseInt(args[1]);
int sum = a + b;
System.out.println("The sum is" +sum);
}
}

Output:

Fibonacci Series program using command-line arguments

class Example3{
public static void main(String[] args){
int n = Integer.parseInt(args[0]);
int t1 = 0;
int t2 = 1;

for(int i = 1; i <=n; i++){
System.out.println(t1);
int sum = t1+t2;
t1 = t2;
t2 = sum;
}
}
}

Output:

Important Points To Remember

  • While launching your application, you can use the command-line arguments to specify the configuration information.

  • When you are using command-line arguments, there is no limitation on the number of arguments. You can use as many as per your requirement.

  • Information in the command-line arguments is passed as Strings.

  • The command-line arguments are stored in the String args of the main() method of the program.

This brings us to the end of this article where we have learned about the Java command line arguments with examples. I hope you are clear with all that has been shared with you in this tutorial.

If you found this article on “Java Command Line Arguments” relevant, check out the Edureka Java Certification Training, a trusted online learning company with a network of more than 250,000 satisfied learners spread across the globe. 

We are here to help you with every step on your journey and come up with a curriculum that is designed for students and professionals who want to be a Java Developer. The course is designed to give you a head start into Java programming and train you for both core and advanced Java concepts along with various Java frameworks like Hibernate & Spring.

If you come across any questions, feel free to ask all your questions in the comments section of “Java Command Line Arguments” and our team will be glad to answer.

How to create a Pareto Chart in Tableau?

$
0
0

A Pareto Chart is a dual-axis combination chart. It is a chart in Tableau used to highlight dimension members that are having the biggest impact to the measure in question. It is named after Vilfredo Pareto. It is one of the more crucial things you learn in any Tableau Certification Training.

So, let me take you through the steps to build a Pareto Chart in Tableau.

Let’s begin.

What is a Pareto Chart?

A Pareto chart is a dual-axis combination chart in Tableau. On its primary axis, bars are used to show the basic raw quantities for each dimension, usually sorted in descending order and on the secondary axis, a line graph is used to show the cumulative total in a percentage format. Now, while this chart type serves a variety of purposes, it is most known for being a part of the seven basic tools of quality control. So, it is traditionally used to identify the biggest opportunities for improvement.

I’m going to be sticking with a quality control scenario. This article will use the Sample Superstore which is already available on the Tableau Desktop. We shall use this data set to look at which product sub-categories contribute the most returned items. The final chart will look like the following image;

First of all, this tutorial requires taking two additional steps to prepare the data.

1. Left join the Returns table to the Orders table

In this step, you need to right-click on the Sample Superstore data connection and choose Edit data source. A new interface will appear.

Now you can drag the Returns table next to the Orders table and set up a left join on Order ID.

2. Create a calculated field to count the number of returns

The formula to use for this calculation is the following;

COUNT([Returns] = “Yes”)

Now, we are all set to build out the Pareto Chart.

3. Building the Pareto Chart

  • First, you must create a bar chart that looks at the number of returns per Product Sub-Category and sort it in descending order. You shall have the following result on your screen.

  • Secondly, go ahead and create a dual-axis combination chart by dragging the Returns measure from the Measure Shelf to the right axis. Change the mark type on the primary axis back to bar and the secondary axis to line. At this point, the viz will look something like the following;

  • Now the step that makes a Pareto Chart a Pareto Chart. Adding a table calculation and a secondary table calculation to this Returns pill. This shall display the cumulative percent of returns across product sub-categories.

  • To add the first table calculation, click on the second Returns pill, hover over Quick table calculation, and choose Running total. With the table calculation for running total, you can add a second table calculation on the result. This is how we can calculate the raw running total number at each product sub-category, then add a secondary calculation to determine the cumulative percent of total.

  • For addition of a secondary table calculation, click the second Returns pill again, select the option Edit table calculation and check the box at the bottom of the interface named Add Secondary Calculation. Change the Secondary Calculation Type to Percent of Total. This will display the cumulative percent of total.

After changing the axis tick marks for a cleaner look, you will be left with the following viz;

This Pareto Chart in Tableau can now be used for drawing insights such as, “The business’ three most returned product sub-categories are causing about 40% of the total returns.” Pareto Charts are usually an effective way to quickly highlight potential for improvement and give enterprises a scale for how urgently a quality control problem should be treated.

Hope you enjoyed this article. Cheers!

If you wish to master Tableau, Edureka has a curated course on Tableau Training & Certification which covers various concepts of data visualization in depth, including conditional formatting, scripting, linking charts, dashboard integration, Tableau integration with R and more. It comes with 24*7 support to guide you throughout your learning period. New batches are starting soon.

Got a question for us? Please mention it in the comments section and we will get back to you at the earliest.

How to Implement and Play with Strings in Python

$
0
0

When we play strings in Python programming language, we refer to a set of characters stored contiguously in memory, on which we can operate to manipulate the set of characters e.g. get a character at an index, replace a set of characters, convert from upper case to lower case and vice versa, etc.

  • What are strings in Python?
  • How to use strings, indexing, and slicing?
  • Splitting and concatenating strings
  • Operations on string in Python

 

What are strings in Python?

Strings in Python are instances of class <’str’>. This is an inbuilt class with many helper functions to operate on strings. Strings are immutable i.e. a string in Python cannot be modified once created. If you modify a string, it creates a new string in memory to store the modified string.

Find out the type of a literal string: Function type() returns type of a variable in python

s1 = "Hello There!"
print(type(s1))

Output:

<class ‘str’>

 

How to use strings, indexing, and slicing?

Different ways of initializing strings:

# Single quotes
str1 = 'Hi, Let us learn strings in Python'
print(str1)
# Double quotes
str1 = "Hi, Let us learn strings in Python"
print(str1)
 
# Single quotes within double, no need to escape them or match them
str1 = "Hello there, How's your friend? "
 
# Double quotes within single, no need to escape them or match them
str1 = 'Hello there, How is your friend "K"?'
str2 = 'Hello there, "How is your friend K?'
print(str1)
print(str2)
 
# triple quotes are multiline strings
str1 = '''Hello, welcome to
           strings in Python'''
print(str1)
 
str1 = """Hello, welcome to
           strings in Python"""
print(str1)

Output:

Hi, Let us learn strings in Python

Hi, Let us learn strings in Python

Hello there, How is your friend "K"?

Hello there, "How is your friend K?

Hello, welcome to

           strings in Python

Hello, welcome to

           strings in Python

 

Indexing and Slicing

  • Indexing is used to point to a single character in a string 

  • Splicing can be used to pick substring or a sequence of characters according to splice rules

  • Indexing uses notation: str[index] where index is a number from 0 to len(str) – 1

  • Slicing uses notation: str[start : stop : step]

    • start: the beginning index of the slice, it will include the element at this index unless it is the same as stop, defaults to 0, i.e. the first index. If it’s negative, it means to start n items from the end.

    • stop: the ending index of the slice, it does not include the element at this index, defaults to the length of the sequence being sliced, that is, up to and including the end.

    • step: the amount by which the index increases, defaults to 1. If it’s negative, you’re slicing over the iterable in reverse.

  • Slicing works over a list as well or for that matter any sequence. In this blog, we are looking at strings alone.

Examples of Indexing and Slicing:

str1 = 'India, a nation of billion people'
print('str1: ', str1)
 
# print first character
print('Index 0: ', str1[0])
 
# print last character
print('Index -1: ', str1[-1])
 
# Slicing syntax [start : end : step]
# Slicing from 2nd to 4th character
print('Slice [1:5] = ', str1[1:5])
 
# Slicing 1st to 2nd last character
print('Slice [0:-2] = ', str1[0:-2])
 
# Splice a string to get characters at even index
print("Even index: ", str1[::2])
 
# Splice a string to get characters at odd index
print("Odd index: ", str1[1::2])
 
# Shortcut slicing to reverse a string
print('Reverse using slicing: ', str1[::-1])

Output:

str1:  India, a nation of billion people

Index 0:  I

Index -1:  e

Slice [1:5] =  ndia

Slice [0:-2] =  India, a nation of billion peop

Even index:  Ida aino ilo epe

Odd index:  ni,anto fblinpol

Reverse using slicing:  elpoep noillib fo noitan a ,aidnI

 

Splitting and Concatenating Strings

  • Splitting Strings

Let us directly look into an example to understand how to split a sentence into words:

str1 = "This is the string we will split into a list of words"
# By default, split function splits on space 
list_of_words = str1.split()
print(list_of_words)

Output:

['This', 'is', 'the', 'string', 'we', 'will', 'split', 'into', 'a', 'list', 'of', 'words']

 

Now, let us split on a delimiter, let’s say a comma:

str1 = "Literature, most generically, is any body of written works"
# Let us split on comma 
my_list = str1.split(',')
print(my_list)

Output:

['Literature', ' most generically', ' is any body of written works']

 

  • Concatenating Strings

One of the simplest approaches is to use ‘+’ operator which can concatenate two strings:

str1 = 'Python'
str2 = 'Is Fun'
# Concatenate two strings
print(str1 + str2)
# More readable, concatenate 3 strings, str1, a space ' ' and str3
print(str1 + ' ' + str2)

Output:

PythonIs Fun

Python Is Fun

 

Few rules on concatenation:

  • Concatenation works only on ‘str’ objects
  • If objects of other types are included, Python will throw error.
  • Unlike other languages, Python will not automatically typecast other types to string
  • Python requires explicit typecast to string using str() function

 

Below code fails:

str1 = 'Python'
str2 = ' Is Fun'
str3 = ' Percent'
print(str1 + str2 + 100 + str3)

Output:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-32-0bf25e403437> in <module>
      2 str2 = 'Is Fun'
      3 str3 = 'Percent'
----> 4 print(str1 + str2 + 100 + str3)

TypeError: must be str, not int

Fix it by explicitly converting integer 100 to string:

str1 = 'Python'
str2 = ' Is Fun'
str3 = ' Percent'
print(str1 + str2 + str(100) + str3)

Output:

Python Is Fun 100 Percent

Concatenating a list of strings

We can concatenate strings using a list of strings easily

  • join() function is available on any object of type ‘str’
  • join() accepts a list of strings only, if it contains non-string items, python will throw an error
list_of_words = ['This', 'is', 'the', 'string', 'we', 'will', 'split', 'into', 'a', 'list', 'of', 'words']
# Start with empty string and use join function which is available on objects of type 'str' 
sentence = "".join(list_of_words)
print(sentence)
# Use a string with one space this time
sentence = " ".join(list_of_words)
print(sentence)
# Use a string with one hyphen/dash this time
sentence = "-".join(list_of_words)
print(sentence)
# You can observe that the string on which we call join is used to join the items in 'list_of_words'

Output:

Thisisthestringwewillsplitintoalistofwords
This is the string we will split into a list of words
This-is-the-string-we-will-split-into-a-list-of-words

 

Operations on String in Python

Python ‘str’ type has a lot of inbuilt functions

  • str.upper()
  • str.lower()
  • str.find()
  • str.replace()
  • str.split()
  • str.join()
  • Many more

We have already seen str.join() and str.split() functions in last section. We will understand rest of the functions listed above.

# convert to upper case
print("python".upper())
# convert to lower case
print("PYTHON".lower())
# find index of 'th'
print('Python'.find('th'))
# replace substring '0' with '100'
print('Python Is Fun 0 Percent'.replace('0','100'))

Output:

PYTHON

python

2

Python Is Fun 100 Percent

 

With this, we come to an end of this strings in python blog. I hope all your doubts about strings in Python is clear now.

To get in-depth knowledge on Python along with its various applications, you can enroll for live Python online training with 24/7 support and lifetime access. 


Everything you Need to Know About PHPStorm

$
0
0

Whenever we want to write a large application, large website or software we use an IDE or an Editor program for doing this job. Technically it is possible to write the whole website or a complete software into notepad file but practically it is almost impossible and time-consuming because and it’s quite hectic. So we need a complete set of environment, programs for doing this job and the answer is IDE. One, in particular, we are going to discuss today is PHPStorm:

 

What is an IDE?

Now we understand the problem with writing large web application with a text editor. Let’s take the next move, the IDE stands for integrated development environment this is a complete package of software provide various type of tools for writing, testing and debugging our application and many more. The IDE is designed to simplifying the code and minify the programming bugs. This combined tools collections are created to smooth the software development process and can recognize and decrease coding mistakes and typos.

There are also some IDE’s are open source and some are commercial this means you need to pay to use that IDE. Let’s take some example of ideals that are available in market some of them are quite popular for example, Xcode is an IDE to develop the Mac OS and IOS platform applications whether it is mobile application, desktop application or Apple watch application another example is Android studio the Android studio is used for developing Android applications these two are very popular IDE.

 

What is PhpStorm?

Let’s talk about the PhpStorm, well PhpStorm is an IDE that is designed to handle big PHP projects it supports all the type of PHP related tools also debugging and testing tools. So this it is specially designed for PHP language, the developers who want to make web apps and PHP related projects they really like to work with PHP storm. PhpStorm is a monetary, portable platform IDE for PHP, built by the Czech Republic-based company JetBrains.

Java language is used for writing PhpStorm. We can increase the IDE functionality by connecting plugins created for PhpStorm or we can write our own plugins. The IDE also connects with external sources like XDebug. It includes a full-fledged SQL editor with editable query results. PhpStorm can handle multiple frameworks code like Symfony, Zend Framework, Drupal, CakePHP, Magento, WordPress, Joomla, Laravel, Yii, and many more.

 

An overview of modules in PhpStorm

  • Intelligent Coding Assistance

When we write code this provides an autocomplete feature by which whenever we type or write any function, class, variable, etc. it autocompletes and gives us a nice drop-down list of all related models. Let’s take a simple example is_array() is a function that checks whether the given value or given data is an array or not. So when we write this function is_array() in PhpStorm it shows what parameter you need to pass in this function also you can observe the definition of this function in the library.

 

  • Smart Code Navigation

Let’s first discuss the problem navigate from one code block to another code block and for one code file to another code file. We need to switch to the multiple files in text editor and we need to find out in which file we write the actual code that we want to use in another class or another file but this problem is not happening in the case of PhpStorm because it gives us a nice search tool where we find out what particular code be right in what particular file.

Also to switch between multiple files when we click on the keyboard shift key double times it opens a panel where it shows all the modules open and recently open files.

 

  • Fast and Safe Refactoring

Fast and safe refactoring whenever we want to reset our code, for example in some cases we need an inline variable, rename, transfer, remove, extract method, push members to code up and pull members code down, change function signature and many other changes.

The PhpStorm gives us a very fine way to reflect our code. It also shows us whenever we want to refactor our code, it gives us information about, in which file that code will be reflected or what changes are made.

 

  • Easy Debugging and Testing

Now let’s talk about debugging and testing, well I think that text editor is a very hard way to test and debug our or in most cases, it doesn’t for this type of functionality but PhpStorm gives us a very nice debugging and testing tools.

PhpStorm has a visual debugger that needs no configuration and provides excellent functionality, this will track what things happening on each step that uses x debug and send to the debugger and we want the unit testing it gives us PHP unit and BDD.

 

  • Built-in developer and frontend tools

PhpStorm gives us built-in developer tools for handling the application to track source code change, integration, SQL query and database handle, remote deployment, terminal commands tools, Docker, Composer, API Client, and some other tools and frontend tools like such as HTML.

For styling Sass, CSS, Stylus, and Less. For scripting Coffee Script, JavaScript, Emmet, and Typescript with refactoring, debugging, and unit testing.

 

Creating a simple PHP application in PhpStorm

Now let’s create a simple HTML form and the form is handled by our PHP code. We need to create two files one is the submit.php file, that file is responsible for form handling and another one is normal HTML form file index.html. The form contains three fields first, last, email and one submit button when a user clicks on submit button the form submitted on the submit.php and the submit.php file executes the code. Finally, it prints all three form fields value.

index.html


<html>
<head>
<title>Register User</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<h2>Register User:</h2>
<!-- we created a form with method post and action is our php file(submit.php) -->
<form action="submit.php" method="POST">

<!-- each field we pass the name property because our PHP code grab the filed value with the 'name' of the field -->
User First name: <input type="text" name="first"> <br>
User Last name: <input type="text" name="last"> <br>
Email id: <input type="email" name="email"> <br>
<input type="submit" name="form_submit" value="Submit">
</form>
</body>
</html>

submit.php


<?php
if(isset($_POST['form_submit'])){

// get values from form
$first = $_POST['first'];
$last = $_POST['last'];
$email = $_POST['email'];

// print all three value when user clicks on submit
echo $first;
echo $last;
echo $email;
}
?>

With this, we come to an end of this PhpStprm article. I hope you got an idea of the IDE and hope you will start coding ASAP.

If you found this PHPStorm Tutorial blog relevant, check out the PHP Certification Training by Edureka, a trusted online learning company with a network of more than 250,000 satisfied learners spread across the globe.

Got a question for us? Please mention it in the comments section of ”PHPStorm Tutorial” and I will get back to you.

How to Implement Form Validation in Angular JS?

$
0
0

Validation is a method to authenticate the user. It is used in all the Web Technologies like HTML and JavaScript. But today our focus will be on Validation in Angular JS in the following order:

 

What is Form validation?

Form validation is a technique by which we can validate the HTML form. Let’s take a simple example to suppose a user has an HTML form and that HTML form has different fields, these field is validated by form validator when we want to validate the form we just need to check the value of the particular field with the validator expression.

If regular expression and the field value are the same then we can say our form is validated. In the HTML form, there are different types of validations like email, required, min, max, password, etc.

 

Form Validation in Angular JS

Let’s talk about how we can validate a form in angular JS. Angular JS provides various type of form validation properties that we can use to validate the form or get the data from the form.

  • $valid: This property tells whether the field is valid or not by applying the appropriate rule on that.

  • $invalid: As the name says invalid this tiles weather the field is invalid or not based on appropriate rule on that.

  • $pristine: It will return true in the form input field is not used.

  • $dirty: It will return true in the form input field is used.

  • $touched: BooleanTrue if the input has been blurred.

 

To access the form: <form name>.<angular property>

To access an input: <form name>.<input name>.<angular property>

Now let’s explain the form validation in angular JS with an example so firstly we make two files, one is app.js and another is index.html. Our index.htm file contains a simple HTML form that has the angular validation and our app.js file contains the backend code to handle the form validation on the index.html page.

The index.html page contents form with novalidate property and what that means exactly?

The novalidate property in the form tag tells the HTML that we can use our custom form validation. If we don’t give the novalidate property then and the HTML form validates by using HTML5 default form validation properties.

 

Steps in Form Validation

In our form, we created 6 fields in our form these are first name, last name, email, phone, password, and message. 

  1. First, we add the required field validator, this validator tells the users that a specific field is required.

  2. Next is the email field if a user doesn’t give any valid email then our email validator throws an email validation error.

  3. We set the minimum and the maximum length in our password validation the minimum length is 5 and the maximum length is 8 so the user can give a valid password between 5 to 8 characters.

  4. Finally, we set the phone and the message fields required and specifically, apply number validation on phone filed.

 

 

Code for Form Validation in Angular JS

index.html

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Angular scope example</title>
</head>
<body ng-app="ngValidApp">

<div ng-controller="ngValidController">

<form name="chkValidation" novalidate>
<label>First Name</label>
<input type="text" placeholder="Enter first name" name="firstName" ng-model="firstName" ng-required="true"><br>
<p style = "color:red" ng-show = "chkValidation.firstName.$error.required">This filed is required</p>

<label>Last Name</label>
<input type="text" placeholder="Enter last name" name="lastName" ng-model="lastName" ng-required="true"><br>
<p style = "color:red" ng-show = "chkValidation.lastName.$error.required">This filed is required</p>

<label>Email</label>
<input type="email" placeholder="Enter email" name="email" ng-model="email" ng-required="true"><br>
<p style = "color:red" ng-show = "chkValidation.email.$error.required">This filed is required</p>
<p style = "color:red" ng-show = "chkValidation.email.$error.email">Not a valid email</p>

<label>Phone</label>
<input type="text" required placeholder="Enter phone" name="phone" ng-model="phone" ng-required="true" ng-pattern="/^(+d{1,2}s)?(?d{3})?[s.-]?d{3}[s.-]?d{4}$/"><br>
<p style = "color:red" ng-show = "chkValidation.phone.$error.required">This filed is required</p>
<p style = "color:red" ng-show="chkValidation.phone.$error.pattern">This is not a valid phone</p>

<label>Password</label>
<input placeholder="******" type="password" name="password" ng-model="password" ng-required="true" ng-minlength="5" ng-maxlength="8"><br>
<p style = "color:red" ng-show = "chkValidation.password.$error.required">This filed is required</p>
<p style = "color:red" ng-show = "(!chkValidation.password.$valid)">Password between 5 to 8 characters</p>

<label>Message</label>
<textarea required placeholder="Enter your message" name="message" ng-model="message" ng-required="true"></textarea><br>
<p style = "color:red" ng-show = "chkValidation.message.$error.required">This filed is required</p>

<button type="submit">Submit</button>
</form>

</div>

<!--angular js library-->
<script src="assets/js/angular.js"></script>
<script src="app.js"></script>
</body>
</html>

 

app.js

var app = angular.module('ngValidApp', []);

app.controller('ngValidController', function($scope) {

});

 

Let’s talk about some validation directive used in the form:

  • ng-required: For providing the required field
  • ng-show: To show the error message based on the condition(check the validation properties)
  • ng-minlength: For providing minimum length
  • ng-maxlength: For providing the maximum length
  • ng-pattern: To match a specific pattern
  • ng-model: Binds the field with validation properties like $error, $valid, etc.

 

With this, we come to an end of this Validation in Angular JS article. I hope you got an understanding of the various things to be considered for form Validation in Angular JS.

If you wish to learn more about Angular framework, then check out our Angular Training & Certification which comes with instructor-led live training and real-life project experience. This training will help you understand Angular in-depth and help you achieve mastery over the subject.

Got a question for us? Please mention it in the comments section of this article and We will get back to you.

How to Read and Write Excel file in Java

$
0
0

Reading and Writing files in java is a very basic thing that every programmer needs to know. In this article, we will focus on how to read and write Excel and CSV files in java. Following pointers will be covered in this article,

Moving on with this article on Read and write Excel and CSV file in Java

 

Introduction

Let’s talk about the reading and writing file in JAVA. Let’s take a simple scenario where we want to write a file in JAVA. Suppose we have a simple text file and we want to write some data into that text file so how can a Java program write this data into the file.
1. First, we open the text file in our Java program in writing mode because we want to write some data into the file.
2. Now we have our file object, after that, we append some string in the file object.
3. Finally, we flush the changes into the file and close the file.

Now let’s talk about how we can read the file in JAVA suppose we have a text file that contains some data and we want to read this data.

1. Firstly we need to open the file in the reading mode and pass that data to a file object.
2. Next in need to read the data from the file line by line for this we create a loop and read the data line by line from the file.
3. After completing the reading data from the file we need to close the file.

Moving on with this article on Read and write Excel and CSV file in Java

 

What is the CSV file?

Now let’s talk about the CSV file, well CSV file is a normal file but contains the data with comma-separated values this comma-separated values. CSV file stores the table data into a simple text file. In our example, we created a CSVReadWrite.java file to read and write the file.

Moving on with this article on Read and write Excel and CSV file in Java

 

How to write a CSV file in Java?

Let’s take a simple example where we write a CSV file. For this, we use openCSV library. First, we load the file path into the CSVWriter and then set the column and then push the data both are comma-separated. The writeNext method is used to push the data to the file.

Moving on with this article on Read and write Excel and CSV file in Java

 

How to read CSV file in Java?

Let’s talk about writing a CSF file in java. In our example, we created readingCSVFile method to read the CSV file. We use FileReader object to load the file and BudfferedReader class to read the file. Then we start reading the file line by line readFilerow. Then we split the data by comma and save it into the array and finally print the data by index.

CSVReadWrite.java

package com.excelcsv;
import com.opencsv.CSVWriter;
import java.io.*;
public class CSVReadWrite {
String filePath;
CSVWriter file;
CSVReadWrite(String filePath){
this.filePath = filePath;
}
// writing csv file function
public void writingCSVFile(){
try {
file = new CSVWriter(new FileWriter(new File(filePath)));
String[] colName = { "Student ID", "Student Name", "Student Email" };
file.writeNext(colName);
String[] data = {"001", "Frank", "frank@znx.com"};
String[] data1 = {"002", "Mark", "mark@znx.com"};
String[] data2 = {"003", "Martin", "martin@znx.com"};
file.writeNext(data);
file.writeNext(data1);
file.writeNext(data2);
file.close();
} catch (Exception e) {
e.printStackTrace();
}
}
// reading csv file
public void readingCSVFile(){
try {
BufferedReader readFile = new BufferedReader(new FileReader(filePath));
String readFilerow;
while ((readFilerow = readFile.readLine()) != null) {
String[] data = readFilerow.split(",");
System.out.println(data[0]+"|"+data[1]+"|"+data[2]);
}
readFile.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}

 

Moving on with this article on Read and write Excel and CSV file in Java

 

What is an Excel file?

Before talking about the excel file let’s first talk about Microsoft Excel, well Microsoft Excel is a software program that used in a spreadsheet to read, write and calculate data from the table. When we store a Microsoft Excel file that file calls the excel file that has the extension .xls(older) or .xlsx (newer).

Moving on with this article on Read and write Excel and CSV file in Java

 

How to write Excel file in Java?

Now let’s discuss the file writing in excel, well writing the file in xls format we use JExcel API because the excel file is the specific file that open and edits with Microsoft Excel software. we need to create a WritableWorkbook object and set the file path in Workbook.createWorkbook method. Next, we call the method createSheet to create a new sheet and set the label. Finally, we need to add cell for this we call the method addCell and pass the label object with data we want to put in the excel file. In the last, we call the excelSheet.write a method to write the data to the excel file.

Moving on with this article on Read and write Excel and CSV file in Java

 

How to read Excel file in Java?

In the final phase of reading excel file, we first set the file path in the Workbook.getWorkbook next we create a sheet object and get the sheet.
Next, we create a cell object and get a cell form the sheet object. Now we want to print the data so we call the getContents method on cell object this will return the data from the specific cell.

ExcelReadWrite.java

package com.excelcsv;
import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;
import java.io.File;
import java.io.IOException;
public class ExcelReadWrite {
String filePath;
ExcelReadWrite(String filePath){
this.filePath = filePath;
}
// writing excel file
public void writeExcelFile(){
WritableWorkbook excelSheet = null;
try {
excelSheet = Workbook.createWorkbook(new File(filePath));
WritableSheet excelFile = myFirstWbook.createSheet("Sheet 1", 0);
Label label = new Label(0, 0, "Test Count");
excelFile.addCell(label);
Number number = new Number(0, 1, 1);
excelFile.addCell(number);
label = new Label(1, 0, "Result");
excelFile.addCell(label);
label = new Label(1, 1, "Passed");
excelFile.addCell(label);
number = new Number(0, 2, 2);
excelFile.addCell(number);
label = new Label(1, 2, "Passed 2");
excelFile.addCell(label);
excelSheet.write();
}catch (Exception e){
e.printStackTrace();
}
}
// reading excel file
public void readExcelFile(){
try {
excelSheet = Workbook.getWorkbook(new File(filePath));
Sheet sheet = workbook.getSheet(0);
Cell cell1 = sheet.getCell(0, 0);
System.out.print(cell1.getContents() + ":");
Cell cell2 = sheet.getCell(0, 1);
System.out.println(cell2.getContents());
Cell cell3 = sheet.getCell(1, 0);
System.out.print(cell3.getContents() + ":");
Cell cell4 = sheet.getCell(1, 1);
System.out.println(cell4.getContents());
System.out.print(cell1.getContents() + ":");
cell2 = sheet.getCell(0, 2);
System.out.println(cell2.getContents());
System.out.print(cell3.getContents() + ":");
cell4 = sheet.getCell(1, 2);
System.out.println(cell4.getContents());
} catch (IOException e) {
e.printStackTrace();
}
}
}

For handling the exception handling we write bothe classes code between the try-catch block.
The Main.java main java file that contains the main method here we call both classes, then we create a csvObj to handle read and write CSV file and create another object execObj to read and write excel file. This file handles the main functionality of our program.

 

Main.java

package com.excelcsv;
public class Main {
public static void main(String[] args) {
/**
* reading and writing CSV file here
*/
// creating CSVReadWrite class object
CSVReadWrite csvObj = new CSVReadWrite(System.getProperty("user.dir")+"output_csv.csv");
// writing CSV file
csvObj.writingCSVFile();
// read csv file
csvObj.readingCSVFile();
/**
* reading and writing Excel file here
*/
// creating ExcelReadWrite object
ExcelReadWrite excObj = new ExcelReadWrite(System.getProperty("user.dir")+"output_excel.xls");
// writing excel file
excObj.writeExcelFile();
// reading excel file
excObj.readExcelFile();
}
}

With this, we come to an end of this Read and Write Excel and CSV File in Java article.

Check out the Java training by Edureka, a trusted online learning company with a network of more than 250,000 satisfied learners spread across the globe. Edureka’s Java J2EE and SOA training and certification course is designed for students and professionals who want to be a Java Developer. The course is designed to give you a head start into Java programming and train you for both core and advanced Java concepts along with various Java frameworks like Hibernate & Spring.

Got a question for us? Please mention it in the comments section of this “Read and Write Excel and CSV File in Java” blog and we will get back to you as soon as possible.

CSM vs CSPO: Which Is The Right Agile Certification For You?

$
0
0

Scrum is a very powerful framework for implementing agile processes in software development and many other iterative projects. Transitioning to Scrum brings with it a set of new roles and concepts that can seem a bit confusing at first. Two such roles are the Scrum Master and Product Owner. In this ‘CSM vs CSPO’ article, let’s check the key differences between two popular scrum certifications.

The Anatomy of a Scrum Team

Scrum is a lightweight agile framework that can be used to manage iterative and incremental projects of all types. It is defined by three key roles:

  • Product Owner is responsible for the work the team is supposed to complete. The product owner motivates the team to achieve the goal and the vision of the project.
  • Scrum Master ensures that all the team members follow scrum’s theories, rules, and practices. They make sure the Scrum Team has whatever it needs to complete its work, like removing roadblocks, organizing meetings, etc.
  • Development Team(Scrum Team)  is a self-organizing and a cross-functional team, working together to deliver products.

    With Agile becoming standard practice at most companies, scrum masters and product owners are in great demand. Scrum certifications are important for the advancement of your career. Two most popular scrum certifications that help you learn the foundation of the scrum framework and boost your career are:

    But the question is, which amongst these two is the best certification and how do you know which one to choose? To figure that out you need to learn a bit more about the differences among the certifications.

    Comparing CSM & CSPO

    We will be comparing these certifications on features:

      • Certification Basis
      • Demand
      • Certification Procedure
      • Exam Details

      Certification Details

      CSM is an acronym for Certified Scrum Master. The CSM certification covers the fundamental aspects of the Scrum framework and is designed to provide an individual with a strong foundation in Scrum. This certification is offered by the Scrum Alliance, specifically for the Scrum Master role.

      CSPO is an acronym for Certified Scrum Product Owner. CSPO certification is for anyone who is interested in the “business side” of projects. It helps you see the behind-the-scenes of your company’s product development, but you’ll also get to exercise your leadership skills. This certification is offered by the Scrum Alliance, specifically for the Scrum Product Owner role.

      Why consider CSM & CSPO?

      With agile quickly becoming the standard practice and scrum framework being most popular and widely followed Agile methodology worldwide, demand for both scrum masters and product owners is skyrocketing.

      Scrum Master is one of the most sought-after roles in today’s evolving time. The impact of Agile and its Principles is so fulfilling that these days companies are hiring Scrum Specialist’s and CSM is definitely one of them. According to Glassdoor, it is one of the 25 highest paying jobs in America. Check out the salary range that Scrum Masters are earning.

      • In the US, the Scrum Master earns an annual salary between $100,000 and $125,000 on average
      • According to payscale, in India, the Scrum Master earns an annual salary between INR 950K to INR 1550K on average

      From a business standpoint, one of the most vital roles of any Scrum team is the Product Owner (PO). It is a challenging role, one that requires the PO to make important business decisions about the product.

      • According to Glassdoor, the national average salary for a Certified Product Owner is ₹20,31,986 in India.
      • Fortune 500 companies like SAP, Amdocs, Cisco, Dell, HP, etc are continually hiring CSPO professionals

      How to get Certified?

      How to get CSM Certified?

      The steps to follow to become a certified scrum master are:

      Step1: Register with scrum alliance, an official dealer for the Scrum.

      Step2: Attend in-person, two-day mandatory scrum course taught by a Certified Scrum Trainer

      Step3: After successfully completing the course, you will need to take the CSM test.

      Step4: Upon successfully passing the CSM test accept the CSM License Agreement and to complete your Scrum Alliance membership profile.

      Step5: You will get your lifetime and international valid Scrum Master Accredited Certification Document instantly online in pdf format.

      If you fail the test, you can re-attempt it for free of cost twice within 60 days of your first failed attempt. After that, every time you retake a test you will have to pay $25.

      How to get CSPO Certified?

      The steps to follow to become a certified scrum product owner are:

      Step1: Attend a 2-day course taught by a Certified Scrum Trainer® (CST®).

      Step2: Read Agile Manifesto, Scrum Guide and also go through CSPO Learning Objectives.

      Step3: After successfully completing the course, accept the CSPO License Agreement.

      Step4: Complete your Scrum Alliance membership profile.

      Step4: There is no test to get CSPO certification. Scrum Alliance will email you the link to download the CSPO certificate.

      Step5: Maintain your CSPO certification by earning Scrum Education Units® (SEUs) and renewing your certification every two years for a fee of $100.

      Exam Details

      The CSM certification has about 50 questions that you should attempt within 60 minutes time limit. To pass the examination and to get certified, you must answer at least 60 percent of the questions correctly. Don’t let this bother you, as the success rate is usually 98%.

      There is no exam for the Certified Scrum Product Owner Certification. Attending two days of classroom training will fetch you CSPO certification.

      Which one is best for you?

      CSM Certification and CSPO Certification, both have their own merits and advantages based on the necessity as per the roles and responsibilities. But the decision lies in the interest of an individual. It would be appropriate for one to pursue the certification relevant to the role that interests them. Certified Scrum Master (CSM) certification is the basic scrum certification and acts as a stepping stone in the career of agile practitioner and best suited for Developers, Testers, Business Analyst and Scrum Masters. Certified Scrum Product Owner(CSPO) training and the certification can be particularly useful for Business Analyst, Product Owners, Product Managers, and Higher Management or anyone interested in the “business side” of project.

      This brings us to the end of this ‘CSM vs CSPO’ article. I hope after reading this article, you are able to figure out which certification is for you.

      Make sure you are well versed with the Scrum terminology before you start using it.

      Got a question for us? Please mention it in the comments section of this “CSM vs CSPO” article and we will get back to you as soon as possible.

      How To Implement Addition Of Two Numbers In Java?

      $
      0
      0

      In this article, I am going to introduce you to a simple yet important concept that is addition of two numbers in Java. But before moving ahead, I would suggest you to get familiar with “What is Java”, features of Java and how can you install Java on your system, which you can find in previous blog. This will help you grab the coming concepts quickly and easily. The other blogs in this Java tutorial series written by our Java Training experts will cover all the important topics of Java & J2EE in depth,

      Following pointers will be covered in this article,

      So let us get started then,

      Addition of two numbers in Java

      Method 1

      Let’s understand directly by developing a program in Java to print “Addition of two numbers” on screen. 

      Class AddTwoNumbers
      {
      public static void main(String[] args)
      {
      System.out.println(“Addition of two numbers 10 + 20 is ” + (10 + 20));
      }
      }

      Output

      We must understand this that, here numbers are added directly say 10 + 20 that is 30. But what we get numbers from console. In that case the values will be stored in a variable. In terms of Java, String array variable will store those numbers based on their index.

      public class Main
      {
      public static void main(String[] args)
      {
      System.out.println("Addition of two numbers " + args[0] + " + " + args[1] + " is " + (args[0] + args[1]));
      }
      }

      The output for this will be as shown in Console when we pass same number that is 10 and 20.

      Eh, the result we got here is not desired 30. Remember String[] args, every input you take from console is represented in String. So here we have to convert those Strings into Integer to calculate the addition.

      public class Main
      {
      public static void main(String[] args)
      {
      //System.out.println("Addition of two numbers " + args[0] + " + " + args[1] + " is " + (args[0] + args[1]));
      System.out.println("Addition of two numbers " + args[0] + " + " + args[1] + " is " + (Integer.parseInt(args[0]) + Integer.parseInt(args[1])));
      }
      }

      Output

      Now the desired output is what we want. That is the addition of 10 and 20 is 30 after we parsed it from String to Integer.

      Next in this article on Addition Of two Numbers In Java

      Method 2

      1. Using Subtraction operator: We can use subtraction to add two numbers such that it will negate the negative value and come thus resulting into addition.

      public class AddTwoNumbers
      {
      public static int add(int a, int b)
      {
      return a – (-b);
      }
      public static void main(String[] args)
      {
      System.out.println(add(10, 20));
      System.out.println(add(-10, 20));
      }
      }

      Ouput

      30

      10

      Next in this article on Addition Of two Numbers In Java

      Repeated Unary Operator

      This involves while loop, the basic idea behind this is to bring the value of first operand to zero. And to keep on increamenting its corresponding second operand by the same amount of iterations. Consider the below example yourself.

      public class HelloWorld
      {
      public static void main(String []args)
      {
      System.out.println("add " + add(10, 20));
      System.out.println("add " + add(-10, 20));
      }
      public static int add(int a, int b)
      {
      //System.out.println("---> " + a + " : " + b);
      while(a > 0)
      {
      //System.out.println("while a>0---> " + a + " : " + b);
      b++;
      a--;
      }
      while(a < 0)
      {
      //System.out.println("while a<0---> " + a + " : " + b);
      b--;
      a++;
      }
      //System.out.println("return b---> " + a + " : " + b);
      return b;
      }
      }

      Ouput

      $javac HelloWorld.java
      $java -Xmx128M -Xms16M HelloWorld
      add 30
      add 10

      Next in this article on Addition Of two Numbers In Java

      Bitwise And Bitshift Operator In Java 

      We can also do the addition of two integers by using XOR bitwise operator and carry can be obtained by AND operator. To add carry into sum we need to use signed left shift operator. How does this happens? Let’s first see an example.

      public class HelloWorld{
      public static void main(String []args){
      System.out.println("Addition using +ve " + addUsingBits(10, 20));
      System.out.println("Addition using -ve " + addUsingBits(-10, 20));
      }
      public static int addUsingBits (int a, int b){
      while (b != 0){
      int carry = (a & b);
      a = a ^ b;
      b = carry << 1;
      }
      return a;
      }
      }

      Output

      $javac HelloWorld.java

      $java -Xmx128M -Xms16M HelloWorld

      Addition using +ve 30

      Addition using -ve 10

      Always remember that, XOR operation is used to evaluate addition of two bits. AND operation is used to evaluate carry of two bits. Let’s dissect this shall we? Going by the input values let’s take a = 10 and b = 20 for first condition.

      Operation

      Expression evaluation

      Binary equivalent

      Decimal Value

      a

      10

      00001010

      10

      b

      20

      00010100

      20

      while(b != 0)

      true

      int carry = (a & b)

      10 & 20

      0

      0

      a = a ^ b

      10 ^ 20

      00011110

      30

      b = carry << 1

      0 << 1

      0

      0

      return a

      30

      00011110

      30

      Now, let’s take a negative input say -10 for a. Let’s examine what happens at the below table.This lets us in loop until the decimal value of carry comes to negative.

      Next in this article on Addition Of two Numbers In Java

      Initial Loop Table

      Operation

      Expression evaluation

      Binary equivalent

      Decimal Value

      a

      -10

      11110110

      -10

      b

      20

      00010100

      20

      while(b != 0)

      true

      int carry = (a & b)

      -10 & 20

      00010100

      20

      a = a ^ b

      -10 ^ 20

      11100010

      -30

      b = carry << 1

      20 << 1

      00101000

      40

      Loop 1.

      Operation

      Expression evaluation

      Binary equivalent

      Decimal Value

      a

      -30

      11100010

      -30

      b

      40

      00101000

      40

      while(b != 0)

      true

      int carry = (a & b)

      -30 & 40

      00100000

      32

      a = a ^ b

      -30 ^ 40

      11001010

      -54

      b = carry << 1

      32 << 1

      00101000

      64

      And so on… until loop turns out to be b=0; for brevity not all result is shown here. So below table represents last loop in this operation.

      Operation

      Expression evaluation

      Binary equivalent

      Decimal Value

      a

      -2147483638

      1111111111111111111111111111111110000000000000000000000000001010

      -2147483638

      b

      -2147483648

      1111111111111111111111111111111110000000000000000000000000000000

      -2147483648

      while(b != 0)

      true

      int carry = (a & b)

      -2147483638 & -2147483648

      1111111111111111111111111111111110000000000000000000000000000000

      -2147483648

      a = a ^ b

      -2147483638 ^ -2147483648

      00001010

      10

      b = carry << 1

      -2147483648 << 1

      0

      0

      return a

      10

      00001010

      10

      So that’s how the addition got calculated. Phew! so much for the thought. Just think if this calculation was done manually by humans, mainly binary calculations.

      Next in this article on Addition Of two Numbers In Java

      Recursion

      We can also write the above program using recursion too. The calculation part differs slightly lets consider this for homework for you shall we? I will give the extract here for the recursion and you try to build your own table so that you know how it works internally. Also, no need to mug all this that is only for representation purpose unless you are excited about internal workings here.

      public static int addUsingRecursion(int a, int b){
      if(b == 0) return a;
      int sum = a ^ b;
      int carry = (a & b) << 1;
      return add(sum, carry);
      }

      This was all for the addition of two numbers in Java with using + operator and without using + operator. The reason behind going for either of those will entirely depend on the project need and requirement.

      I have not evaluated and tested the working of both the scenario to come up with performance. I guess that will come into effect only if you are building the rocket and deliver it to space.

      I have explained only numbers related to Integers for brevity which has its own memory limit. I leave it to you to further explore using float, double, etc. Always remember that if you exceed the limit value of primitive types then the result will show different answer.

      Check out the Java Training by Edureka, a trusted online learning company with a network of more than 250,000 satisfied learners spread across the globe. We are here to help you with every step on your journey, for becoming your best, we come up with a curriculum which is designed for students and professionals who want to be a Java Developer.

      7 MongoDB GUIs You Need to Check Out in 2019

      $
      0
      0

      MongoDB is an open-source relational database platform that is doing the rounds of the internet for quite some time now. It comes with a host of features which offer higher flexibility and versatility when compared with other relational database platforms in the market like MySQL. One of the most prominent additions is the inclusion of a GUI or Graphical User Interface. In this article, we will list out 7 of the most popular MongoDB GUIs Out there:

      Below is List of MongoDB GUIs

       

      NoSQLBooster

      NoSQLBooster is one of the most popular GUIs available for MongoDB today. Formerly known as Mongo Booster, it is a shell centric cross-platform GUI tool for MongoDB. It is available for free download online.

      Features

      1. Built-in language services come with recognition for all possible completions, properties, variables, field names, operators and even the MongoDB collection names. 

      2. It lets the programmer assemble npm packages like building blocks in the MongoDB shell script. 

      3. The inbuilt visual query builder helps create tp statements, even if you don’t have knowledge about shell commands and its syntaxes. 

      4. It can translate most of the MongoDB queries into various target languages including C#, Python, Javascript and much more.

       

      Studio 3T

      After NoSQLBooster, Studio 3T is the most popular MongoDB GUI available out there. This GUI is specifically built for teams which collaborate on the MongoDB platform.

      Some of its most prominent features include:

      1. Using Intellishell and achieving autocomplete when typing commands on the platform. 

      2. Make use of SQL and Inner, Outer joins to facilitate queries in MongoDB. 

      3. Allows the creation of queries visually by using drag and drop fields. 

      4. Can establish secure connections both for replica sets as well as MongoDB instances.

       

      Robo 3T

      If you are a MongoDB enthusiast, then Robo 3T, formerly known as Robomongo is one of the best-suited GUIs for you. The specialty of Robo 3T lies in the fact that this is lightweight, is open source and most importantly has cross-platform support. It also has the capability of embedding MongoShell within its interface to enable both GUI based as well as shell interactions. 

      Some of the most prominent features of Robo 3T include:

      1. Support for MongoDB 4.0 and above. 

      2. Embedded shell environment available for use upon installation. 

      3. Asynchronous and non-blocking User Interface.

       

      Nucleon Database Master

      Nucleon Database Master is one of the newest entrants to the world of MongoDB GUIs. It is easily one of the most powerful and easy to use MongoDB administration, and management tools available for use in the market today. The specialty of this GUI lies in the fact that it makes operations such as querying, editing, managing, monitoring and visualizing relational NoSQL DBMS simpler and more efficient. 

      Some of the key features of this GUI include:

      1. Support for SQL, JSON as well as LINQ query editor. 

      2. Allowing the user to export data in a wide variety of available formats including, MS Office, PNG, XML, Doc, PDF, CSV, XPS as well as dBase. 

      3. It allows users to import already available data without imposing any size limits. The available data formats for import are XML, CSV and SQL Script, among others. 

      4. Some of the other notable features of this tool include highlighting of code, find and replace text and most importantly auto code completion.

       

      MongoDB Compass

      MongoDB Compass is another very effective GUI available in the market today. One of its most striking features includes the ability to provide a graphical view of the MongoDB schema without using query language. It also comes packed with features which are able to analyze available documents and display rich structures via the inbuilt intuitive UI. 

      Features

      1. Allows the user to explore data visually at any given point in time. 

      2. The user has the option to get a quick insight into query performance as well as server insight. 

      3. It actively helps the user in making decisions when it comes to indexing, document validation and much more. 

      4. It eliminates the need to write the command line.

       

      Mongo Management Studio

      If you are looking for an effective MongoDb management tool, then this is one for you. One of the most significant features of this GUI includes the execution of all MongoDB commands without having to use the MongoDB shell. 

      Features

      1. Support for MongoDB, 3.0, 3.2 as well as 3.4.

      2. Offers cross-platform, making it easier for the user to run it in any environment. 

      3. By using this GUI, one can easily read and write GridFS collections. 

      4. It has an inline editor, which makes data manipulation on the fly easier and more effective. 

       

      NoSQL Manager

      If you need a GUI that can merge the powers and capabilities of a friendly UI and Shell Power, then NoSQL Manager should be your first choice. It is best suited for database developers and administrators and is one of the highest performance GUIs available out there. 

      Features

      If you are looking to use NoSQL Manager, here are some of its most prominent features:

      1. Availability of a file manager tool to use with GridFS. 

      2. Support is available for replica sets, shared cluster connections as well as standalone hosts. 

      3. Easy to use document viewer is available for amateurs as well as professionals. 

      4. Comes inbuilt with a fully-featured MongoDB GUI shell along with features such as code auto-completion, syntax highlighting and much more.

       

      With this, we come to an end of this Top MongoDB GUIs. I hope you have a wide range of GUIs to choose from. Edureka also provides a MongoDB Course. Do check it out, guys.

      How to Implement a Linked List in Python?

      $
      0
      0

      Python programming language is an open-source language with various out-of-the-box implementations that makes it unique and easier to learn. Although Python does not support the concept of a linked list, there is a way around it through a different implementation to get a linked list. In this article, we will learn how we can make a linked list in Python. Following are the topics covered in this blog:

      Let’s begin!!

      What is Linked List?

      The link list is a sequence of nodes having a similar data type, each node contains one data object and pointer to the next node.

      A linked list is a linear data structure with the collection of multiple nodes. Where each element stores its own data and a pointer to the location of the next element. The last link in a linked list points to null, indicating the end of the chain. An element in a linked list is called a node. The first node is called the head. The last node is called the tail.
      Standard python library does not have a linked list. We can implement the concept of link list data structure by using the concept of nodes.

      Now that we learned about what is Linked. So let’s move on to implementing a Linked list.

      Implementing a Linked List

      For creating a Linked List, we create a node object and create another class to use this node object.
      Code for creating Node class.
      The above program creates a linked list with three data elements.

      class Node(object):
      # Constructor to initilize class variables
      def __init__(self, data=None, next_node=None):
      self.data = data
      self.next_node = next_node
      #get data
      def get_data(self):
      return self.data
      # get next value
      def get_next(self):
      return self.next_node
      # set next data
      def set_next(self, new_next):
      self.next_node = new_next
      
      

      Implementation of link list consists of the following functionality in a linked list
      1. Insert: This method will insert a new node in a linked list.
      2. Size: This method will return the size of the linked list.
      3. Search: This method will return a node containing the data, else will raise an error
      4. Delete: This method will delete a node containing the data, else will raise an error

      Lets see the Methods of Linked list

      Init method in a linked list

      class LinkedList(object):
      def __init__(self, head=None):
      self.head = head
      
      

      Init method is used for the initialization of a class variable if the list has no nodes it is set to none.

      Insert:

      def insert(self, data):
      new_node = Node(data)
      new_node.set_next(self.head)
      self.head = new_node
      
      

      This insert method takes data, initializes a new node with the given data, and adds it to the list. Technically you can insert a node anywhere in the list, but the simplest way to do it is to place it at the head of the list and point the new node at the old head (sort of pushing the other nodes down the line).

      Size

      # Returns total numbers of node in list
      def size(self):
      current = self.head
      count = 0
      while current:
      count += 1
      current = current.get_next()
      return count
      

      The size method is very simple, it basically counts nodes until it can’t find anymore, and returns how many nodes it found. The method starts at the head node, travels down the line of nodes until it reaches the end (the current will be None when it reaches the end) while keeping track of how many nodes it has seen.

      Search

      # Returns the node in list having nodeData, error occured if node not present
      def search(self, nodeData):
      current = self.head
      isPresent = False
      while current and isPresent is False:
      if current.get_data() == nodeData:
      isPresent = True
      else:
      current = current.get_next()
      if current is None:
      raise ValueError("Data not present in list")
      return current
      
      

      Search is actually very similar to size, but instead of traversing the whole list of nodes it checks at each stop to see whether the current node has the requested data. If so, returns the node holding that data. If the method goes through the entire list but still hasn’t found the data, it raises a value error and notifies the user that the data is not in the list.

      Delete

      # Remove the node from linked list returns error if node not present
      def delete(self, nodeData):
      current = self.head
      previous = None
      isPresent = False
      while current and isPresent is False:
      if current.get_data() == nodeData:
      isPresent = True
      else:
      previous = current
      current = current.get_next()
      if current is None:
      raise ValueError("Data not present in list")
      if previous is None:
      self.head = current.get_next()
      else:
      previous.set_next(current.get_next())
      
      

      The delete method traverses the list in the same way that search does, but in addition to keeping track of the current node, the delete method also remembers the last node is visited. When delete finally arrives at the node it wants to delete. It simply removes that node from the chain by “leapfrogging” it.

      By this I mean that when the delete method reaches the node it wants to delete, it looks at the last node it visited (the ‘previous’ node) and resets that previous node’s pointer. Rather than pointing to the soon-to-be-deleted node.

      It will point to the next node in line. Since no nodes are pointing to the poor node that is being deleted, it is effectively removed from the list!

      This brings us to the end of this article where we have learned how we can make a linked list in python with a similar implementation even though python does not really support the concept of a linked list. I hope you are clear with all that has been shared with you in this tutorial.

      If you found this article on “Linked List In Python” relevant, check out the Edureka Python Certification Training. A trusted online learning company with a network of more than 250,000 satisfied learners spread across the globe. 

      We are here to help you with every step on your journey and come up with a curriculum that is designed for students and professionals who want to be a Python developer. The course is designed to give you a head start into Python programming and train you for both core and advanced Python concepts along with various Python frameworks like Django.

      If you come across any questions, feel free to ask all your questions in the comments section of “Linked List In Python” and our team will be glad to answer.


      What is Digital Marketing? The Ultimate Guide for Beginners

      $
      0
      0

      There is a huge difference between surviving and thriving, and as a business owner, you might already be familiar with it. But are you familiar with the role of Digital Marketing in your business? In today’s world where the Internet is entwined with everything we do, the importance of Digital Marketing has become crystal clear. It has become an integral part of what business means to its customers. This blog on What is Digital Marketing will walk you through the following topics –

      What is Digital Marketing?

      Digital Marketing encompasses all marketing efforts that promote your product or brand using electronic devices or the internet. It leverages online marketing tactics like search marketing, email marketing, social media marketing, and mobile marketing to connect with current and prospective customers.

      Now that you have understood What is Digital Marketing, let us have a look at the 5Ds of Digital Marketing.

      The 5Ds of Digital Marketing

      The 5Ds in Digital Marketing define the opportunities for consumers to interact with brands and for businesses to reach out to their audiences in different ways. The 5Ds of Digital Marketing are –

      Digital devices – Your audience experiences your brands as they interact with the websites through digital devices including mobile phones, desktops, tablets, TVs and gaming devices.

      Digital platforms – Most interaction on digital devices is through browser or applications from the major platforms like Google, Facebook, Instagram, YouTube, Twitter, and LinkedIn.

      Digital media – Different owned, paid and earned communications channels to reach and engage with your audience.

      Digital data – Insights that businesses collect about their audience and their interaction with businesses.

      Digital technology – Businesses use to create interactive experiences from websites and apps to in-store kiosks and email campaigns.

      Why Digital Marketing?

      While traditional marketing might exist in print ads, phone communication, or physical marketing, Digital Marketing occurs electronically and online. This means that there are endless possibilities for brands including video, email, social media, or website-based marketing opportunities.

      Since Digital Marketing has so many options and strategies associated with it, you can get creative and experiment with a variety of marketing campaigns. With Digital Marketing, you can also use analytics tools to monitor the success and ROI of your campaigns.

      How Does Digital Marketing Work?

      Digital Marketing is no different from traditional marketing. Both require smart organizations to develop mutually beneficial relationships with prospects, leads, and customers. Yet, Digital Marketing has replaced most traditional marketing tactics as it is designed to reach today’s consumers.

      Think about the last important purchase you made. Before buying, you probably would have searched the internet to learn about the product you wanted and what your best options were. And your ultimate buying decision would have been based on the customer reviews, features, and pricing you researched.

      Purchasing decisions begin online today. Hence, an online presence is absolutely necessary regardless of what you sell.

      You need to build a marketing strategy that puts you in places your followers are already hanging out and connects you with them in a multitude of ways, like –

      • Providing them content to keep them updated with industry news
      • Social media shares that content and engages with the audience as friends and followers
      • Search engine optimization optimizes your content, so it shows up when someone searches for the information you’ve written about
      • Advertising drives paid traffic to your website, where people can find your offers
      • Email marketing follows up with your audience to make sure they continue to get the solutions they’re looking for

        When you put all these pieces together, you get an efficient, easy-to-operate Digital Marketing machine. Although it seems intimidating to build that machine from scratch, it is as simple as learning and integrating one Digital Marketing tactic at a time.

        Marketing Channels in Digital Marketing 

        Search Engine Optimization

        SEO is the process of optimizing content, technical set-up, and reach of your website so that your pages appear at the top of a search engine result for specific keywords. The ultimate goal is to attract visitors to your website when they search for products or services related to your business.

        SEO enforces the need for a user-friendly website, valuable and engaging content, and credibility for other websites and visitors to recommend you by linking to your website or tagging you in their social media posts. There are a number of ways to approach SEO to generate traffic to your website. These include –

        • On-page SEO: It focuses on the content that exists “on the page” on a website. By researching keywords for their search volume and intent (or meaning), you can answer questions for readers and rank higher on the search engine results pages (SERPs) those questions produce.
        • Off-page SEO: It focuses on all the activities that take place “off the page” when looking to optimize your website. What are these activities that are not on-page but affect your ranking? The answer is “backlinks”. The number of publishers that link to you, and the relative “authority” of those publishers, affect how you rank for specific keywords you. You can earn the backlinks by networking with other publishers, writing guest posts on these websites, and generating external attention.
        • Technical SEO: It focuses on the backend of your website. Image compression, CSS file optimization, and structured data are different forms of technical SEO that can increase your website’s loading speed that is an important ranking factor for search engines.

        Content Marketing

        Have you heard the saying, “Content is king?”. Quality content is the fuel that drives your Digital Marketing strategies. Content Marketing denotes the creation and promotion of content assets in order to generate brand awareness, lead generation, traffic growth, and customers. The channels that play a part in your content marketing include:

        • Videos: YouTube is now the second-largest search engine on the internet and videos are completely taking over the digital marketing world. The use of video in content marketing is on the rise and it definitely demands a front-runner position in your content marketing plan. The number one reason for this is that videos convert more customers. A recent report shows that 71% of marketers say video conversion rates outperform other marketing content.
        • Blog posts: Writing and publishing articles on a company blog help you demonstrate your industry expertise and generate organic search traffic for your website. This gives you an opportunity to convert the website visitors into leads.
        • Ebooks and whitepapers: Ebooks, whitepapers, and similar long-form content help educate website visitors. It allows you to exchange content for a reader’s contact information, generating leads for your company.
        • Infographics: Infographics are a form of visual content that helps your website visitors visualize a concept that you want to help them learn.

        Creating content that is not promotional, but instead educates and inspires, is tough but worth the effort. Offering relevant content helps your audience take you as a valuable source of information.

        Paid Search

        Paid search, or pay-per-click (PPC) advertising refers to the “sponsored result” on the search engine results pages (SERP). PPC ads are visible, flexible, and effective for many different types of organizations. With paid search, you only pay when your ad is clicked. You can tailor your ads to appear when specific search phrases are entered, targeting them to a particular audience.

        Some channels where you can use PPC are –

        • Paid ads on Facebook: Users can pay to customize a video or image post, which Facebook will publish to the newsfeeds of people who match your business.
        • Twitter Ads campaigns: Users can pay to place a series of posts to the news feeds of a specific audience, all dedicated to accomplishing a specific goal for your business. This goal can be website traffic, Twitter followers, tweet engagement, or app downloads.
        • Sponsored Messages on LinkedIn: Users can pay to send messages to LinkedIn users based on their industry and background.

        Social Media Marketing

        Social Media Marketing promotes your brand and content on social media channels in order to increase your brand awareness, drive relevant traffic, and generate leads.

         

        Some of these social media channels are –

        People rely on social networks these days to discover, research, and educate themselves about a brand before engaging with it. For marketers, it’s not enough just to post on your FB or Twitter accounts. You should also weave social elements into every aspect of your marketing activities and create more sharing opportunities. The more your audience engages with your content, the more they would want to share it. This ultimately leads them to become a potential customer.

        Email Marketing

        Companies communicate with their audience through email marketing. Emails are used to promote content, events, and discounts, and also to direct people toward the business’s website. The different types of emails you can send in an email marketing campaign are –

        • Blog subscription newsletters
        • Follow-up emails to website visitors who downloaded something
        • Customer welcome emails
        • Holiday promotions to loyalty program members
        • Tips or similar series of emails for customer nurturing.

        Remember that not just any email will do. Successful email campaigns must be relevant, engaging, informative, and entertaining. To succeed in email marketing, your emails should satisfy these five core attributes:

        • Trustworthy
        • Relevant
        • Conversational
        • Be coordinated across channels
        • Strategic

        Online PR

        Online PR is the practice of securing earned online coverage with blogs, digital publications, and other content-based websites. It is almost like traditional PR but in the online space. The channels you can use to maximize PR efforts include –

        • Reporter outreach via social media: Talking to journalists on Twitter, for example, is a great way to develop a relationship with the press that could generate earned media opportunities for your company.
        • Engaging online reviews of your company: Engaging company reviews help you humanize your brand and deliver messaging that would protect your reputation.
        • Engaging comments on your personal website or blog: Responding to the people who read your content is the best way to generate productive conversation with the audience around your industry.

        Mobile Marketing

        Mobile devices are becoming an integral part of our lives hence, it is vital for marketers to understand how to communicate on this channel effectively.

        From SMS and MMS to in-app marketing, there are many ways to go through with mobile marketing. Finding the right method for your business is the key to success.

        What is the Role of Digital Marketing for Your Business?

        Having a Digital Marketing Strategy for your business lets you be a dynamic part of the unavoidable and lucrative online Marketing framework. Let us dig into the important role of Digital Marketing for business growth-

        Greater Exposure

        Digital Marketing gives a fair chance to all businesses that prefer online branding and advertising.

        Website Traffic
        Digital Marketing allows you to see the exact number of people who viewed your website’s page in real-time by using digital analytics software.

        Content Performance and Lead Generation
        With Digital Marketing, you can measure how many people exactly viewed the page where it’s hosted, and you can also collect the contact details of people who download it by using forms.

        Attribution Modeling
        Attribution modeling is an effective strategy for Digital Marketing that allows you to trace all your sales back to a customer’s first digital touchpoint with your business. It helps you identify trends in which people research and buy your products which help you make informed decisions about what parts of your marketing strategy deserve attention.

        Wrapping Up…
        So, that’s the scoop on Digital Marketing which makes it clear that businesses in the modern economy need Digital Marketing to compete. It is a huge domain that is not going away anytime soon and it is expected to outperform conventional marketing strategies. One of the favorable circumstances of leading your marketing via digital mediums is the straightforwardness with which results can be followed and observed. Digital Marketing helps you observe the customer response rates, gauge the fruition of your advertising objectives, and enables you to plan your next Digital Marketing Campaign all the more precisely.

        With this, we come to an end of this blog on “What is Digital Marketing”. If you have any queries regarding this topic, please leave a comment below and we’ll get back to you.

        If you wish to enroll for a complete course on Digital Marketing Certification Training, Edureka has a specially curated Machine Learning Engineer Master Program which will help you gain expertise in various digital media aspects like Keyword Planning, SEO, Social Media Marketing, Search Engine Marketing, Email Marketing, Affiliate Marketing, and Google Analytics. 

        How To Convert Object To Array In PHP?

        $
        0
        0

        An individual instance of the data structure which is defined by a class is an Object. We also name objects as instances. Generally, we define a class once and then make many objects that belong to it. One of the data structures that stores one or more similar types of values in a single name is an array but associative array in PHP is something different from a simple PHP array. Associative arrays are generally used to store key-value pairs. In this article we will learn ‘How To Convert Object To Array In PHP?’

        Following pointers will be covered in this article,

        So let us get started then

        How To Convert Object To Array In PHP?

        Type Casting object to an array

        In order to utilize one data type variable into different data types, we can use typecasting which is simply the explicit conversion of a data type. By using typecasting rules supported in PHP,

        it will convert a PHP object to an array.

        Syntax: $Array_var = (array) $Obj;

        Below example demonstrates the working of typecasting object to an array in PHP

        <?php
        class hotel
        {
        var $item1;
        var $item2;
        var $item3;
        function __construct( $food1, $food2, $food3)
        {
        $this->item1 = $food1;
        $this->item2 = $food2;
        $this->item3 = $food3;
        }
        }
        // Create object for class(hotel)
        $food = new hotel("biriyani", "burger", "pizza");
        echo "Before conversion : ";
        echo "<br>";
        var_dump($food);
        echo "<br>";
        // Coverting object to an array
        $foodArray = (array)$food;
        echo "After conversion :";
        var_dump($foodArray);
        ?>

        Moving on with this article on how to convert Object to Array In PHP?

        Using Json Decode & Json Encode

        JSON encoded string is accepted by json_decode function and converts it into a PHP variable and on the other hand, JSON encoded string for a given value is returned by json_encode

        Syntax: $Array_var = json_decode(json_encode($obj), true)

        Below example demonstrates the conversion of object to array in PHP using json_decode & json_encode.

        <?php
        class hotel
        {
        var $var1;
        var $var2;
        function __construct( $bill, $food )
        {
        $this->var1 = $bill;
        $this->var2 = $food;
        }
        }
        // Creating object
        $food = new hotel(500, "biriyani");
        echo "Before conversion:";
        echo "<br>";
        var_dump($food);
        echo "<br>";
        // Converting object to associative array
        $foodArray = json_decode(json_encode($food), true);
        echo "After conversion:";
        var_dump($foodArray);
        ?>

        This brings us to the end of this article on How To Convert Object To Array In PHP.

        If you found this PHP article relevant, check out the PHP Certification Training by Edureka, a trusted online learning company with a network of more than 250,000 satisfied learners spread across the globe.

        Got a question for us? Please mention it in the comments section of ”How To Convert Object To Array In PHP” article and I will get back to you.

        Android Services Tutorial : How to run an application in the background?

        $
        0
        0

        Often using multiple applications on your smartphone, you may want to switch from one application to another but also ensure that all your applications remain active in the background. These are nothing but the services offered by Android. So, this article on Android Services Tutorial will help you understand how to work with the Services.

        I’ll be covering the following topics:

        What are Android Services?

        Service is basically a process. Android service is a component that runs in the background in order to perform long-running operations without interacting with the user and it works even if the application is destroyed. Another application component can start a service and it continues to run in the background even if you switch to another application.

        Additionally, a component can bind itself to a service in order to interact with it and also perform interprocess communication. 

        Note: The android.app.Service is a subclass of ContextWrapper class and Android service is not a thread or separate process.

        Android- Services Life cycle

        Android Services life cycle can have two forms of services. The lifecycle of a service follows two different paths, namely:

        1. Started
        2. Bound

        Started

        A service is started when an application component calls startService() method. Once started, a service can run in the background indefinitely, even if the component which is responsible for the start is destroyed. It is stopped by using the stopService() method. The service can also stop itself by calling the stopSelf() method.

        Bound

        A service is bound when an application component binds to it by calling bindService(). Bound service offers a client-server interface that allows components to interact with the service, send requests and, get results. It processes across inter-process communication (IPC). The client can unbind the service by calling the unbindService() method.

        Moving on to the next section of this article on Android Services, let’s discuss the different methods under the service class.

        Android Services Tutorial : Methods

        There are a few methods using which you can easily perform operations on any application. Some of them are:

        Method Description
        onStartCommand()

        This method is called when any other component, like say an activity, requests the service to be started, by calling startService().

        It is your responsibility to stop the service when the corresponding work is done by using stopSelf() or stopService() methods.

        onBind()

        Calls this method when another component wants to bind with the service by calling bindService().

        To implement this, you must provide an interface that clients use in order to communicate with the service. It returns an IBinder object. If you don’t want to allow binding, then return null.

        onUnbind()

        The system calls this method when all clients are disconnected from a particular interface published by the service.

        onRebind()

        Calls this method when new clients are connected to the service after it had previously been notified that all are disconnected in onUnbind(Intent).

        onCreate()

        The system calls this method when the service is created first using onStartCommand() or onBind(). It is required to perform a one-time set-up.

        onDestroy()

        This method is called when the service is no longer used and is being destroyed. Your service should implement this in order to clean up any resources such as threads, registered listeners, receivers, etc.

        Skeleton code 

        public class MainActivity extends Activity {
        
        private TextView textView;
        private BroadcastReceiver receiver = new BroadcastReceiver() {
        
        @Override
        public void onReceive(Context context, Intent intent) {
        Bundle bundle = intent.getExtras();
        if (bundle != null) {
        String string = bundle.getString(DownloadService.FILEPATH);
        int resultCode = bundle.getInt(DownloadService.RESULT);
        if (resultCode == RESULT_OK) {
        Toast.makeText(MainActivity.this, "Download complete. Download URI: " + string, Toast.LENGTH_LONG).show();
        textView.setText("Download done");
        } else {
        Toast.makeText(MainActivity.this, "Download failed",
        Toast.LENGTH_LONG).show();
        textView.setText("Download failed");
        }
        }
        }
        };
        
        @Override
        public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        textView = (TextView) findViewById(R.id.status);
        }
        
        @Override
        protected void onResume() {
        super.onResume();
        registerReceiver(receiver, new IntentFilter(
        DownloadService.NOTIFICATION));
        }
        @Override
        protected void onPause() {
        super.onPause();
        unregisterReceiver(receiver);
        }
        
        public void onClick(View view) {
        
        Intent intent = new Intent(this, DownloadService.class);
        // add infos for the service which file to download and where to store
        intent.putExtra(DownloadService.FILENAME, "index.html");
        intent.putExtra(DownloadService.URL, "www.edureka.co");
        startService(intent);
        textView.setText("Service started");
        }
        }

        In this example, you can see the methods like onCreate(), onResume(), onPause(). These methods make up the structure of the Services in Android.

        Now, getting to the practical part of this Android Services Tutorial, let’s see how to create a service and handle it.

        Demo

        Let’s see how to play music in the background. In order to do that, I’ll be using Andriod Studio.

        Step 1

        Create a new empty project. Name your project and click on the Java folder and click on the MainActivity. First, add MediaPlayer so that you can import the player details like start, set the loop and so on.

        package com.example.mydemoapplication;
        
        import androidx.appcompat.app.AppCompatActivity;
        
        public class MainActivity extends AppCompatActivity {
        
        @Override
        protected void onCreate(Bundle savedInstanceState) {
        super.onCreate( savedInstanceState );
        setContentView( R.layout.activity_main );
        
        MediaPlayer player = MediaPlayer.create( this, Settings.System.DEFAULT_ALARM_ALERT_URI );
        player.setLooping( true );
        player.start();
        }
        }

        Note: If you are using it for the first time, don’t forget to enable the BIOS. You can do this by restarting your system. 

        You will have to add a virtual device. Just click on Open AVD manager.

        Select a device of your choice and you’re ready to go!

        This will only run when the screen is active but to make this application work even in the background, you need to add a few more lines of code in the activity_main.xml file.

        Step 2

        Once you run the corresponding code, you will be able to run the application and will be able to play the music on the background, i.e., if any other application is opened, this audio will still be playing.

        Let’s see how this can be done.

        • Create another class in the Java folder and name it. Here, I’ve called it “MyService“.
        • This class extends the Service class.
        • Once you have the Service class methods, implement the methods by clicking alt+Enter. 
        • After this,  you have to override the methods. So, right-click on the window to get the options.
        • Generate the override methods, select onStartCommand(), and OnDestroy(). 
        • Edit the onStartCommand() methods by adding the following code.:
        MediaPlayer player = MediaPlayer.create( this, Settings.System.DEFAULT_ALARM_ALERT_URI );
        player.setLooping( true );
        player.start();

        Note: Delete this code in the MainActivity. 

        • This will throw an error asking you to remove the statement. So, remove the return statement and declare MediaPlayer as a private method and return START_STICKY. This will return the start status.
        • Add player.stop() in the onDestroy() method.

        Step 3

        Go to res and go to layouts, click on android_main.xml  to get the XML file of the application.

        • Remove the TextView and replace it with the LinearLayout and add Buttons. Add the corresponding code.
        <LinearLayout
            android:orientation="vertical"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_centerVertical="true"
            tools:ignore="MissingConstraints">
            <Button
                android:id="@+id/buttonStart"
                android:text="Start Service"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"/>
            <Button
                android:id="@+id/buttonStop"
                android:text="Stop Service"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"/>
        </LinearLayout>
        • Once you do this, go back to the MainActivity class and add the corresponding code in order to link the XML file and the MyServiceClass. 
        package com.example.newproject;
        
        import androidx.appcompat.app.AppCompatActivity;
        
        public class MainActivity extends AppCompatActivity implements View.OnClickListener {
        private Button start, stop;
        
        @Override
        protected void onCreate(Bundle savedInstanceState) {
        super.onCreate( savedInstanceState );
        setContentView( R.layout.activity_main );
        
        
        start=(Button) findViewById( R.id.buttonStart );
        stop= (Button) findViewById( R.id.buttonStop );
        
        start.setOnClickListener( this );
        stop.setOnClickListener( this );
        
        }
        
        @Override
        public void onClick(View view) {
        if(view == start){
        startService(new Intent( this, MyServiceClass.class ) );
        }else if (view == stop){
        stopService(new Intent( this, MyServiceClass.class ) );
        
        }
        }
        }

        Step 4

        Once you are done linking the classes, let’s run the code.

        Note: Add the Service class name in the AndroidManifiest.xml file. 

        Next, let’s run the code.

        Once you start the service, it will run on the background even if another application is opened. You can start or stop the service by clicking on the buttons.

        This is a simple demo where you have learned how to work with Android Services.

        So with this, we come to the end of this article on “Android Services Tutorial”. I hope you are clear with the topics that are covered in this blog. 

        Now that you have gone through our Android Services Tutorial blog, you can check out Edureka’s Android App Development Certification Training to quick-start your learning.

        Have any queries? Don’t forget to mention them in the comments of this “Android Services Tutorial” blog. We will get back to you.

        What Are Important Pre-Requisites For DevOps Professionals?

        $
        0
        0

        This article will talk about the pre-requisites for DevOps and while doing that give you all the information to help you get started with DevOps. Following pointers will be covered in this article,

        To run the business processes smoothly and efficiently, there are continuous updates in software developmental approach. DevOps is such a tool which has assured exceptional, swifter and productive services with a high-end customer satisfaction. DevOps have become a flair in the recent IT market. Consequently, the demand for engineers to develop, supervise and deal DevOps practices is on a raise in organizations of various industries. To meet this demand and raise their own efficiency, organizations are hiring skilled DevOps engineers. In order to avail this booming opportunity, one must be aware about what a DevOps does and the required prerequisites.

        Let us dive deeper into this pre-requisites For DevOps

        What is DevOps?

        DevOps (Development Operations) is a pioneer innovative development method comprising of just a few sets of processes that synchronize to integrate development teams and processes to supplement software development. DevOps is in huge demand because it brings high speed and accuracy creating a relationship between development and IT operations allowing organizations to create and modify their products at a comparatively brisk pace than available traditional software development methods.

        A strong alliance of divergent teams- developing, testing, and operating- is its distinguished concept. This strong collaboration of teams results in identifying and solving errors quickly. In the DevOps scenario, the codes are continuously developed, tested, integrated, deployed and monitored to provide the standard output in less duration.

        Lets look into who is a DevOps Engineer

        Who is a DevOps Engineer?

        As a matter of fact, there is no orthodox career course for a DevOps engineer. He can be an IT professional – developer or system administrator to expand the responsibilities towards ingenious progressive evolution of DevOps.

        The key responsibilities of DevOps engineer are-

        • Administration of IT infrastructure
        • Choosing the right deployment models
        • Conducting the testing protocol and critical monitoring

        Now lets move on to Pre-requisites For DevOps Engineer

        Prerequisites of a DevOps Engineer

        As a DevOps engineer has a very pivotal role to play in any organization, it is mandatory for one to be perfect in various technical and personal skills such as Coding, re-engineering of processes and collaboration. Some of the prerequisites of a DevOps engineer are-

        Containers

        Containers are one of the most required assets for a DevOps engineer to have on his or her resume. Containers enable developers to generate applications and install them to servers from a laptop. This tool has changed the whole scenario of apps’ creation, operation and shipment. It has become one of the most in practice advances in DevOps technology due to the ability to impart an accurate and directed environment to build within.

        Grasp of programming languages

        It is mandatory for the DevOps engineer to have a basic knowledge of certain basic programming languages such as Java, Perl and Python as it ensures the DevOps engineer to handle the development team well so as to enable uniform trouble-free flow of application installation, configuration and validation. A great DevOps engineer should also be a scripting guru as he must be capable to writing code to automate repeatable processes.

        Comprehending Tools and Technologies

        Various specific operations of development, testing, integration, observing, formation and others depend on various DevOps tools. The DevOps engineer should have a thorough comprehension of popular tools such as Ansible, Chef, Docker, ELK Stack GIT, Jenkins, Puppet, Selenium, and Splunk. He or she should be eager to learn new technologies, offer novel solutions and recommendations and be adaptive to face challenges.

        DevOps Training and Certification

        One of the quite crucial and important qualifications of the DevOps engineer is DevOps training and certification. It offers to provide an effective route to learn various processes of DevOps – basics, DevOps tools, lifecycle, workflow, and other processes. Hyderabad is the current hub in India for DevOps training. Certification as DevOps professional is a huge advantage as it marks upgradation of skills as well as enhanced capacity to improve business scope. One gets valuable hands-on experience by handling real-time project works and gets an exposure to the live environment of projects in training.

        Knowledge of Automation Tools

        It is quite imperative to have a comprehensive grasp of automation tools and techniques as now a days, everything is automated and a DevOps engineer must be skilled at handling automation processes at different levels of development, testing and operation .A distinct and comprehensive knowledge of the infrastructure automation such as creation and configuration of apps and systems, app deployments etc. encourages the ability to maintain better processes. He or she must have comprehensive knowledge of Jenkins, Bamboo, Hudson Thought Works, and other tools to move ahead.

        Testing

        A DevOps engineer is responsible for the proper administration of testing procedures at all levels. So, it is imperative for him or her to have good knowledge of testing tools and other applications. It also makes him capable of identifying the bugs at any stage quite easily – so debugging and resolutions become easy.

        Moving on with this article on Pre-requisites For DevOps,

        Excellent Collaboration

        Two personal skills which make a DevOps engineer quite an efficient one is- excellent collaboration and communication skills as DevOps targets on collaborative support services. Excellent communication skills help in avoiding any misinterpretation and it helps in agile functioning. Being adaptable allows DevOps engineers to pick up new jobs briskly and share their skills to various areas when required. A good DevOps engineer must be a problem solver, both in the cloud and in real life.

        Grasp of Networking

        The DevOps engineer should have a grasp of networking too as efficient networking enables the final developments, applications or services to be promoted to the client’s environment as per the desired design and planning.

        Logical Attitude

        A good rational, logical and comprehensive outlook is also a trait required for being a successful DevOps engineer as sometimes it will be his or her sole responsibility to take immediate decisions for smooth and successful functioning in the organization.
        Excellent leadership qualities marshalled with super communicational and professional expertise attribute to the success of a DevOps engineer.

        Passion

        It is the ultimate key to unwind any trouble in being a success as a candidate who is passionate about his or her work, will definitely hit the bull’s eye. It is the chief prerequisite that can never be overlooked, even in the world of digital clouds and coding.

        This brings us to the end of this article on Pre-Requisites For DevOps.

        Check out the DevOps training by Edureka, a trusted online learning company with a network of more than 250,000 satisfied learners spread across the globe. The Edureka DevOps Certification Training course helps learners to understand what is devops and gain expertise in various DevOps processes and tools such as Puppet, Jenkins, Nagios, Ansible, Chef, Saltstack and GIT for automating multiple steps in SDLC.

        Got a question for us? Please mention it in the comments section and we will get back to you.

        What are Important Advantages and Disadvantages Of Python?

        $
        0
        0

        Let us dive into one more article in this ongoing series on Python. In this article we will see what are the advantages and disadvantages of python. Clearly advantages are far more outweighed than disadvantages which we will see eventually.

        The complete article has been divided into following categories to make the most of the article:

        Lets begin!

        Applications of Python:

        Creating GUI based desktop applets.

        Using libraries like Tkinter, pyQt and pyGame developers can develop desktop applets supporting GUI.

        Web servers programming.

        Using libraries like django and flask developers can do server side programming for web servers for backend development.

        Prototyping

        Python provides quick and rapid prototyping of any software models so that it can be presented to the clients.

        Game development

        Using libraries like pygame developers can develop games having GUI.

        Data science and machine learning

        By far the most used application of python is in data science and machine learning. With its strong community and vast libraries the data processing has become quite easy in python. Be it data manipulation, data visualization, data cleaning python has its own libraries for the same. If you have data that you must know python.

        So far we learnt about Applications of Python, let us continue with this article on advantages and disadvantages of Python,

        Advantages Of Python

        With the emerging python community and open source libraries python has grown into a complete software development package.

        Driven By Vast And Active Community

        Python has one of the most known and active community which helps them in continuous improvement of the python. No wonder it was the top ranked platform on stack overflow.
        Python language is distributed under open source license which makes its development easy via open source contributions.

        Learning Curve

        With most of the programming languages their learning curves tends to grow parabolic with time that means it is hard to grasp early but as soon you become familiar with this language the learning becomes easy. But in case of python the learning is easy because of easy syntax and short hand writing.

        Moving on with this article on advantages and disadvantages of Python,

        Third Party Libraries

        Standard python package installer (PIP) can help you install numerous modules that make python interactive. These libraries and modules can interact from internet protocols, operating system calls and many more.
        You can do socket programming for networking and use os module for system calls that runs user level threads.

        Integration With Other Languages

        Integration libraries like Cython and Jython makes python integrate with c/c++ and java for cross platform development. This makes python even more powerful since we all know no language is complete and advisable to use single language for everything development. Every language has its own forte, so using these libraries you can enjoy powerful, features of each language.

        Productivity

        With python batteries included philosophy the developers get a head start without downloading separate modules and packages. Alongside python easy syntax and rapid prototyping the productivity increases nearly 40% as compared to traditional programming languages.

        Conclusion

        In comparison to different programming languages Python is the most broadly used via the developers currently. The critical Python language benefits are that it is easy to read and smooth to check and learn. It is less complicated to install packages and writing a software in Python than in C or C++. Some other benefits of Python programming is that no computer virus can originate a segmentation fault since there are no concepts of pointers or references in python.
        An important advantage of Python language over traditional programming languages is that it has wide applicability and acceptance, and is appreciably utilized by scientists, engineers, and mathematicians. it is due to this that Python is so beneficial for prototyping and all kinds of experiments. It is also used at the same time as generating animation for films and in machine learning and deep learning.

        Moving on with this article on advantages and disadvantages of Python,

        Disadvantages Of python

        We have seen the major advantages of the popular programming language Python. But we all know there are two sides of a coin!
        Python has indeed several drawbacks too, that makes developers stay away from it. So let’s see one by one:-

        Slow speed

        Python uses interpreter that loads it line by line instead of compiler that executes the whole file at once. This makes compilation slower and tends to perform slowly. This is the major reason competitive programmers don’t use python. C++ provides more computation per seconds instead of python. Moreover this is why python is not extensively used in application development.

        Error detection in codes

        Since python uses interpreter the error in codes does not come up during code compiling. Python uses dynamically typed variables which makes testing more hectic. All these errors came out to be a run-time error which no developers want in their program. This makes python less usable for GUI applets developments.

        Weak in mobile devices:

        We have seen python in web servers and desktop applications along with scripts that its used for. But it is not considered favorable for mobile devices because it uses more memory and slow processing compared to other languages.

        Moving on with this article on advantages and disadvantages of Python,

        Large memory consumption

        Python design structure is such that it uses large memory while processing as compared to other languages as C/C++. This makes Python a complete no no for development under tight memory restrictions.

        Conclusion:

        The language is seen as a less suitable platform for cellular development and game development. It’s far frequently used on desktop and server, but there are the handiest several mobile packages that were used majorly with Python. Every other drawback Python has is the runtime errors. The language has a whole lot of design limitations .Python executes with an interpreter instead of the compiler, which speeds down the performance.

        Lets look into the Final thoughts.

        Final thoughts:

        Although there are many disadvantages with python but we can clearly see that the advantages outweigh the disadvantages by a fair margin. Every programming language has its own forte and areas of interest that developers tend to get excited about. Python has its own areas where it is being used extensively. Although in the areas like web development JavaScript is mainly used, similarly in game development unity or real engine is used. Python finds it usages in scripting, data processing, numerical mathematics and research.

        This is it from my side!

        If you found this article on “Advantages and disadvantages of Python” relevant, check out the Edureka Python Certification Training, a trusted online learning company with a network of more than 250,000 satisfied learners spread across the globe. This training helps learners gain expertise in scripting in Python and prepare individuals to take up Python job opportunities.

        Got a question for us? Please mention it in the comments section of “Advantages and disadvantages of Python” blog and we will get back to you at the earliest.

        Viewing all 1753 articles
        Browse latest View live


        Latest Images