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

Vol. XX – Edureka Career Watch – 21st Sep 2019

$
0
0
“If opportunity doesn’t knock, build a door.” – Milton Berle

 

We are now approaching the last quarter of the year 2019. And this year been one of the best in terms of job and career trends. The job outlook has been bright this year as we saw hundreds of openings being listed by top companies. The hiring statistics are still on the rise but many of us might not have the time to dig into these trends. Fortunately, we have the Edureka Career Watch that brings these opportunities to you and ensures that you are informed and are completely in command of your career.

So, without any further ado, let us have a look at what the job market has in store for us this week.

DXC Tech may Hire 10,000 Hands with Digital Tech Skills in India

As the tech services giant chases growth, India is significantly contributing to overall digital transformations. DXC Technology has recently joined other global firms in order to increase its offshore base in India since they struggled to find relevant talent in developed markets such as the US. It has cut jobs in the traditional tech services roles, looking to get more people with digital skills.

Analysts said the company is focusing primarily on a combination of capability building and cost reduction and in this context hiring in India makes sense.

As the company is looking to transform faster and remain competitive, DXC Technology is planning to hire over 10,000 people in India this year with a strong focus on candidates with digital technology skills.

via Economic Times

Up-skill yourself today to ensure you can take full advantage of these trends.

Amazon is Looking to Hire Around 700 Employees for Work-at-Home Job Openings

BlackJobs.com has partnered with Amazon to promote their virtual or work-from-home positions available to qualified individuals. Amazon has more than 700 remote job openings for customer service associates, shipping and delivery support associates, IT engineers, systems engineers, cloud infrastructure architects, engagement managers, principal project managers, and more!

The perks of being an Amazon employee not only include collaborating with great people on exciting and innovative projects but also a full range of benefits to regular, full-time US employees that support them and eligible family members, including domestic partners and their children.

Some of these benefits include:

  • Medical, prescription drug, dental and vision coverage
  • 401(k) savings plan
  • Paid time-off and Holiday overtime pay

via Pittsburgh courier

Employers are Hiring, but 80% say they Can’t Find Skilled Candidates

A recent study by Indeed found that employers need tech skills in marketing, finance, sales, and other departments. However, the skills shortage is more severe in the tech industry. According to a survey from Modis and General Assembly, 80% of decision-makers acknowledged a tech talent gap in their industry. The number of decision-makers planning to raise headcounts decreased from 79% in the year 2018 which is possibly an indication that confidence in hiring could be slipping in anticipation of a possible economic downturn or in response to skills shortages.

According to a survey of 150 HR leaders by Challenger, Gray & Christmas, Inc., more than 82% of employers said they’re actively hiring, despite predictions of an economic downturn. However, 80% of the respondents reported having difficulty finding workers with 70% identifying skills shortages as the reason. 43% of Challenger’s respondents reported that applicants do not have the needed skills. Another 43% said they do not receive enough applicants, with 27% noting that candidates who do apply are not qualified.

Emerging technologies and automation are infiltrating every industry. Employers need workers who are familiar with adapting to and working with new technologies. A lot of job openings exist but it is up to job seekers to be able to market themselves in a way that appeals to hiring authorities. This means clearly outlining skills and accomplishments, earning certifications, or learning new skills, whether that means taking classes in coding, business administration, or financial technology.

via HR Drive

Up-skill today to ensure you never miss out on opportunities like these.

Passionate About Designing Games? These Job Openings Might be for You

According to a report by industry body NASSCOM, India’s mobile games market is expected to reach 628 million users and will be worth $1.1 billion by 2020.

With a lot of emerging startups focusing on gaming, the industry has a number of jobs to offer for different profiles like an animator, creative director, game artist, game designer, etc.

However, at present, the game designer profile is the most in-demand in the ecosystem. A game designer creates a virtual world along with the setting, story flow, characters, game levels, and rules. They conceive original ideas and build prototypes used in a range of devices and platforms. They enhance the user experience and work on the minute details of the game ensuring the games are engaging and interactive.

Here is a list of job openings for game designers:

Zynga
Zynga is looking out for an enthusiastic game designer who can work with UX, engineering, and product management for adding new features in the game.

Goalreify
The candidate has to create, document, and design gameplay elements. They would have to work with testers, artists, and gameplay programmers to review and validate the game environment.

Juego Studio Private Limited
The company is searching for a passionate game designer who will efficiently create and design documentation on projects.

via Your Story

Openings for Backend Developers in Flipkart, Paytm and More

With more and more product companies and startups spreading across the technology space, founders and CTOs rely on backend developers and the coding craftsmanship they bring to the table. Since backend development has been in demand for a long time, every developer enjoys a good salary and perks in almost any software development company in the world.

Here is a list of few openings for backend developers in the Indian startup ecosystem:

Razorpay (Senior Backend Developer)
The candidate will be involved in product and design discussions, and help the startup scale payments in the country.

Hive (Backend software engineer)
The candidate is expected to design, implement, and improve features in a variety of backend systems like REST APIs, microservices, data ingestion and processing systems, and distributed task/job processing systems.

Flipkart (Software development engineer – Backend)
The candidate will work on end-to-end software design for speech/dialogue based systems using Flipkart’s machine learning models. The required skills are Java, C++, OOPS, Design, Programming.

Paytm (Backend Developer)
Paytm is looking for Node.js ninjas who can help the startup design cutting-edge scalable products to meet its growing business. The candidate is expected to be proficient in multiple programming languages, both dynamic (JavaScript, Python, etc.) and strongly typed object-oriented languages.

via Your Story

Learn full-stack development today to take full advantage of these trends.

We have some more good news for you! Edureka Career Watch is now also available as a video. Follow us on Instagram, LinkedIn, Facebook, and Twitter to never miss out on the latest news.

Make full use of Edureka’s expertise in the education and career counselling space. Speak with our course advisors today to get a clearer picture of your career path and more. Call us at: IND: +91-960-605-8406 / US: 1-833-855-5775 (toll-free).

These were the major news stories related to job openings and career trends in the market this week. If you have any questions, suggestions or there are any specific topics you’d like us to cover, feel free to hit us up in the comments section below. Edureka Career Watch will be back next week with the top stories that you need to know. So, make sure you are subscribed to our blog through the subscription button below and never miss these important updates.


Java Enum Tutorial: What is it and How to Implement it?

$
0
0

The Enumeration in Java is a way of defining a class with fixed and named constants with their respective datatypes using the keyword enum. In this “Java Enum Tutorial” article, we will learn to define Enumeration along with examples for a better understanding.

 

What is Enumeration?

Java Enums are classes that have a fixed set of constants or variables that do not tend to change. The enumeration in Java is achieved using the keyword enum. The Java enum constants are static and final implicitly. The Enum feature is available since JDK version 1.5.

 

Why do we Need Enumeration?

enum improves type safety at compile-time checking to avoid errors at run-time by avoiding boilerplate code. For example, if you have to select one possibility out of the least number of available options, say,

Job Type: (Contract / Temporary / Permanent)

Then the best option would be using an enum. Because enum can be easily used in the switch. enum can be traversed. enum can have fields, constructors and methods. Hence, it increases compile-time checking and avoids errors due to passing in invalid constants, as you have already documented which values are legal to be used.

 

Differences between Enum and Class

Though a class and enum have similar functionality in Java environment, they differ in a few aspects. Let us discuss the differences

Enum Class
Enum constants cannot be overridden Class constants can be overridden
Enum does not support Creation of Objects Class support the Creation of Objects
Enum cannot extend other classes A class can extend other classes
Enum can implement Interface A class can implement Interface


Practical Examples of Enum

Now, to understand enum in a much better way, let us execute some practical examples based on the following.

 

Defining Enumeration in Java

Enum can be declared either inside a class or outside a class. But, it cannot be declared inside any method. Let’s take a small example to understand its syntax, definition, and declaration.

Syntax:

enum name{constants;}

In this example, we have declared the main() method inside enum

package definition;

public class Edureka {
     enum Level {
           BAJA, KTM, YAMAHA
     }
     public static void main(String[] args) {
           Level myVar = Level.KTM;
           System.out.println(myVar);
     }
}

//Ouput

KTM

In this example, the main() method is declared outside of enum.

package definition;

enum Color{
      BAJAJ, KTM, YAMAHA;
}
public class Edureka{
      public static void main(String[] args){
              Bike b1 = Color.YAMAHA;
              System.out.println(b1);
      }
}

//Output:

YAMAHA

 

Enum used in Switch Case

Enumeration can be used in a switch statement as well. It is important that all the case statements must use constants from the same enum as used by the switch statement. Let us check an example based on this.

Here, we will declare an enum with days of the week as its elements and we shall pass the data in the form of a string to print the data of the matching case.

package switched;

enum Day{
      SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY;
}
public class Edureka{
      Day day;
      public Edureka(Day day){
            this.day = day;
      }
      public void dayIsLike(){
            switch (day){
                   case MONDAY: System.out.println("Hi, Today is Monday");
                                               break;
                   case TUESDAY: System.out.println("Hi, Today is Tuesday");
                                               break;
                   case WEDNESDAY: System.out.println("Hi, Today is Wednesday");
                                               break;
                   case THURSDAY: System.out.println("Hi, Today is Thursday");
                                               break;
                   case FRIDAY: System.out.println("Hello, Today is Friday.");
                                               break;
                   case SATURDAY: System.out.println("Hi, Today is your Weekend");
                                               break;
                   case SUNDAY: System.out.println("Hi, Today is a Holiday");
                                               break;
                   default: System.out.println("Please enter a valid day.");
                                               break;
             }
      }
      public static void main(String[] args){
            String str = "MONDAY";
            Edureka e1 = new Edureka(Day.valueOf(str));
            e1.dayIsLike();
      }
}

//Output:

Hi, Today is Monday

 

Inheritance using enum

Basically, any enum is represented as a class that extends the abstract class java.lang.Enum and has several static members. Therefore, an enum cannot extend any other class or enum there is no multiple inheritances. Let us execute an example to understand it in a better way.

Here, we will inherit the OS based on the phone maker.

package inheritance;

import java.util.ArrayList;
import java.util.List;

public class Edureka {
       public static void main(String[] args) {
              List<HTTPMethodConvertible> inherit = new ArrayList<>();
              inherit.add(LibraryEnum.FIRST);
              inherit.add(ClientEnum.google);
              for (HTTPMethodConvertible element : inherit) {
                     System.out.println(element.getHTTPMethodType());
              }
       }
       static interface HTTPMethodConvertible {
              public String getHTTPMethodType();
       }
       static enum LibraryEnum implements HTTPMethodConvertible {
              FIRST("Google Pixel"), SECOND("Huawei"), THIRD("Apple 11 Pro");
              String httpMethodType;
              LibraryEnum(String phone) {
                    httpMethodType = phone;
              }
              public String getHTTPMethodType() {
                    return httpMethodType;
              }
       }
       static enum ClientEnum implements HTTPMethodConvertible {
             huawei("HongMing OS"), apple("iOS"), google("Android One");
             String httpMethodType;
             ClientEnum(String s) {
                   httpMethodType = s;
             }
             public String getHTTPMethodType() {
                   return httpMethodType;
             }
       }
}

//Output:

Google Pixel
Android One

 

Enum with customized values

Enums have their own string values by default, we can also assign some custom values to enums. Let us consider the below example.

enum  Traffic
{
    RED(“STOP”), ORANGE(“WAIT”), GREEN(“GO”);
}

In the above example, we can see that Traffic enum have three members. Namely,

RED, ORANGE and GREEN with have their own different custom values STOP, WAIT and GO respectively.

Now to use the same type of enum in code we are expected to follow some points that are:

  • We need to create parameterized constructor for this enum class. Because we know that enum class’s object can’t be created explicitly so for initializing we use parameterized constructor.
  • The constructor cannot be the public or protected it must have private or default modifiers. If we create public or protected, it will allow initializing more than one objects which are totally against enum functionality.
  • We have to create a getter method to get the value of enums.

Let us execute a program based on this.


package traffic;

enum TrafficSignal {
      RED("STOP"), GREEN("GO"), ORANGE("WAIT");
      private String action;
      public String getAction() {
             return this.action;
      }
      private TrafficSignal(String action) {
             this.action = action;
      }
}
public class Edureka {
      public static void main(String args[]) {
              TrafficSignal[] signals = TrafficSignal.values();
              for (TrafficSignal signal : signals) {
                      System.out.println("name : " + signal.name() + " action: " + signal.getAction());
              }
       }
}

//Output:

name: RED action: STOP
name: GREEN action: GO
name: ORANGE action: WAIT

 

Enum in if-else-if statements

Now, let us execute a program based on enum in if-else-if statements. Here, we will find the direction of traversal by passing the values of directions available in the enum.

package Directions;

enum Directions {
      EAST, WEST, NORTH, SOUTH
}
public class Edureka {
      public static void main(String args[]) {
            Directions dir = Directions.NORTH;
            if (dir == Directions.EAST) {
                   System.out.println("Direction: East");
            }
            else if (dir == Directions.WEST) {
                   System.out.println("Direction: West");
            } 
            else if (dir == Directions.NORTH) {
                   System.out.println("Direction: North");
            } 
            else {
                   System.out.println("Direction: South");
            }
      }
}

//Output:

Direction: North

 

Different methods used with enum

 

Values(): When you create an enum, the Java compiler internally adds the values() method. This method returns an array containing all the values of the enum.

//Syntax:

public static enum-type[ ] values()

We will find out the index value of a particular element in an array.

package values;

enum Color {
      RED, GREEN, BLUE;
}

public class Edureka {
      public static void main(String[] args) {
           Color arr[] = Color.values();
           for (Color col : arr) {
                  System.out.println(col + " at index " + col.ordinal());
           }
           System.out.println(Color.valueOf("RED"));
      }
}

//Output:

RED at index 0
GREEN at index 1
BLUE at index 2
RED

 

ValueOf(): This method is used to return the enumeration constant whose value is equal to the string passed as an argument while calling this method.

//Syntax:

public static enum-type valueOf (String str)

Here, we will find the cost of a particular phone based on the input we pass to the string.

package valuesof;

enum Mobile {
       Samsung(1099), Apple(1250), Google(1325);
       int price;
       Mobile(int p) {
             price = p;
       }
       int showPrice() {
             return price;
       }
}
public class Edureka {
       public static void main(String args[]) {
             System.out.println("CellPhone List:");
             for (Mobile m : Mobile.values()) {
                   System.out.println(m + " costs " + m.showPrice() + " dollars");
             }
             Mobile ret;
             ret = Mobile.valueOf("Samsung");
             System.out.println("Selected : " + ret);
       }
}

//Output:

Samsung costs 1099 dollars
Apple costs 1250 dollars
Google costs 1325 dollars
Selected: Samsung

 

Ordinal(): The Java interpreter adds the ordinal() method internally when it creates an enum. The ordinal() method returns the index of the enum value.

//Syntax:

public final int ordinal()

Here, we will find out the index value of a particular element in an array. and also, the position of the cherry fruit.

Package ordinal;

enum Fruits {
      Apple, Banana, Cherry, Date, Elderberry
}

enum Vegetables {
      Carrot, Beetroot, Beans, Tomato, Onion
}

public class Edureka {
      public static void main(String[] args) {
            Fruits[] fru = Fruits.values();
            for(Fruits fr : fru){
                    System.out.println(fr+" : "+fr.ordinal());
            }
            Fruits f1,f2,f3;
            f1  = Fruits.Apple;
            f2 = Fruits.Cherry;
            f3 = Fruits.Apple;
            if(f2.compareTo(f1) > 0){
                  System.out.println(f2+" comes after "+f1);
            }
            Vegetables v1 = Vegetables.Beetroot;
            if(f1.equals(v1)){
                  System.out.println("Incorrect");
            }
      }
}

//Output:

Apple : 0
Banana : 1
Cherry : 2
Date : 3
Elderberry : 4
Cherry comes after Apple

 

Advantages of Enum

  • Enum in Java  improves type safety
  • Enum is designed to be easily useable in switch cases
  • Enum can be traversed
  • Enum can have fields, methods, and constructors
  • Enum can implement interfaces
  • Enum cannot extend a class because internally, it extends Enum class

 

Enum Usecase: Rock, Paper, Scissors Game

We will use enum in Java to create our childhood game, the rock(stone) paper and scissors. The following code explains how.

package Edureka;
import java.util.Random;
import java.util.Scanner;

enum HandSign {
       SCISSOR, PAPER, STONE
}

public class SPS {
      public static void main(String[] args) {
            Random random = new Random();
            boolean gameOver = false;
            HandSign playerMove = HandSign.SCISSOR;
            HandSign computerMove;
            int numTrials = 0;
            int numComputerWon = 0;
            int numPlayerWon = 0;
            int numTie = 0;
            Scanner in = new Scanner(System.in);
            System.out.println("nLet us begin...n");
            while (!gameOver) {
                   System.out.printf("%nScissor-Paper-Stonen");
                   boolean validInput;
                   do {
                        System.out.print("nYour turn (Please Enter s for a scissor, p for paper, t for stone, q to quit): n");
                        char inChar = in.next().toLowerCase().charAt(0);
                        validInput = true;
                        if (inChar == 'q') {
                               gameOver = true;
                        }
                        else if (inChar == 's') {
                               playerMove = HandSign.SCISSOR;
                        }
                        else if (inChar == 'p') {
                               playerMove = HandSign.PAPER;
                        }
                        else if (inChar == 't') {
                               playerMove = HandSign.STONE;
                        }
                        else{
                               System.out.println("nPlease check the input and try again!n");
                               validInput = false;
                        }
                   } while (!validInput);
                   if (!gameOver) {
                         int aRandomNumber = random.nextInt(3);
                         if (aRandomNumber == 0) {
                              computerMove = HandSign.SCISSOR;
                              System.out.println("nIt's My turn: SCISSORn");
                         } 
                         else if (aRandomNumber == 0) {
                              computerMove = HandSign.PAPER;
                              System.out.println("nIt's My turn: PAPERn");
                         } 
                         else {
                              computerMove = HandSign.STONE;
                              System.out.println("nIt's My turn: STONEn");
                          }
                         if (computerMove == playerMove) {
                              System.out.println("nIt's a Tie!n");
                              ++numTie;
                         } 
                         else if (computerMove == HandSign.SCISSOR &amp;&amp; playerMove == HandSign.PAPER) {
                              System.out.println("nScissor cuts paper, I won!n");
                              ++numComputerWon;
                         } 
                         else if (computerMove == HandSign.PAPER &amp;&amp; playerMove == HandSign.STONE) {
                              System.out.println("nPaper wraps stone, I won!n");
                              ++numComputerWon;
                         } 
                         else if (computerMove == HandSign.STONE &amp;&amp; playerMove == HandSign.SCISSOR) {
                               System.out.println("nStone breaks scissor, I won!n");
                              ++numComputerWon;
                         } 
                         else {
                              System.out.println("nCongratulations...! You won!n");
                              ++numPlayerWon;
                         }
                          ++numTrials;
                   }
            }
            System.out.printf("%nThe number of trials: " + numTrials);
            System.out.printf("I won %d(%.2f%%). You won %d(%.2f%%).%n", numComputerWon, 100.0 * numComputerWon / numTrials, numPlayerWon, 100.0 * numPlayerWon / numTrials);
            System.out.println("Bye!, Hope you enjoyed..!");
      }
}

//Output:

Let us begin...
Scissor-Paper-Stone
Your turn (Please Enter s for a scissor, p for paper, t for stone, q to quit):
s
It's My turn: STONE
Stone breaks scissor, I won!
Scissor-Paper-Stone
Your turn (Please Enter s for a scissor, p for paper, t for stone, q to quit):
q
The number of trials: 1I won 1(100.00%). You won 0(0.00%).
Bye!, Hope you enjoyed..!

 

With this, we come to an end of this Java Enum Tutorial. I hope you have understood the Enum in Java and its implementation through some real-time examples.

Now that you have understood enum basics through this “Java Enum Tutorial” 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 courses are 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? Mention it in the comments section of this “Java Enum Tutorial” blog and we will get back to you as soon as possible.

How to Create and Delete a Database in phpMyAdmin

$
0
0

In order to handle the administration of MySQL over the web, phpMyAdmin is a free software tool that is written in PHP. Wide range of operations on MySQL and MariaDB are supported by phpMyAdmin. Various operations like managing databases, tables, columns, relations, indexes, users etc can be performed through its user interface and also can execute any SQL statement. Generally, the database consists of one or more tables. Special CREATE privileges are needed to create or delete a database in phpMyAdmin in the following order:

 

Create a database in phpMyAdmin

Open localhost dashboard and click on phpMyAdmin.

Now create a database either through MySQLi or manually. In order to do it manually, click on databases and create a new one.

You can also change privileges and set up a new user login to access this database by clicking on add user account as shown in the screenshot below

You can also create a database using MySQLi procedural as shown in the example below:

// Create connection
$conn = mysqli_connect($servername, $username, $password);
// Check connection
if (!$conn) 
{
    die("Connection failed: " . mysqli_connect_error());
}

// Create database
$sql = "CREATE DATABASE mydatabase";
if (mysqli_query($conn, $sql)) 
{
    echo "Database created successfully";
} else 
{
    echo "Error creating database: " . mysqli_error($conn);
}

mysqli_close($conn);
?>

 

//Output:

Database Created Successfully

 

Delete a database in phpMyAdmin

Go the phpMyAdmin home page and select the database which you want to delete. Now select operations and click on drop the database as shown in the screenshot below.

You can also drop the database using SQL query as shown in the screenshot below:

DROP DATABASE mydatabase;

With this, we come to an end of this How to Create and Delete a Database in phpMyAdmin article. I hope you have learned about how to create and delete a database in phpMyAdmin by manually and also by using a query.

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. It will give you a good understanding of PHP.

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

What are magic methods in PHP? and How to Implement them?

$
0
0

In PHP, special functions can be defined in such a way that they can be called automatically and does not require any function call to execute the code inside these functions. This feature is available in a special method known as magic methods. In this article, we will discuss the top Magic Methods in PHP.

 

What are Magic Methods in PHP?

Methods that begin with 2 underscores(__) are generally called Magic methods in PHP. These methods names are limited to some list of PHP supported keywords that are reserved. So any function should not be defined with the name of PHP magic methods.

Usually, these functions should be defined by the user and there is no need to call them explicitly.

 

List of Magic Methods in PHP

  • __construct()
  • __destruct()
  • __call($fun, $arg)
  • __callStatic($fun, $arg)
  • __get($property)
  • __set($property, $value)
  • __isset($content)
  • __unset($content)
  • __sleep()
  • __wakeup()
  • __toString()
  • __invoke()
  • __set_state($array)
  • __clone()
  • __debugInfo()

 

 

  • __construct(): It is a method that gets called automatically after the creation of an object. Any number of arguments can be defined here that will be passed when objects are created.
class sample
{
	function user_def()
	{
		echo "user defined constructor";
	}
	function __construct()
	{
		echo "predefined constructor";
	}
}
$obj= new sample();
?>

 

  • __destruct(): Destructor is a common feature of the object-oriented language that gets triggered as soon as there are no other references to a particular object.
<?php class sample { function __construct() { echo "Constructor initialised"." "; } function user_def() { echo "User defined function "." "; } function __destruct() { echo "after user definition, object gets destroyed automatically"." "; } } $obj= new sample(); $obj->user_def();
//check object is destroyed or not
echo is_object($obj)."
";

?>

 

  • __call($fun, $arg): This method is called when an undefined or inaccessible method is called. Which means it is Called when an undefined or inaccessible method is invoked on an object.
<?php class Sample { function user_define() { echo "This is user defined function "; } function __call($fun, $arg) { echo "function that not exists:" . $fun." "; echo "parameter list of method that does not exist:"; print_r($arg); } } $obj = new Sample(); $obj->run("teacher"); // If the method which is not existed is called within the object, then the __call() method will be called automatically.
$obj->eat("ashok", "orange");             
$obj->user_define();
?>

 

  • __callStatic($fun, $arg): This method is called when an undefined or inaccessible method is invoked in a static manner.
<?php class Sample { function user_define() { echo "This is user defined function "; } public static function __callStatic($fun, $arg) { echo "Method that does not exist:" . $fun . " "; echo "parameter list of method that does not exist:"; print_r($arg); } } $obj = new Sample(); $obj::run("Student"); // If the method does not exist is called within the object, then the __callStatic() method will be called automatically. $obj::eat("ashok", "orange"); $obj->user_define();
?>

 

  • __get($property):  This method is used for getting values for class properties created dynamically by PHP property overloading.
<?php class Student { private $name; private $reg; function __construct($name="", $reg=1) { $this->name = $name;
        $this->reg = $reg;
    }

    public function __get($propertyName)
    {   
        if ($propertyName == "reg")
		{
            if ($this->reg>30)
			{
                return $this->reg - 10;
            } else 
			{
                return $this->$propertyName;
            }
        } 
		else 
		{
            return $this->$propertyName;
        }
    }
}
$obj = new Student("Ashok", 60);   // Instantiate the object with the Student class and assign initial values to the properties with the constructor.
echo "Name:" . $obj->name . "
";   // When the private property is accessed, the __get() method will be called automatically,so we can get the property value indirectly.
echo "reg:" . $obj->reg . "
";    // The __get() method is called automatically,and it returns different values according to the object itself.
?>

 

  • __set($property, $value):  This method is used for putting values for class properties created dynamically by PHP property overloading.
<?php class Student { private $name; private $reg; public function __construct($name="", $reg=30) { $this->name = $name;
        $this->reg = $reg;
    }

    public function __set($property, $value)
    {
        if ($property=="reg")
        {
            if ($value > 150 || $value < 0) { return; } } $this->$property = $value;
    }

    public function fun()
	{
        echo "My name is ".$this->name.",My registration number is ".$this->reg;
    }
}

$obj=new Student("Ashok", 40); //Note that the initial value will be changed by the code below.
$obj->name = "Sushma";     //The "name" property will be assigned successfully. If there is no __set() method, then the program will throw an exception.
$obj->age = 16; //The "reg" property will be assigned successfully.
$obj->reg = 160; //160 is an invalid value, so it fails to be assigned.
$obj->fun(); 
?>

 

  • __isset($content): This method will be called while calling isset()  or empty() for an undefined or inaccessible member. It is invoked automatically while checking whether a required overloaded property is set or not, by using the PHP isset() function.
<?php class Student { public $gender; private $name; private $reg; public function __construct($name="", $reg=30, $gender='Male') { $this->name = $name;
        $this->reg  = $reg;
        $this->gender  = $gender;
    }

    public function __isset($content)
	{
        echo "The {$content} property is private,the __isset() method is called automatically.
";
        echo  isset($this->$content);
    }
}

$obj = new Student("Ashok", 30); // Initially assigned.
echo isset($obj->gender),"
";
echo isset($obj->name),"
";
echo isset($obj->reg),"
";
?>

 

  • __unset($content): This method will be called while calling reset() for an undefined or inaccessible member.
<?php class Student { public $gender; private $name; private $reg; public function __construct($name="", $reg=30, $gender='Male') { $this->name = $name;
        $this->reg  = $reg;
        $this->gender  = $gender;
    }

    
    public function __unset($content)
	{
        echo "It is called automatically when we use the unset() method outside the class.
";
        echo  isset($this->$content);
    }
}

$obj = new Student("Ashok", 30); // Initially assigned.
unset($obj->gender);
unset($obj->name);
unset($obj->reg);
?>

 

  • __sleep(): This method is called first while executing serialize(). It returns the object’s property array on cleaning PHP class objects before serialization.
<?php class Student { public $gender; public $name; public $reg; public function __construct($name="", $reg=25, $gender='Male') { $this->name = $name;
        $this->reg= $reg;
        $this->gender = $gender;
    }
    public function __sleep()
	{
        echo "It is called when the serialize() method is called outside the class.
";
        $this->name = base64_encode($this->name);
        return array('name', 'reg'); // It must return a value of which the elements are the name of the properties returned.
    }
}

$obj = new Student('Ashok'); // Initially assigned.
echo serialize($obj);
echo '
';
?>

 

  • __wakeup(): This method is called while deserialization() is executed. It would reverse work to restore objects properties and resources on invoking deserialization().
<?php class Student { public $gender; public $name; public $reg; public function __construct($name="", $reg=30, $gender='Male') { $this->name = $name;
        $this->reg =$reg;
        $this->gender = $gender;
    }
    public function __sleep() 
	{
        echo "It is called when the serialize() method is called outside the class.
";
        $this->name = base64_encode($this->name);
        return array('name', 'reg'); // It must return a value of which the elements are the name of the properties returned.
    }
    public function __wakeup() 
	{
        echo "It is called when the unserialize() method is called outside the class.
";
        $this->name = 2;
        $this->gender = 'Male';
       
    }
}
$obj= new Student('Ashok'); // Initially assigned.
var_dump(serialize($obj));
var_dump(unserialize(serialize($obj)));
?>

 

  • __toString(): This method will be called while using echo method to print an object directly. It is expected to return a string value while using class instances with PHP printing statements.
<?php class Student { public $gender; public $name; public $reg; public function __construct($name="", $reg=30, $gender='Male') { $this->name = $name;
        $this->reg  = $reg;
        $this->gender = $gender;
    }

    public function __toString()
    {
        return  'go go go';
    }
}

$obj = new Student('Ashok'); // Initially assigned.
echo $obj;
?>

 

  • __invoke(): This method is defined in a class that will be called while trying to call an object in a way of calling function.
<?php class Student { public $gender; public $name; public $reg; public function __construct($name="", $reg=30, $gender='Male') { $this->name = $name;
        $this->reg  = $reg;
        $this->gender  = $gender;
    }

    public function __invoke() 
	{
        echo 'This is an object';
    }

}

$obj = new Student('Ashok'); // Initially assigned.
$obj();
?>

 

  • __set_state($array): This method is called while calling var_export(). It is a static method invoked while exporting objects property array and expects such array variable as its argument.
<?php class Student { public $gender; public $name; public $reg; public function __construct($name="", $reg=30, $gender='Male') { $this->name = $name;
        $this->reg  = $reg;
        $this->gender = $gender;
    }

}
$obj = new Student('Ashok'); // Initially assigned.
var_export($obj);
?>

 

  • __clone(): This method is called when the object is copied.
<?php class Student { public $gender; public $name; public $reg; public function __construct($name="", $reg=30, $gender='Male') { $this->name = $name;
        $this->reg  = $reg;
        $this->gender  = $gender;
    }

    public function __clone()
    {
        echo __METHOD__."you are cloning the object.
";
    }

}

$obj = new Student('Ashok'); // Initially assigned.
$obj2 = clone $obj;

var_dump('object1:');
var_dump($obj);
echo '
';
var_dump('object2:');
var_dump($obj2);
?>

 

  • __debugInfo(): This method is called by var_dump() while dumping an object to get the properties that should be shown. If the method is not defined on an object, then all public, protected and private properties will be shown.
<?php class Sample { private $prop; public function __construct($val) { $this->prop = $val;
    }

 
    public function __debugInfo() 
	{
        return [
            'propSquared' => $this->prop ** 2,
        ];
    }
}

var_dump(new Sample(22));
?>

With this, we come to ann end of this magic method in PHP article. I hope you got an idea of the various magic methods in PHP.

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 ”Magic Methods in PHP” and I will get back to you.

How to Implement Decorators in Python?

$
0
0

Decorators in Python are powerful tools in Python. It allows programmers to modify the behaviour of function or class. Decorators allow to wrap another function to extend the behaviour of the wrapped function, without modifying it. This article will brief the following topics.

Let us begin!

 

Decorators in  Python

Today, we are going to discuss very integral of python i.e. decorators. Decorators can be thought of as a very useful and powerful tool but only if used properly. In simple words: they are functions which modify the functionality of other functions. They help to make our code shorter and more Pythonic.

Definition:
A decorator is a design pattern in Python that allows a user to add new functionality to an existing object without modifying its structure. Decorators are usually called before the definition of a function you want to decorate.

Warning: They are so confusing at first sight, So, tighten your belts because we are going for a deep dive!

Before diving straight, we will take a look at a few of the things that you should know prior to understanding Decorators.
Functions in Python are First Class Citizens. This means that they support operations such as being passed as an argument, returned from a function, modified, and assigned to a variable.

Now, let us look into Function that can be passed as an argument

 

A function can be passed as an argument

You must know about this and if you do not then firstly visit the following link and then come back.

Now, As functions are objects and functions accept objects as arguments, We may conclude that we can pass function to a function. Let’s understand it in a better way with some code.

Due to the fact that every parameter of a function is a reference to an object and functions are objects as well, we can pass functions – or better “references to functions” – as parameters to a function.

def greet(name):
      return “Hey {}”.format(name)
def i_will_greet(greet,name=”Avikar):
      print(greet(name))
      print(“Welcome to the world of edureka”)
i_will_greet(greet)

As we can clearly see that function greet() has been passed as a parameter to the function i_will_greet().

//Output:

Hey Pallavi
Welcome to the world of edureka

 

Note: The function greet has been passed to i_will_greet with no parentheses. Because if you use parenthesis then it will not pass function but its definition.

Let’s consider one more example to make our basics concrete.

from math import sin,cos
def calculate(func):
       res=0
       for i in [1,2,3,4,5]:
              res+=func(i)
       return res
print(“the value of sin is {}”.format(calculate(sin)))
print(“the value of cos is {}”.format(calculate(cos)))

//Output:
The value of sin is 0.1761616497223787
the value of cos is -1.2358184626798336

 

Let us look into the second Function that can be defined within functions

 

Functions can be defined within functions

The concept of having or defining functions inside a function is completely new to C or C++ programmers. We already know about nesting and surprisingly we can nest our functions too i.e. we can define as many functions as we want within a function.

def tell_me():
      def question():
            print("is python boring")
     def answer():
            print("Definintely not. Silly!")
     question()
     answer()
     return "look now you know what to learn"

//Output:
is python boring?
Definitely not. Silly!
look now you know what to learn

 

As it can be easily understood that when tell_me() is called

  • Firstly the function question and answer are defined but not called.
  • Later functions are called within the function itself and a string is returned at the end to print().

To have a firm grasp, Let us consider one more example in which we are required to convert temperature from Celsius to Fahrenheit.

def temperature(t):
      def celsius2fahrenheit(x):
             return 9 * x / 5 + 32
      return (“It’s ”+str(celsius2fahrenheit(t)+” degrees! ”
print(temperature(35))

//Output:
95.0 degrees

 

Let us move onto the third Function that can return functions as well.

 

Functions can return functions as well

It is not necessary to execute a function within another function, we can return it as an output as well.

def bake_cake(flavor="chocolate"):
      print("place the base of cake and decorate it with {} and fruits".format(flavor))
      def cherry():
            return "place cherry at the top of your {} cake".format(flavor)
      return cherry
tasty = bake_cake("butterscotch")
print(tasty())

Output:
place the base of the cake and decorate it with butterscotch and fruits
place cherry at the top of your butterscotch cake

 

Let us consider a useful example in which we assume that we can pass any number of arguments(*args). For a better understanding visit Edureka Community.

We can generalize our factory function so that it can work for polynomials of arbitrary degree

def polynomial_creator(*coeff):
      def polynomial(x):
             for index,c in enumerate(coeff[::-1]):
                     res+=c*x**index
             return res
      return polynomial

The above polynomial_creator function when passed with coefficients of quadratic equation,

  • Defines the polynomial() function.
  • Returns the polynomial function.

Now if we can assign this returned function to a variable(as studied Earlier), we can directly use our wrapped function.

p1 = polynomial_creator(2, 3,-1)
p2 = polynomial_creator(1, 8, -1, 3, 2)
for x in range(-2, 2, 1):
       print(x, p1(x), p2(x))

Note that when p1(x) is called the coeff. are 2,3 and -1 which indicates that the polynomial() is defined when the polynomial_creator() is assigned to p1 or p2, but not called.

So when we call p1() or p2(), we will pass the arguments to the polynomial(x).

As we can see from the output,

  • Firstly, the polynomial_creator has been called twice for p1 and p2.
  • Later, for each print statement polynomial() has been called separately.

//Output:
-2   1  -56
-1  -2   -9
 0  -1    2
 1   4   13

 

Now let’s look into the last Function that can be assigned to a variable

 

The function can be assigned to a variable

Did you notice tasty=bake_cake(“butterscotch”) in above code? Yes, right! We can assign functions to variables too i.e. we create an alias of functions.
The usefulness of the above assignment is:

Even if you delete the function, you can still use it via the variable you created.
Try del bake_cake

With all this knowledge in our cylinder, we are ready for the dive. But, the drive wouldn’t last long if we do not have a diving mask(the very small but important part).
Closure (our diving mask)

Python allows a nested function to access the outer scope of the enclosing function. This is a critical concept in decorators.

For example, let us consider an outer and inner function with their variables.

def outer():
     var =10
     def inner():
           varb=30
           print(“value of var inside inner {}”.format(var))
           print(“value of varb inside inner is {}”.format(varb))
     inner()
     print(“value of var outside inner {}”.format(var))
     print(“value of var_b outside inner is {}”.format(varb))

//Output:
value of var inside inner 10
value of var_b inside inner is 30
value of var outside inner 10
Traceback (most recent call last):
File “<pyshell#5>”, line 1, in <module>
outer()

 

Moving on to Our First Decorator

 

Our First Decorator

To create a decorator:

  • we have a function or class which needs decoration.
  • A decorator function.
  • A wrapper function which will be returned.

To understand it properly, lets first consider an example:

def outer(func):
     print(“inside outer”)
     def inner()
            print("inside inner function”)
            func()
            print(“inside inner again”)
     return inner

We have here defined inner() inside outer(). A function func is to be passed to the function as a parameter.

Now,

def need_decoration():
       print("inside function call")
need_decoration=outer(need_decoration)
inside outer
need_decoration()
inside inner function
inside function call
inside inner again

It’s easy to understand. RIGHT!

Here we have called outer() with function need_decoration() as its parameter. So when outer is called the first print statement is executed and a function inner() is defined with func as need_decoration and inner function is returned.

This returned function is stored in need_decoration.

Now, when need decoration is executed via parenthesis inner function is called.

Two important things you need to understand :

1. The difference between a function call and function definition.

import math
temp=math.sin #temp is assigned the function definition
temp(4)
-0.7568024953079282
temp=math.sin(4) #temp is assigned the value returned by function
print(temp)
-0.7568024953079282

2. One might think that as need_decoration has lost its original definition and assigned to inner(), what will happen when need_decoration is called from inner()?

If you are thinking that it may end into an endless loop where inner() calls func() as need_decoration() and need_decoration is again equivalent to calling inner() then trust me you are not the only one in this dilemma.

This is why decorators turn bit clumsy and tough to understand.

So, This does not happen at all. When you define inner via calling outer as
need_decoration=outer(need_decoration) inner() automatically stores the definition of need_decoration there. We will delve deeper into this later.

You must be thinking that where is “ @ “, the glory of decorators. You will be glad that you have already used it but in a hidden way.
need_decoration=outer(need_decoration)
can be replaced by
@outer above the definition of need_decoration. So after rewriting the above code

 
@outer
def need_decoration():
      print("inside function call")
inside outer
need_decoration()
inside inner function
inside function call
inside inner again

We can do a lot with decorators like Multiple decorators can be applied to a single function. But we will study this in the next article.

This brings us to the end of this article where we have learned how we can use Decorators in python with several examples. I hope you are clear with all that has been shared with you in this tutorial.

If you found this article on “Decorators 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 “Decorators In Python” and our team will be glad to answer.

How to Implement Nested Class in Java?

$
0
0

In Java, a class can be defined within another class and such classes are known as nested classes. These classes help you to logically group classes that are only used in one place. This increases the use of encapsulation and creates a more readable and maintainable code. This blog on “Nested Class in Java” will give you a quick to-the-point introduction to nested classes in the Java language. Below are the topics covered in this blog:

Nested Class in Java

The class written within a class is called the nested class while the class that holds the inner class is called the outer class. Below are some points to remember for nested classes in Java –

  • The scope of a nested class is bounded by its enclosing class.
  • A nested class has access to the members of the class in which it is nested. But, the enclosing class cannot access the members of the nested class.
  • A nested class is its enclosing class member.
  • A nested class can be declared public, private, protected, or package-private.

Types of nested classes

Inner/Non-static nested class: In Java, non-static classes are a security mechanism. A class cannot be associated with the access modifier private, but if you have the class as a member of other class, then the non-static class can be made private.

Types of inner classes −

  • Inner Class
  • Method-local Inner Class
  • Anonymous Inner Class

Inner Class

To create an inner class you just need to write a class within a class. An inner class can be private which cannot be accessed from an object outside the class. Below is a program to create an inner class. In this example, the inner class is made private and is accessed class through a method.

class Outer_Test {
   int num;
   
   // inner class
   private class Inner_Test {
      public void print() {
         System.out.println("This is an Our inner class");
      }
   }
   
   // Accessing he inner class from the method 
   void display_Inner() {
      Inner_Test inner = new Inner_Test();
      inner.print();
   }
}
   
public class My_class {

   public static void main(String args[]) {
      // Instantiating the outer class 
      Outer_Test outer = new Outer_Test();
      
      // Accessing the display_Inner() method.
      outer.display_Inner();
   }
}

Output

 

Method-local Inner Class

In Java, a class can be written within a method and it is a local type. Similar to local variables, the scope of an inner class is restricted within the method. A method-local inner class is incorporated only within the method where the inner class is defined. The below program shows how to use a method-local inner class.

public class Outerclass {
   // instance method of the outer class 
   void my_Method() {
      int num = 1001;

      // method-local inner class
      class StarInner_Test {
         public void print() {
            System.out.println("This is star inner class "+num);	   
         }   
      } // end of inner class
	   
      // Accessing the inner class
      StarInner_Test star = new StarInner_Test();
      star.print();
   }
   
   public static void main(String args[]) {
      Outerclass outer = new Outerclass();
      outer.my_Method();	   	   
   }
}

Output

Anonymous Inner Class

Anonymous inner class is an inner class declared without a class name. In an anonymous inner class, we declare and instantiate it at the same time. They are generally used when you need to override the method of a class or an interface. The below program shows how to use an anonymous inner class –

abstract class AnonymousInnerTest {
   public abstract void mytest();
}

public class Outer_class {

   public static void main(String args[]) {
      AnonymousInnerTest inner = new AnonymousInnerTest() {
         public void mytest() {
            System.out.println("This is an example of anonymous inner test class");
         }
      };
      inner.mytest();	
   }
}

Output-

Static nested class: A static class is a nested class that is a static member of the outer class. Unlike inner class, the static nested class cannot access member variables of the outer class because the static nested class doesn’t require an instance of the outer class. Hence, there is no reference to the outer class with OuterClass.this. The syntax of a static nested class is –

class MyOuter {
   static class Nested_Test {
   }
}

Example of Static Nested Class

public class Outer {
   static class Nested_Test {
      public void my_method() {
         System.out.println("This is Edureka's nested test class");
      }
   }
   
   public static void main(String args[]) {
      Outer.Nested_Test nested = new Outer.Nested_Test();	 
      nested.my_method();
   }
}

Output

Difference Between Static and Non-static Nested Classes

Static nested classes do not have access to other members of the enclosing class directly. Being static, it must access the non-static members of its enclosing class through an object which means it cannot refer to the non-static members of its enclosing class directly. And due to this restriction, static nested classes are seldom used.

Non-static nested classes have access to all members of its outer class and can refer to them directly in the same way that other non-static members of the outer class do.

Before we come to the end of this article, let us look at a few key points.

Key Points to Remember

  • The inner class is treated as a regular member of a class.
  • Since the inner class is members of the outer class, you can apply different access modifiers like protected, private to your inner class.
  • Since the Nested class is a member of its enclosing class, you can use . (dot) notation in order to access the nested class and its members.
  • Using a nested class makes your code more readable and provides better encapsulation.
  • The inner class has access to other members of the outer class, even if they are declared private.

With this, we come to an end of this blog on Nested classes in Java. If you wish to learn more about 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 “Nested Class in Java” blog and we will get back to you as soon as possible.

How To Secure Web Applications With AWS WAF?

$
0
0

This article will tell you how you can Secure Web Applications with AWS WAF and follow it up with a practical demonstration. Following pointers will be covered in this article,

So let us get started then,

Moving on with this article on ‘How To Secure Web Application With AWS WAF?’

Getting Started With Some Fundamentals

AWS provides services like EC2, ELB (Elastic Load Balancer), S3 (Simple Storage Service), EBS (Elastic Block Storage) to create useful and fancy applications quickly and with less CAPEX (CAPital EXpenditure). While creating these applications, it’s equally important to secure the application and protect the data. If not properly secured, the application data might get into the wrong hands as in the case of the recent Capital One incident.

Capital One hosted a Web Application on EC2 and it was not secured properly. An ex-AWS employee was able to exploit this vulnerability and download reams of customer data from S3. Later it was found that the data from 30 other organizations was also downloaded from AWS. So, to stress it again it’s not just enough to architect and design an application, but it’s equally important to secure an application.

Capital One used AWS WAF (Web Application Firewall) to protect the Web Application, but it was not configured properly because of which the hacker was able to get the access to the data in S3 and download it. In this article we will explore how to use and configure AWS WAF to protect against common web attacks like SQL Injection, XSS (Cross Site Scripting) etc. AWS WAF must be configured along with Application Load Balancer, CloudFront or API Gateway. In this scenario, we will use the Application Load Balancer. Any request from the customer via the browser will go through the AWS WAF and then to the Application Load Balancer and finally to the Web Application on the EC2. AWS WAF can be used to block the malicious request from the hackers using a set of rules and conditions.

Moving on with this article on ‘How To Secure Web Application With AWS WAF?’

Sequence of steps to get started with AWS WAF

Step 1: Creating a vulnerable web application,

The first step is to create a web application which is vulnerable to SSRF (Server Side Request Forgery) attacks as mentioned in this blog article on how the Capital One attack happened. This blog article has the sequence of steps to

  1. Create an EC2
  2. Install the required software to create the web application with SSRF vulnerability
  3. Create and IAM role with S3 Read Only permissions
  4. Attach the IAM role to EC2
  5. Finally, exploit the SSRF vulnerability to get the Security Credentials related to the IAM role.

Once the sequence of steps are completed in the mentioned blog, replace 5.6.7.8 with the Public IP address of the EC2 in the below URL and open it in the browser. The Security Credentials associated with the IAM Role should be displayed in the browser as shown below. This is how basically Capital One was hacked. With the Security Credentials in hand, the hacker was able to access other AWS services like S3 to download the data.

http://5.6.7.8:80?url=http://169.254.169.254/latest/meta-data/iam/security-credentials/Role4EC2-S3RO

Step 2: Creating the Application Load Balancer

AWS WAF cannot be directly associated with a Web Application. But, can only be associated with Application Load Balancer, CloudFront and API Gateway. In this tutorial, we would be creating the Application Load Balancer and associating the AWS WAF with the same.

Step 2a: A Target Group is a collection of EC2 instances and must be created before creating the Application Load Balancer. In the EC2 Management Console, click on the Target Group in the left pane and click on “Create target group”.

Step 2b: Enter the Target Group name and click on “Create”. The Target Group will be successfully created.

Step 2c: Make sure that the Target Group is selected and click on the Targets tab and click on edit to register EC2 instances with the Target Group.

Step 2d: Select the EC2 instance and click on “Add to registered” and click on “Save”.

The instances should be registered as shown below for the Target Group.

Step 2e: Time to create the Application Load Balancer. Click  on the Load Balancer in the left pane of the EC2 Management Console and click on “Create Load Balancer”.

Click on “Create” for the “Application Load Balancer”.

Moving on with this article on ‘How To Secure Web Application With AWS WAF?’

Step 2f: Enter the name of the Application Load Balancer. And make sure all the Availability Zones are selected and click on Next.

Step 2g: In the “Configure Security Settings” click on Next.

In the “Configure Security Groups” create a new Security Group or select one of the existing Security Group. Make sure that port 80 is open for accessing the web page on the EC2. Click on Next.

Step 2h: In the “Configure Routing” select “Existing target group” and select the one which has been created in the earlier step. Click on Next.

Step 2i: The target EC2 instances have already been registered as part of the Target Groups. So, in the “Register Target” tab, without any changes click on Next.

Step 2j: Finally, review all the details of the Application Load Balancer and click on Create. The Application Load Balancer would be created as shown below.

Step 2k: Get the domain name of the Application Load Balancer and replace the highlighted text it in the below URL and open the same in the browser. Note that we are accessing the Web Application via the Application Load Balancer and the Security Credentials are displayed as shown below. The below URL can be blocked by using AWS WAF as shown in the subsequent steps to stop leakage of the Security Credentials.

MyALB-1929899948.us-east-1.elb.amazonaws.com?url=http://169.254.169.254/latest/meta-data/iam/security-credentials/Role4EC2-S3RO

Step 3: Creating the AWS WAF (Web Application Firewall)

Step 3a: Go the AWS WAF Management Console and click on “Configure web ACL”. The AWS WAF overview is shown. Here is the hierarchy of AWS WAF. Web ACL has a bunch of Rules and Rules have a bunch of Conditions which we would be creating in the subsequent steps. Click on Next.

Insert image 21 here

Step 3b: Enter the Web ACL name, the Region as North Virginia (or where EC2 was created), the resource type as “Application Load Balancer” and finally select the Application Load Balancer which was created in the earlier step. Click on Next.

Step 3c: Here a condition to block a specific web application request must be created. Scroll down and click on “Create condition” for the “String and regex match conditions”.

Insert image 23 here

Insert image 24 here

Step 3d: Enter the name of the condition, the Type as “String match”, filter on “All query parameters” and rest of the parameters exactly as shown below. And click on “Add filter” and then on Create. Here we are trying to create a condition which matches the URL containing the value of the query parameter as 169.254.169.254. This IP address is related to the EC2 Metadata.

Step 3e: Now is the time to create a rule which is a collection of conditions. Click on “Create rule” and specify the parameters as exactly shown below. Click on “Add Condition”, Create and “Review and create”.

Moving on with this article on ‘How To Secure Web Application With AWS WAF?’

Insert image 29 here

Step 3f: Finally review all the details and click on “Confirm and create”. The Web ACL (Access Control List) will be created and associated with the Application Load Balancer as shown below.

Step 3g: Now try to access the Application Load Balancer URL via the browser as performed in Step 2k. This time we would be getting the “403 Forbidden” as our URL matches the Web ACL condition and we are blocking it. The request never reaches the Application Load Balancer or the Web Application on the EC2. Here we notice that although the application is allowing the access to the Security Credentials, the WAF is blocking the same.

Step 4: Cleaning up the AWS resources created in this tutorial. The clean-up must be done in exactly same order as mentioned below. This is to ensure that AWS stops the billing for the associated resources created as part of this tutorial.

  • Delete Condition in the Rule
  • Delete the Rule in the WebACL
  • Disassociate the ALB in the WebACL
  • Delete WebACL
  • Delete the Rule
  • Delete the filter in the Condition
  • Delete the Condition
  • Delete the ALB and the Target Group
  • Terminate the EC2
  • Delete the IAM Role

Conclusion

As mentioned earlier, creating a Web Application using AWS is very easy and interesting. But we are also must  to make sure that the application is secure and that the data is not leaked into the wrong hands. The security can be applied at multiple layers. In this tutorial we have seen how use the AWS WAF (Web Application Firewall) to protect the Web Application against attacks like matching with IP address of the EC2 Metadata. We could have also used WAF to protect against common attacks like SQL Injection and XSS (Cross Site Scripting).

Using AWS WAF or in-fact any other security product doesn’t make the application secure, but the product must be configured properly. If not configured properly, the data might get into the wrong hands as did happen with Capital One and other Organizations. Also, the other important thing to consider is that Security must be thought from day one and not to plugged into the application at a later stage.

This brings us to the end of this article on How To Secure Web Applications With AWS WAF. We have also come up with a curriculum which covers exactly what you would need to crack the Solution Architect Exam! You can have a look at the course details for AWS Solution Architect training.

Got a question for us? Please mention it in the comments section of this What is AWS blog and we will get back to you.

JavaFX Tutorial: How to create an application?

$
0
0

The JavaFX is a Java platform for creating rich internet applications (RIAs) that can run on a large variety of devices. It is intended to replace Swing in Java applications as a GUI framework. Also, it offers more functionalities than Swing. JavaFX is the next-generation GUI toolkit for the Java Platform. Sounds interesting? In this JavaFX tutorial, let’s explore the concept in detail.

What is JavaFX?s

JavaFX is a Java library used for designing, creating, testing and deploying cross-platform GUI applications and rich internet applications (RIAs) that can run across a wide variety of devices.

  • One incentive to create JavaFX was to replace Swing. Furthermore, JavaFX is more consistent in its design than Swing.
  • It has more features and is more modern too, enabling you to design GUI using layout files (XML) and style them with CSS.
  • JavaFX also integrates 2D + 3D graphics, charts, audio, video, and embedded web applications into one coherent GUI toolkit.

Note: Rich Internet Applications are those web applications that offer similar features and experience as that of desktop applications. They offer better visual experience when compared to the normal web applications to the users.

Now that you are aware of what exactly JavaFX is, check out the architecture part of it in the next part of this JavaFX tutorial.

JavaFX Architecture

JavaFX has various built-in components which are interconnected with each other. It contains a rich set of APIs which are more than enough to develop rich internet applications which run consistently across many platforms. The following illustration shows the architecture of the JavaFX API.

Let’s explore each of these components in detail.

Scene Graph

Scene Graph is the starting point of constructing a JavaFX application. It is a hierarchical tree of nodes that represents all of the visual elements of the application’s user interface. A single element in a scene graph is called a node. Each node is either a branch node or a leaf node. Branch nodes can contain other nodes, like their children but Leaf nodes do not contain other nodes. The first node in the tree is called the root node. A root node does not have a parent.

There are various classes present in javafx.scene package that are used for creating, modifying and applying some transformations on the node.

Graphics Engine

The JavaFX graphics engine provides the graphics support to the scene graph component. It generally supports 2D as well as 3D graphics both. Also provides the software rendering when the graphics hardware present on the system is not able to support hardware-accelerated rendering.

The two graphics accelerated pipelines in the JavaFX are:

  • Prism – It is a high-performance graphics hardware-accelerated that can render both 2D and 3D graphics.
  • Quantum Toolkit – It is used to bind prism and glass windowing tool kit together and makes them available for the above layers in the stack.

Glass Windowing Toolkit

It is a platform-dependent layer that connects the JavaFX platform to the native operating system. It provides native operating system services such as managing the windows, events, timers, and surfaces.

Media and Web Engine

  • Web Engine – It is a web browser engine used to embed the HTML content to a JavaFX scene graph. It supports HTML5, CSS, JavaScript, DOM, and SVG.
  • Media Engine – It provides tools to create media applications that enable media playback in the desktop window or within a web page on supported platforms. JavaFX media engine is based on an open-source engine known as a Streamer. It supports the playback of video and audio content.

These are the components that support the JavaFX API. Next part of this JavaFX tutorial is about the JavaFX application structure.

Anatomy of a JavaFX Application

JavaFX application is divided hierarchically into three main components: Stage, Scene, and Nodes.

Stage

It is the main container and the entry point of the application. It represents the main window and the created stage object is passed as an argument of the start() method of Application class. A stage has two parameters, Width, and Height, which determines the position namely

There are five types of stages available −

  • Decorated
  • Undecorated
  • Transparent
  • Unified
  • Utility

You have to call the show() method to display the contents of a stage.

Scene

The scene is a container for the visual content of the stage. It holds the UI elements, such as Image Views, Buttons, Grids, TextBoxes. Javafx.scene.Scene class of the package javafx.scene provides all the methods to deal with a scene object. You can create a scene by creating the Scene class object and passing the layout object into the Scene class constructor. 

Scene Graph & Nodes

It exists at the lowest level of the hierarchy. A scene graph is a tree-like data structure (hierarchical) representing the contents of a scene. You can think of it as the collection of various nodes. Basically. a node is a visual/graphical object of a scene graph. The Node Class of the package javafx.scene represents a single node in JavaFX and this class is the superclass of all the nodes.

Now that you know the structure of a JavaFX application in detail, let’s learn how to create a JavaFX application with an example in this JavaFX tutorial.

Creating a JavaFX Application

Let’s check out how to perform JavaFX programming on IDE Eclipse. The first thing that you need to do is to install e(fx)clipse plugin for Eclipse IDE. e(fx)clipse is a set of tools and necessary libraries which helps you to perform the JavaFX programming. 

Here, we are creating a simple JavaFX application which prints Welcome to Edureka! on the console on clicking the button shown on the stage.

package application;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
 
public class Main extends Application {
    
    @Override
    public void start(Stage primaryStage) {
        Button btn = new Button();
        btn.setText("Say 'Welcome to Edureka!'");
        btn.setOnAction(new EventHandler<ActionEvent>() {
 
            @Override
            public void handle(ActionEvent event) {
                System.out.println("Welcome to Edureka!");
            }
        });
        
        StackPane root = new StackPane();
        root.getChildren().add(btn);
        Scene scene = new Scene(root, 300, 250);
        primaryStage.setTitle("Hello World!");
        primaryStage.setScene(scene);  
        primaryStage.show();
    }
    public static void main(String[] args) {
        launch(args);
    }
    
}

Output:

Welcome to Edureka!

JavaFX Application Example Program Explanation

Let’s try to understand how this example program works in simple steps.

Step1: Extend javafx.application.Application and override start() method

As we discussed earlier, start() method is the starting point of JavaFX Application. Import JavaFX.application.Application to override the start() method. Override the start() method and pass to it an object of the class javafx.stage.Stage. 

@Override
    public void start(Stage primaryStage)

Step2: Create a Button

You can create a button by instantiating the javafx.scene.control.Button class. Therefore, import the relevant class into code. Pass the button label text in Button class constructor.

 Button btn = new Button();

Step3: Create an event for the button

This example application prints the text for an event on the button. So, you need to create an event for the button. For this purpose, call setOnAction() on the button and define an anonymous class Event Handler as a parameter to the method. Inside this anonymous class, define a method handle(). Check out the code for the handle() method.

btn.setText("Say 'Welcome to Edureka!'");
        btn.setOnAction(new EventHandler<ActionEvent>() {
 
            @Override
            public void handle(ActionEvent event) {
                System.out.println("Welcome to Edureka!");
            }

Step4: Create a layout and add the button to it

JavaFX usually provides a number of layouts. Implement one of them in order to visualize the widgets properly. You need to add other nodes like buttons, texts, etc. to this layout. 

StackPane root = new StackPane();
        root.getChildren().add(btn);

Step5: Create the scene

The scene is at a higher level in the hierarchy of JavaFx application structure. So, you need to add your layout to the scene. You can create it instantiating javafx.scene.Scene class and pass the layout object to the scene class constructor.

Scene scene = new Scene(root, 300, 250);

Step5: Prepare the stage

The stage is the main container and the entry point of the application. Use methods offered by javafx.stage.Stage class to set some attributes for the stage. Use the show() method to display the stage. Here’s the code to that.

 primaryStage.setTitle("Hello World!");
        primaryStage.setScene(scene);  
        primaryStage.show();

Step6: Create the main method

In the last step, create a main method in which you will launch the application i.e. call launch() method and pass the command line arguments (args) to it.

public static void main(String[] args) {
        launch(args);
    }

Step7: Run the application to see the output.

To make it more interesting you can change the UI of the JavaFX application by applying a custom design to it like HTML and CSS.

This brings us to the end of this JavaFX Tutorial. We went through the internal structure of the JavaFX application and learned the key capabilities of its architecture, lifecycle, and components. We also checked out how to create a simple GUI application.

Make sure you practice as much as possible and revert your experience.  

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 a besides this java interview questions, we come up with a curriculum which is designed for students and professionals who want to be a Java Developer. 

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


What is Embedded C programming and how is it different?

$
0
0

C is a high-level programming language intended for system programmingEmbedded C is an extension that provides support for developing efficient programs for embedded devices. Yet, it is not a part of the C language. In this “Embedded C programming” article, we shall discuss the following topics.

What is Embedded C Programming

Embedded C programming language is an extension to the traditional C programming language, that is used in embedded systems. The embedded C programming language uses the same syntax and semantics as the C programming language.

The only extension in the Embedded C language from normal C Programming Language is the  I/O Hardware Addressing, fixed-point arithmetic operations, accessing address spaces, etc.

Now will move on to the Difference between C and Embedded C.

Difference between C and Embedded C:

 

C Programming Language Embedded C Programming Language
In nature, it is a native development In nature, It is cross-development
It is independent of hardware architecture It is hardware dependent
Used for desktop application Used for limited resources like RAM and ROM

Now let’s learn about the basic structure of Embedded C program.

Basic Structure of Embedded C Program:

The embedded C program has a structure similar to C programming.

The five layers are:

  1. Comments
  2. Pre-processor directives
  3. Global declaration
  4. Local declaration
  5. Main function()

The whole code follows this outline. Each code has a similar outline. Now let us learn about each of this layer in detail.

Multiline Comments . . . . . Denoted using /*&hellip;&hellip;*/
Single Line Comments . . . . . Denoted using //
Preprocessor Directives . . . . . #include<&hellip;> or #define
Global Variables . . . . . Accessible anywhere in the program
Function Declarations . . . . . Declaring Function
Main Function . . . . . Main Function, execution begins here
{
      Local Variables . . . . . Variables confined to main function
      Function Calls . . . . . Calling other Functions
      Infinite Loop . . . . . Like while(1) or for(;;)
      Statements . . . . .
      &hellip;.
      &hellip;.
}
Function Definitions . . . . . Defining the Functions
{
      Local Variables . . . . . Local Variables confined to this Function 
      Statements . . . . .
      &hellip;.
      &hellip;.
}

Let’s look into the Comment section.

Comment Section:

Comments are simple readable text, written in code to make it more understandable to the reader. Usually comments are written in // or /* */.

Example: //Test program

Let’s look into Preprocessor Directives Section.

Preprocessor Directives Section:

The Pre-Processor directives tell the compiler which files to look in to find the symbols that are not present in the program.

For Example, in 8051 Keil compiler we use,

#include<reg51.h>

Let’s look into Global declaration Section.

Global Declaration Section:

This part of the code is the part where the global variables are declared. Also, the user-defined functions are declared in this part of the code. They can be accessed from anywhere.

void delay (int);

Let’s look into Local declaration section.

 

Local Declaration Section:

These variables are declared in the respective functions and cannot be used outside the main function.

Let’s look into the Main function section.

 

Main Function Section:

Every C programs need to have the main function. So does an embedded C program. Each main function contains 2 parts. A declaration part and an Execution part. The declaration part is the part where all the variables are declared. The execution part begins with the curly brackets and ends with the curly close bracket. Both the declaration and execution part are inside the curly braces.

void main(void) // Main Function
{
     P1 = 0x00;
     while(1) 
     {
           P1 = 0xFF; 
           delay(1000);
           P1 = 0x00; 
           delay(1000);
       }
}

 

Function Definition Section

In this section, the function is defined.

This is the basic structure of the embedded c program.

With this, we come to an end of this “Embedded C Programming” article. I hope you have understood the basic structure.

Now that you have understood the basics of Programming in C, check out the training provided by Edureka on many technologies like Java, Spring and  many more, a trusted online learning company with a network of more than 250,000 satisfied learners spread across the globe

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

What is the salary of Digital Marketer?

$
0
0

The field of Digital Marketing is booming these days. If you are aiming for a career in the Digital Marketing field, you have high paying Digital Marketing jobs waiting for you. Since every brand is fighting for digital supremacy these days, digital marketing agencies have a lot to offer. In this blog on “Digital Marketing Salary”, we will discuss the global Digital Marketing salary and what are the career options available in this field. Below are the topics covered in this blog –

What is Digital Marketing?

Digital Marketing is a term for all the online efforts injected in business to work. Simply put, Digital Marketing encompasses all marketing efforts that use digital devices or the internet. It is an act of promoting and selling products by leveraging online marketing tactics like search marketing, social media marketing, and email marketing.

Roles in Digital Marketing

The world is going Digital and by the year 2020, every company will have an online presence thus creating a lot of career opportunities. The Digital Marketing industry is swelling in various aspects giving employees a scope to leverage on the basis of talent and skills.

So, let us have a look at some of the career options available in the Digital Marketing domain.

    • Digital Marketing Manager: The major role of a Digital Marketing Manager is to enhance awareness about your brand in the digital space by developing, implementing, and managing marketing campaigns to promote the products of a company.
    • Digital Marketing Executive: A Digital Marketing executive plans and executes marketing campaigns, and maintains the content for the organization’s website. The major role of a marketing executive is to optimize content for the website and work on SEO for website pages.
    • SEO Manager: The role of an SEO specialist is to rank a website page on the search engines to increase the website’s traffic, compile performances report using Google Analytics and conducting on-page and off-page optimization for the company’s blog.
    • Social Media Marketing Expert: A social media expert is responsible for combining marketing and social media management to enhance the brand’s presence on social media, interaction with audiences, and promoting the brand’s content.
    • Content Manager: A content manager is responsible for managing the company’s blog, marketing campaigns, guest blogging, email communications, video marketing, copywriting, etc.
    • Copywriter: A copywriter helps the content team to refine their content to get more reception, helps a search engine marketer to write ad copies, helps a social media manager with better words for copies on social media channels.
    • SEM Specialist: An SEM specialist targets the number of leads and clicks from the given marketing budget, manages bid, conducts keyword research, analysis, ad copywriting, and tests ad campaigns.

Digital Marketing Salary

The Digital Marketing salary varies according to the work profile, experience, and talent. If you have all three, you’ll definitely be able to barge in the opportunity.

Digital Marketing Manager

According to PayScale.com, here are the graphs depicting the average salary for a Digital Marketing Manager in US and India.

The average salary for a Digital Marketing Manager in US is $65,488

Digital Marketing Manager Salary (US)

The average salary for a Digital Marketing Manager in India is Rs.515,124

Digital Marketing Manager Salary (IN)

Below graph shows Pay by experience level for Digital Marketing Manager in US and India.

Digital Marketing Manager Salary (US) – Experience Level


Digital Marketing Manager Salary (IN) – Experience Level

SEO Manager

According to PayScale.com, here are the graphs depicting the average salary for SEO Manager in India and US.

The average salary for SEO Manager in US is $67,475.

SEO Manager Salary (US)

The average salary for SEO Manager in IND is Rs.509,090.

SEO Manager Salary (IN)

Refer the below image depicting pay by experience level for SEO Manager in US and IN.

SEO Manager Salary (US) -Experience Level


SEO Manager Salary (IN) -Experience Level

Social Media Manager

According to PayScale.com, here are the graphs depicting the average salary for a Social Media Manager in India and US.

The average salary for a Social Media Manager in US  is $49,881.

Social Media Manager Salary (US)

The average salary for a Social Media Manager in IND is Rs.366,271

Social Media Manager Salary (IN)

Here’s a graph depicting Pay by experience level for Social Media Manager in US and IN.

Social Media Manager Salary (US) – Experience Level


Social Media Manager Salary (IN) – Experience Level

Content Manager

According to PayScale.com, here are the graphs depicting the average salary for a Social Media Manager in India and US.

The average salary for a Content Manager is $57,734

Content Manager Salary (US)

The average salary for a Content Manager is $572,510

Content Manager Salary (IN)

 

Below graph represents pay by experience level for Content Manager in US and IN.

Content Manager Salary (US) – Experience Level


Content Manager Salary (IN) – Experience Level

Copywriter

According to PayScale.com, here are the graphs depicting the average salary for a Social Media Manager in India and US.

The average salary for a Copywriter is $50,570

Copywriter Salary (US)

The average salary for a Copywriter is Rs.377,690.

Copywriter Salary (IN)

Here’s a graph representing pay by experience level for Copywriter in US and IN.

Copywriter Salary (US) – Experience Level


Copywriter Salary (IN) – Experience Level

SEM Specialist

According to PayScale.com, here are the graphs depicting the average salary for a Social Media Manager in India and US.

The average salary for an SEM specialist is $47,186.

SEM Specialist Salary (US)

The average salary for an SEM specialist is Rs.366,634.

SEM Specialist Salary (IN)

Below image represents Pay by experience level for an SEM specialist in US and IN.

SEM Specialist Salary (US) – Experience Level

SEM Specialist Salary (IN) – Experience Level

Digital marketing is creating an evolved space for exciting careers that will leave you both fulfilled and well-compensated. And now that you are familiar with the overall scenario of Digital Marketing jobs and careers, are you intrigued by the idea of building a career with that luring Digital Marketing salary? Then grab an opportunity today and become a Digital Marketing specialist.

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 Display Fibonacci Series in Python?

$
0
0

The Fibonacci Sequence is a series of numbers named after Italian mathematician, known as Fibonacci. It is simply the series of numbers which starts from 0 and 1 and then continued by the addition of the preceding two numbers. In this article, you will learn how to write a Python program to implement the Fibonacci series using multiple methods. Below pointers will be discussed:

Let’s begin.

What is Fibonacci Series?

Fibonacci series is a series of numbers formed by the addition of the preceeding two numbers in the series.

Example of Fibonacci Series: 0,1,1,2,3,5

In the above example, 0 and 1 are the first two terms of the series. These two terms are printed directly. The third term is calculated by adding the first two terms. In this case 0 and 1. So, we get 0+1=1. Hence 1 is printed as the third term. The next term is generated by using the second and third term and not using the first term. It is done until the number of terms you want or requested by the user. In the above example, we have used five terms.

Next, let’s write a Python program to implement it.

Python Program to implement Fibonacci Sequence


Implementing Fibonacci sequence in Python programming language is the easiest! Now there are multiple ways to implement it, namely:

  • Using Loop
  • Using Recursion

Let’s see both the codes one by one.

Fibonacci Series using Loop

Loops in Python allow us to execute a group of statements several times. Let’s write a python program to implement Fibonacci Series using a loop.

# Enter number of terms needed                   #0,1,1,2,3,5....
a=int(input("Enter the terms"))
f=0                                         #first element of series
s=1                                         #second element of series
if a<=0:
    print("The requested series is
",f)
else:
    print(f,s,end=" ")
    for x in range(2,a):
        next=f+s                           
        print(next,end=" ")
        f=s
        s=next

Output: Enter the terms 5 0 1 1 2 3

Another way to program the Fibonacci series generation is by using recursion. Let’s dig deeper into it.

 

Python Program to Write Fibonacci Sequence Using Recursion

Recursion is the basic Python programming technique in which a function calls itself directly or indirectly. The corresponding function is called a recursive function. Using a recursive algorithm, certain problems can be solved quite easily. Let’s see how to use recursion to print first ‘n’ numbers of the Fibonacci Series in Python.

Python Code:

def FibRecursion(n):  
   if n <= 1:  
       return n  
   else:  
       return(FibRecursion(n-1) + FibRecursion(n-2))  
 nterms = int(input("Enter the terms? "))  # take input from the user
 
if nterms <= 0:  # check if the number is valid 
   print("Please enter a positive integer")  
else:  
   print("Fibonacci sequence:")  
   for i in range(nterms):  
       print(FibRecursion(i))

Output: How many terms: 5
0 1 1 2 3

Explanation: In the above Python program, we use recursion to generate the Fibonacci sequence. The function FibRecursion is called recursively until we get the output. In the function, we first check if the number n is zero or one. If yes, we return the value of n. If not, we recursively call fibonacci with the values n-1 and n-2.

This brings us to the end of this ‘Fibonacci Series in Python’ article. We have learned how to programmatically print the Nth Fibonacci number using either loop statements or recursion.

If you wish to learn Python and gain expertise in quantitative analysis, data mining, and the presentation of data to see beyond the numbers by transforming your career into Data Scientist role, check out our interactive, live-online Python Certification Training. You will use libraries like Pandas, Numpy, Matplotlib, Scipy, Scikit, Pyspark and master the concepts like Python machine learning, scripts, sequence, web scraping and big data analytics leveraging Apache Spark. The training comes with 24*7 support to guide you throughout your learning period.

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

How do you exit a function in Java?

$
0
0

Java is a wonderful programming language having numerous applications. While programming for one of these applications you may get stuck at some juncture of this program. What does one do in this situation? Is there a way to exit at this very point? If these questions bother you, you have landed at the right place. What can you do is, simply use a System.exit() Method which terminates the current Java Virtual Machine running on the system. In this article, I will take you through exit function in Java and help you understand it thoroughly.

Let’s begin.

How do you exit a function in Java?

You can exit a function using java.lang.System.exit() method. This method terminates the currently running Java Virtual Machine(JVM). It takes an argument “status code” where a non zero status code indicates abnormal termination. If you working with Java loops or switch statements, you can use break statements which are used to break/ exit only from a loop, and not the entire program.

In this article, let’s dig deeper into Java exit() method and understand how is it used.

What is System.exit() Method?

System.exit() method calls the exit method in class Runtime. It exits the current program by terminating Java Virtual Machine. As the method name defines, exit() method never returns anything.

The call System.exit(n) is effectively equivalent to the call:

Runtime.getRuntime().exit(n)

System.exit function has status code, which tells about the termination, such as:

  • exit(0) : Indicates successful termination.
  • exit(1) or exit(-1) or any non-zero value – indicates unsuccessful termination.

Now, let’s see the parameters and the exception throws in System.exit() method.

Parameters: Exit status.

Exception: It throws a SecurityException.

Moving ahead with System.exit method(), let’s see some of its practical implementation.

Java System exit() Method Examples


package Edureka;

import java.io.*;
import java.util.*;

public class ExampleProgram{

public static void main(String[] args)
{
int arr[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};

for (int i = 0; i < arr.length; i++) { if (arr[i] >= 4)
{
System.out.println("Exit from the loop");

System.exit(0); // Terminates JVM
}
else
System.out.println("arr["+i+"] = " +
arr[i]);
}
System.out.println("End of the Program");
}
}

Output: arr[0] = 1
arr[1] = 2
arr[2] = 3
Exit from the loop

Explanation: In the above program, the execution stops or exits the loop as soon as it encounters the System.exit() method. It doesn’t even print the second print statement which says the “End of the program”. It simply terminates the program there itself.

Example 2:


package Edureka;

import java.io.*;
import java.util.*;

public class ExampleProgram{

public static void main(String[] args)
{
int a[]= {1,2,3,4,5,6,7,8,9,10};
for(int i=0;i<a.length;i++)
{
if(a[i]<=4)
{
System.out.println("array["+i+"]="+a[i]);
}
else
{
System.out.println("Exit from the loop");
System.exit(0); //Terminates jvm
}
}
}
}

Output: array[0]=1
array[1]=2
array[2]=3
array[3]=4
Exit from the loop

Explanation: In the above program, it prints the elements until the condition is true. As soon the condition gets false, it prints the statement and the program terminates.

Thus we have come to an end of this article on ‘exit function in Java’. I hope you understood what has been shared in this tutorial. If you wish to learn more, check out the Java Training by Edureka, a trusted online learning company. Edureka’s Java J2EE and SOA training and certification course is designed to 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 blog “exit function in Java” and we will get back to you as soon as possible.

How To Install NumPy In Python?

$
0
0

NumPy is one library which is very integral to Python Programming. In this article we will learn how to install NumPy in Python. Following pointers will be covered in this article,

Lets begin!

Introduction

Python is open source object oriented interpreted language. Of the many features, one of the important features that makes python a strong programming language is Python packages. A lot of external packages are written in python which you can be installed and used depending upon your requirement.

Python packages are nothing but directory of python scripts. Each script is a module which can be a function, methods or new python type created for particular functionality. numpy is one such important package created to ease array computation in python.

In this blog we will explain the process of downloading and installing numpy packages and how to use them in python environment on mac, windows, ubuntu and fedora operating systems. The basics of python programming language are not covered in this blog. For beginners, the basics of python programming language are covered in this Edureka blog.

All python packages are installed using pip – Package Installer for Python. You can view the details of all python packages and download them from Python Package Index (PyPI). However, pip is automatically installed when you download and install python from python.org or any other python integrated environment. Please read the blog for the best python integrated platforms which also provides loads of other functionalities. pip is the simplest way to download packages directly from PyPI from your command line.

Moving on with this Install NumPy in Python article

NumPy Installation On Mac Operating System

Now let’s install see how to install numpy on a mac operating system. This section details on installing numpy on both python 2.7 and latest version of python 3.7.

PYTHON 2.7

Open a terminal in your MacBook and type python to get into python prompt.
1. Press command (⌘) + Space Bar to open Spotlight search. Type in Terminal and press enter.

 

2. In the terminal, use the pip command to install numpy package.

3. Once the package is installed successfully, type python to get into python prompt. Notice the python version is displayed too. Use the import command to include numpy package and use it. You can also set an alias name (shortcut) for package.

Python 3

Similarly, you can install numpy in python 3 also. After opening the terminal as detailed in step 1 above, use pip3 command to install numpy. Please notice we are using pip3 command instead of pip. pip3 command is used to let our system know that we are working with python3.

Moving on with this Install NumPy in Python article we will see how to install NumPy on Windows Operating System

NumPy Installation On Windows Operating System

Python is not installed by default in windows operating system. You can download the required version of python from python.org. Once python is installed successfully, open command prompt and use pip to install numpy.

Moving on with this Install NumPy in Python article

NumPy Installation On Ubuntu Operating System

Python is installed by default on ubuntu systems. However, pip is not installed. If you want the complete package, download python from python.org and install it on your ubuntu operating system using apt install command.
Alternatively, you can install pip on ubuntu and then install numpy which is the easier of the two ways.
You will need root privileges on the system to install pip and numpy. Open a terminal in ubuntu and install pip and pip3 using apt.

Once pip is installed you can install numpy with same commands to install numpy.

Moving on with this Install NumPy in Python article

NumPy Installation On Fedora Operating System

Similar to Ubuntu operating system python is installed by default in fedora. Use pip command to install numpy.

Notice the difference in pip command for python3 specifically in fedora operating systems. Secondly, be aware that installing numpy with pip, installed it for both Python2 and Python3 automatically. This brings us to the end of this 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.

Got a question for us? Mention them in the comments section of  article and we will get back to you.

AWS Snowball and Snowmobile Tutorial

$
0
0

In this AWS Snowball And Snowmobile Tutorial will introduce you to how data migration works on Amazon Web Services Cloud. Following pointers will be covered in this article,

So let us get started then,

Use Case For Data Migration

With the faster penetration of higher internet speeds, satellites and smart phones the amount of data generated is increasing day by day. For ex., a Satellite Imagery Company might be already storing Petabytes of information of the earth and updating the same on a regular basis. Adding storage capacity on a constant basis would be a huge challenge to them not only in terms of the cost, but also in terms of logistics like space, power supply, security etc. This is where the Cloud Providers like AWS will come into picture. A few other use cases where companies have huge amounts of data is for storing the video libraries, genomic sequences, seismic data.

The Satellite Imagery Company and others would like to move their applications and data to the Cloud and let the Cloud Provider take care of the storage aspect like security, backup, additional storage etc. This way the Satellite Imagery Company might focus on its core business to find more customers, providing more value to the customers, more ways for the customers to interact with them etc.

But, moving Petabytes of data over the internet has its own challenges. According to the AWS documentation here : 100 terabytes of data will take more than 100 days to transfer over a dedicated 100 Mbps connection. Forget about moving Petabytes of data, it will take close to a year. On top of the time required there is an additional cost of network bandwidth and let’s not forget the data snooping when a public internet is used. This is where services like AWS Snowball and AWS Snowmobile come into the picture.

Next in this AWS Snowball and Snowmobile Tutorial

AWS Snowball

The Snowball is a rugged device and is also explosive proof, a tad bigger than the size of a suitcase and can be checked into a flight also. Here are a few links (1, 2) on how rugged a Snowball is.

Another option to speed up the data movement between the Data Center and the AWS Cloud is to use the AWS Direct Connect Service. Using this service, a dedicated line is established between the AWS Cloud and your own Data Center for a stable connection and consistent high bandwidth.

Next in this AWS Snowball and Snowmobile Tutorial let us see how data migration works,

Steps For Migrating Data To The AWS Cloud Using Snowball

Here are the steps at a high level to migrate the data between your own Data Center and the AWS Cloud.

Step 1: Request one or more Snowball devices from AWS depending upon the amount of data to be transferred. A Snowball has two versions with 50 and 80 TB storages and can be ordered from AWS via the management console.

Step 2: AWS would be shipping the Snowball to the customer. The next step would be to connect the same to the local network and then transfer the data into the Snowball using the Client program provided by AWS. The data gets automatically gets encrypted and stored.

Step 3: Once the data has been transferred to the Snowball, it must be couriered to AWS. The Snowball has e-ink to automatically populate the address of the AWS location. The data in the Snowball is encrypted (256-bit encryptions using AWS KMS Keys), so it’s now possible that the Snowball gets tampered or someone tries to get the data out of it. It’s all protected.

Step 4: Once the AWS folks get the Snowball, they connect it to the AWS Cloud, decrypt the data and move the data to S3.

Step 5: Once the data has been moved to S3, the Snowball is wiped out for no one to access it further.

Step 6: The last and the final step is for the customer to access the data in S3. From there the data can be moved to EBS, EFS, DynamoDB and various other AWS Services.

The above-mentioned steps are very much like how we transfer the data from one Laptop to another when not connected in a network. We insert the USB Drive to the source Laptop, copy the data to the USB Drive. Remove and insert the USB Drive to the target Laptop and copy the data. While the above-mentioned steps are for moving the data from our own Data Center to the AWS Cloud, it’s also possible to move the data the other way, by following the exact steps in the reverse order. This way there is no locking of the data.

Not only the Snowball is used to move the data of the existing applications to the AWS Cloud, but can also be used to for the Data Center Migration when it makes sense to close an existing Data Center and move everything to the Cloud. This approach makes the transition faster when compared to moving the data over the public internet which is a bit slow.

This brings us to the final bit of AWS Snowball and Snowmobile Tutorial,

Snowball vs Snowmobile

A single Snowball can store up to 80 TB of data out of which only 72 TB is of usable space. Multiple Snowball’s can be used in parallel when there is a requirement to move more than 80 TB of data.

AWS also provides a Snowmobile where the size of the data stored is much more than what a Snowball can store. A Snowball is a rugged shipping container with a semi-trailer truck. While a single Snowball can store up to 80 TB of data, a single Snowmobile can store 100 PB of data, which is almost 1,250 times the capacity of a single Snowball. AWS recommends using a Snowball when the data to be transferred is less than 10 PB or else to use a Snowmobile. Apart from the default encryption Snowmobile takes a few additional steps like GPS tracking, 24/7 Video Surveillance, optional escort to make the data even more secure.

This brings us to the end of this article on AWS Snowball And Snowmobile Tutorial. To learn more about AWS you can refer our Amazon AWS Tutorial blog. We have also come up with a curriculum which covers exactly what you would need to crack the Solution Architect Exam! You can have a look at the course details for AWS Solution Architect training.

Put all your queries in the comment section, so we can revert to you at the earliest.

What are the Advantages and Disadvantages of Angular?

$
0
0

Angular one of the most popular software development instruments and it is a part of the JavaScript ecosystem. It was introduced by Google in the year 2009. According to a survey by StackOverflow this year, 30.7 percent of software engineers apply AngularJS and the new version Angular 2+ to create user interfaces. In this blog on “Advantages and Disadvantages of Angular”, we will walk you through the main features, pros and cons of angular in terms of front-end engineering.

What is Angular?

An Angular framework makes it easy to develop web applications. Combining dependency injection, declarative templates, end-to-end tooling, and integrated best practices, it solves almost all the challenges when creating a web app.

Angular versions history: Angular 2-8

The Angular framework includes versions from 2 to 8. The 8th update was released in May 2019. In this section, we will elaborate on the improvements that each version of Angular made.

Angular 2: The release of Angular 2 brought numerous changes to the initial framework, as it was rewritten in TypeScript. The architectural style switched to component-based.

Angular 4: Angular CLI 1.0.0 was introduced with the fourth version, as a core element of the Angular project. With the release of Angular Universal, Angular applications could be rendered outside the browser.

Angular 5-6: The release of fifth and sixth version concentrated on optimizing Angular CLI and compiler work.

Angular 7: With Angular 7 CLI was enhanced with prompts which provided tips in CLI to explain functions and purposes of elements. Hence, using CLI became more intuitive. Applications received various improvements in the performance and size of the code-base.

Angular 8: the latest version of Angular: In Angular 8, two elements were introduced Ivy renderer, Bazel (build interface). Another major improvement is differential loading that is used to upload browser-specific bundles in order to support legacy browsers and upload content faster.

The Advantages and Disadvantages of Angular

Every technology comes with certain advantages and cons. In this section, we will take a closer look at these advantages and disadvantages of Angular.

Pros of Angular

MVC Architecture implementation

Model-View-Controller architecture, not only attaches value to the framework when creating a client-side app but also sets the foundation for the other features like data binding and scopes.

With MVC architecture, it is possible to isolate the app logic from the UI layer and support separation of concerns. The controller receives all requests for the app and operates with the model to prepare any data needed by the view. The view uses the data prepared by the controller and displays a final presentable response.

Enhanced Design Architecture

Some of the large web applications contain a lot of components. Angular simplifies the way of managing these components even if a new programmer joins the project after the development process has already begun. The architecture is built in such a way that helps the programmer to locate and develop the code easily.

Modules

A module is a mechanism that groups directives, components, pipes and services that are related, in such a way that can be combined with other modules in order to create an application The Angular-based app can be considered as a puzzle where each module is needed to be able to see the full picture. There are a number of ways to add different elements to a module. Angular solves the problem of global function exploitation by limiting the scope of all functions to the module, in which it was defined and used.

Services and Dependency Injection (DI)

A service or component might sometimes need other dependent services to complete a task. A Dependency Injection design pattern is used in order to fulfill these dependencies. It divides the task among different services. The client service will not create the dependent object, rather it will be created and injected by an Angular injector. The Angular injector is responsible for creating service instances and injecting them into classes like components and services.

Custom directives

Custom directives improve HTML functionality and are suitable for dynamic client-side applications. They all start with the prefix ng so that HTML can identify them. Some of these are:

NgModel: provides two-way data binding to an HTML form elements.
NgClass: removes and adds a set of CSS classes.
NgStyle: adds and removes a set of HTML styles.

TypeScript: better tooling, cleaner code, and higher scalability

Angular is written using TypeScript, which is a superset for JavaScript. It fully complies to JavaScript and also helps spot and eliminate common mistakes while coding. While small JavaScript projects do not require such an enhancement, the enterprise-scale applications need developers to make their code cleaner and verify the quality more often.

Cons of Angular

Limited SEO options

A major drawback of using Angular is the limited SEO options and poor accessibility for search engine crawlers.

Angular is verbose and complex

A frequent complaint that you would hear from the Angular developers is the verbosity of the instrument. And this problem hasn’t changed much since AngularJS.

Steep learning curve

If you onboard new developers who are familiar with JavaScript to use new Angular, they would find it difficult as compared to React or Vue onboarding. This is because the array of topics and aspects to be covered is quite large.

CLI documentation is lacking details

Some developers express concerns with the current state of CLI documentation. While the command line is very useful fo Angular developers, you won’t find enough information in their official documentation on GitHub and you have to spend more time exploring threads on GitHub to get answers.

Conclusion

Although the platform has its share of cons, Angular is a full-featured and dynamic framework. And its usability, flexibility, and maintainability makes it unique and provides chances to create excellent and successful web-based applications.

With this, we come to an end of this blog on “Advantages and Disadvantages of Angular”. I hope it added value to your knowledge. 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 ”Advantages and Disadvantages of Angular” and I will get back to you.


What are the common Git mistakes and how to fix them?

$
0
0

With the boom of DevOps technology, it becomes inevitable for any IT person to work on multiple data simultaneously and your data is ever-evolving with time. It is also essential to track every change in the data and be prepared to undo or revert any undesired change when required.

I must confess, versioning my data in Git allow me to be more experimental in my project development. If I mess up, I know git always has a way to undo and/or revert that version of my project to the way it was before I screwed up. Each Git workflow layer is designed to allow the data changes to be reviewed and modified and/or corrected before moving the data in the next stage. So the following are the mistakes that are covered in this blog:

    Un-stage files/directories from Index

    While adding and/or modifying files you often tend to use the default behavior of ‘git add’ command, which is to add all files and directories to the Index. Many a time you feel the need to un-stage certain files or modify them one last time before committing them.

    Syntax: git reset <filename/dirname>


    Un-staging files from the Index area gives you another chance to re-work on your data before committing to a local repo.

    Edit the last committed message

    Command: git commit --amend
    You can edit the latest commit message without creating a new one. To list the commit logs, I have set an alias ‘hist’:
    Command: git config --global alias.hist 'log --pretty=format:"%C(yellow)%h%Creset %ad | %C(green)%s%Creset%C(red)%d%Creset %C(blue)[%an]" --graph --decorate --date=short'x


    Do not amend the commit message which is already pushed on to a remote repository and shared with others, as that would make the earlier commit history invalid and thus any work based on that may be affected.

    Forgot some changes in the last commit

    Let’s say you forgot to make some modifications and already committed your snapshot, also you do not want to make another commit to highlight your mistake.
    Command: git commit --amend


    I have highlighted how the recent commit object’s sha-1 id has been recreated and changed. I pretended to have made a single commit blending both the changes into one.

    Discard local changes

    So, here is a case where I modified the ‘README’ file and staged it. Next, I modified the same file a second time but realized that I didn’t want the second change.

    Now, let me not undo the entire change manually, I can simply pull the staged version of the file.
    Syntax:
    git checkout -- <filename> –local changes in a file
    git checkout -- <dirname> –local changes in all the files in the directory­­

    Command: git checkout -- README

    So, I discarded my last changes to the file and accepted the staged version of the file. In the next commit, just the staged version of the file goes in the local repository.

    Committed personal data to the local repository

    I want to remove certain data from the local repository but keep the files in the working directory.
    Syntax:
    git reset --mixed HEAD~
    git reset --mixed <commit-id>

    Command: git reset --mixed HEAD~1
    HEAD~1 indicates a commit just before the recent commit pointed by the current branch HEAD.

    Files in the current snapshot removed from both the local repository and the staging area. Add the following patterns in the global .gitignore file to exclude them from being tracked by git.
    vim ~/.gitignore_global
    # password files #
    *.pass
    *.key
    *.passwd

    With this, the commit that had the snapshot of password files is removed, and you get a clean staging area. My files are still present on my working directory but no longer present in the local repository, also will not be pushed on a remote repository.

    Caution: If you lose them git cannot recover them for you as it does not know about it.

    Replace the latest commit with a new commit

    Syntax: git reset --soft [ <commit-id>/HEAD~n>]

    The ‘–soft’ option just remove the committed files from the local repository while they are still staged in the Index and you can re-commit them after a review. <commit-id> is the sha-1 of the snapshot that you want to remove from the local repo. <HEAD~n> where n is the number of commits before the HEAD commit

    Command: git reset --soft HEAD~1


    Modify files and stage them again

    Command: git commit -m 'Adding index.html and style.css'
    Your commit history now turns out to be:

     

    Committed the wrong data

    Syntax:
    git reset --hard HEAD~n –reset the project to ‘n’ commits before the latest committed snapshot
    git reset --hard <commit-id> –reset the project to given commit id snapshot

    Command: git reset --hard HEAD~1


    The latest commit and the corrupt files are removed from the local repository, staging area as well as the working directory.

    Caution: It’s a dangerous command as you end up losing files in the working directory. Not recommended on a remotely shared repository.

    Get back to my old project state

    You can ump to an older state of your project in the history of time. If you mess up in the latest version or need enhancements in older code, you may want to create another branch out of that old project snapshot to not hinder with your current work. Let’s see how:
    a. List out the project history and decide on the older commit id, command: git hist
    b. Create another branch out of the commit id: git checkout -b old-state e7aa9a5
    c. Continue working on the code and later merge/rebase with the ‘master’ branch.

    Recover a deleted local branch

    It is possible to regenerate the lost work on a reference branch. Say, I deleted the branch ‘old_code’ without merging with the main branch and lost the work. And no, I did not push the branch to a remote repository either, what then? Well git tracks and keep a journal entry of all the changes done on each reference, let’s see mine: git reflog

    So, HEAD@{2} is the pointer when I moved to ‘old_code’ branch, let’s recover that:

    Syntax: git checkout -b <branch-name> <commit-id>
    Command: git checkout -b old_code HEAD@{2}

    You must be now in the ‘old_code’ branch with your latest work at the time of its creation.Additionally, the ‘reflog’ pointer at HEAD@{1} was the recent commit made on the ‘old_code’ branch.To restore this unique commit just run the command as: git reset --hard HEAD@{1}.This also restores the modified files in the working directory.

    If you would want to know in detail how this command works and how can you manage the ‘reflog’ entries, you may as well read my earlier post on recovering the deleted branch from git reflog.

    Undo changes done in a commit

    git revert is used to record some new commits to reverse the effect of some earlier commits.
    Syntax: git revert <commit-id>
    From my commits logs, I would like to reverse the change done in the highlighted commit id:

     

    Command: git revert 827bc0d

    It is better, that you do not reset ‘–hard’ the shared commits, but instead ‘git revert’ them to preserve the history so that it becomes easier for all to track down the history logs to find out what was reverted, by whom and why?

    You can use the same logic of referring the commits concerning the HEAD pointer instead of giving the commit id, as in HEAD~3 or HEAD~4 and so on.

    Gave a wrong name to my branch

    You can rename a local branch name. It so happens many times that you may wish to rename your branch based on the issue you are working on without going through the pain of migrating all your work from one location to another. For instance, you could either be on the same branch or a different branch and still be able to rename the desired branch as shown below:
    Syntax: git branch -m <old_name> <new_name>
    Command: git branch -m old_code old_#4920

    As you may wonder does git keeps of a track of this rename? Yes, it does refer to your ‘reflog’ entries, here is mine:

    Renaming a branch will not affect its remote-tracking branch. We shall see in the remote section how to replace a branch on the remote repository

    Re-arrange history logs before pushing to remote

    How I wish I would have made certain commits earlier than others and would have not made some commits at all. Interactively re-arrange and edit the old commits to effectively fix-up or enhance the code
    Syntax: git rebase -i <after-this-commit_id>
    Command: git rebase -i fb0a90e –start rebasing the commits that were made after the commit-id fb0a90e

    Re-visit the git rebase documentation to understand how is an ‘–interactive or -i’ rebase different from a regular rebase.

    Committed unrelated changes into a single commit

    In this case, you need split an old buried commit into multiple logical commits.
    Syntax: git rebase -i <after-this-commit_id>
    Command: git rebase -i fb0a90e
    In the rebase editor, you must choose e7aa9a5 commit id and change it to ‘edit’ instead of ‘pick’.

    You would now be in the project’s version of commit id-e7aa9a5. First, reset the commit history and staging area to the previous commit-Command: git reset HEAD~1
    Second, edit + stage + commit the files individually
    Commands:
    git add code && git commit -m 'Adding initial codes'
    git add newcode && git commit -m 'Adding new code'

    Third, continue the rebase and end.

    Command: git rebase --continue
    Fourth, view the history with additional commits.

    Command: git hist

    Change author-email in all commits on all branches

    I have been versioning and committing my project files in git since a long time now, but until now it never struck me that my email id was compromised in my commit history logs which are even published on remote repositories. Well, this may happen to anyone when you initially set up the configurations in the “.gitconfig” file.To my relief git can re-write the environment variables we provide when creating a commit object.

    First I get the list of email ids to decide the ones I want to change:
    Command: git log --all --pretty=format:"%an <%ae> %d" –This prints author-name<email-id> (refname/branch-name)

    Second, I run through every commit on each branch and re-write the commit object with the new email id
    Command:
    git filter-branch --env-filter '
    if [ "$GIT_AUTHOR_NAME" = "divya" ]
    then
    GIT_AUTHOR_EMAIL = "divya@github.com"
    fi
    ' -- --all

    Lost and found files

    Suppose you have lost a certain file and you do not remember its name, but could recall certain words in the file. In this case, you can follow these steps-
    Step 1: List all the commits that ever contained the file snapshot with the searched pattern
    Command: git rev-list --all | xargs git grep -i 'timestamp'



    Step 2: Create a new branch ‘lost-found’ from this highlighted commit-id
    Syntax: git checkout -b lost-found d8c6a76a6dcb1fc6e8c3f6b097e1bd07e7cd328f

    Forgot which branch has my commit-id

    At times, after you detect a buggy commit id you might as well want to know all the branches that have this commit on them so you could fix them all. Checking out each branch’s history is not very practical in a large multi-branch project.

    A bad commit made in my navigation building application once broke the code, that’s when I used the ‘git bisect’ command to detect the commit id that was bad followed by the command: git branch --contains <commit-id> to list the branches with that bad commit.

    So, now I know all the branches that still have the bad commit, I could either revert or reset this changeset.

    Delete a commit from history

    Sometimes I feel the need to just wipe out a commit from the history and leave no trail of it. I would not recommend you to try this stunt on a shared branch but only on your local branch.
    Syntax: git rebase -i <commit-id>
    Command: git rebase -i 93859d8
    In the rebase editor-> replace ‘edit’ with ‘drop’ for the highlighted commit id: 69f4813

    In some of the cases, this re-writing may result in conflicts. You must resolve conflicts then proceed further.

    Warning: This is a dangerous command as this re-writes history and may lose data.Such a branch differs from its remote-counterpart and will have to be pushed with the --force or --force-with-lease option.

    Pushed a wrong branch to the remote

    Now, here is what I want to do- I want to delete a remote branch and also stop tracking it from my local branch.’git push‘ command when used with the --delete option deletes the remote branch So, this is how I get the local copy of the cloned project –

    git clone https://github.com/greets/myProj.git
    cd myProj


    Once, the remote branch is deleted others on the shared repo must refresh and update their remote references with the --prune option to delete the missing object references: git fetch --prune -v origin

    In this post, I have mentioned some of the common mistakes or changes that git can help you fix. Every code is unique and developed in its way, so there are also different ways of approaching and fixing a problem. You could always refer to the official git documentation to understand how various git commands safeguard your source code and how to utilize the commands the best way possible.

    Now that you have understood the common Git mistakes, 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 of this “common Git mistakes” and we will get back to you

     

    Everything You Need To Know About Power BI Charts

    $
    0
    0

    These days Power BI certified professionals hold value equivalent to gold, mainly because it is aimed to help individuals or an enterprise analyze and visualize their data and draw insights from the same. Business people can use this tool to create interactive and Popular Power BI Charts, technical and non-technical alike.

    Following pointers will be covered in this article,

    So let us get started then,

    Power BI Charts

    Power BI Charts give you a multi-perspective view into a certain data-set. These charts represent different findings and insights from a given data-set. The charts can give you reports with a single visualization or pages full of visualizations.

    Power BI Charts aren’t static but highly interactive & highly customizable with the ability to update constantly, as the underlying data changes. You can add and remove data, change chart types, and apply filters in your model to discover insights and look for answers. 

    So, here are a few Popular Power BI Charts, that you should always have on your fingertips.

    Area Charts

    Now, an area chart is a great choice to see and compare the volume trend across time series. Not just that, these area charts also meant for individual series representing a physically countable set.

    The basic area chart, which also known as layered area chart, is based on the line chart. The area between axis and line is filled with colors to indicate volume and the lines show the trends over time.

    Area charts, essentially, emphasize the magnitude of change over time. So, they are mostly used to draw attention to the total value across a trend.

    Next amongst the Popular Power BI charts is,

    Bar/Column Charts

    Bar charts are the standard for looking at a specific value across different categories. Bar charts are definitely one of the most, if not the most common data visualizations across all BI platforms.

    You can quickly highlight differences between categories, show trends and outliers, and reveal historical highs and lows at a glance. 

    Pie/Donut Charts

    Pie charts are powerful for adding detail to other visualizations. The angle of the pie determines the value measured. Different colors can be assigned to the pie chart to represent the members in a certain dimension. 

    A doughnut chart is pretty similar to a pie chart in the context that it shows the relationship of parts to a whole. The only difference is that the centre is blank and allows space for us to view it more like a stacked bar chart coiled around itself.

    Moving on with this Popular Power BI charts article

    Funnel Charts

    The funnel chart helps you visualize a process that has stages or levels. It portrays the items that flow sequentially from one stage to the next. You can use a funnel chart when there is a sequential flow between stages, such as a sales process that starts with leads, goes through the segregation of potential sales and dead leads and finally comes down to purchase fulfilment.

    Moving on towards the final section of this article on Power BI charts

    Key Performance Indicators

    Key Performance Indicators display progress toward a measurable goal. KPIs mainly answer 2 questions:

    • What am I ahead or behind on?
    • How far ahead or behind am I?

    Hence, A KPI visual requires a base measure that evaluates to a value and a target measure, and a threshold or goal.

       

      Maps

      Maps in Power BI are used to associate both categorical and quantitative information with spatial locations. The combination of ArcGIS maps and Power BI takes these maps beyond the presentation of points on a map to a whole new level.

      The options available to us are base maps, location types, themes, symbol styles, and reference layers and it creates gorgeous informative map visuals. The combination of authoritative data layers the likes of census data with spatial analysis conveys a deeper perception of your data.

      Let us see how to use Popular Power BI charts to create a report,

      How to Create a Report on Power BI?

      Now there isn’t much use of the theory of Power BI if you’re not going to build anything on your own. Depending on your role, you may be someone who uses these charts for your own use or to share with your colleagues at work. Either way, you want to learn which chart to use where or at least understand how to interact with these Power BI Charts.

      There are many ways to create charts, but first things first, we’ll start by importing a very basic MS Excel dataset using Power BI service.

      If you’ve already created Power BI reports in Power BI Desktop, I would recommend installing the version of Power BI Desktop optimized for Power BI Report Server, so you know the server and the app are always in sync. You can have both versions 

      • You could connect to a variety of data sources. From the welcome screen, select the Get Data option and import the file/files you want to. In this tutorial, I’ll be using an On Street Crime dataset I’ve downloaded from Kaggle.
      • Now, get to the Data View and make the necessary altercations in the data you’ve imported.
      • You can now begin designing your report.

      • When you think you’re done, go ahead and Publish the report to the Power BI website.

      This brings us to the end of this article on Popular Power BI charts.

      If you wish to learn Power BI and build a career in data visualization or BI, then check out our Power BI Training Certification which comes with instructor-led live training and real-life project experience. This training will help you understand Power BI in depth and help you achieve mastery over the subject.

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

      Why Python Programming Language Is a Must Have Skill?

      $
      0
      0

      No matter how much one would chose to ignore it, it is imperative to understand that we live in a fast-pasted tech savvy world where things around us change rapidly. The key factor that has led to this outburst of technological revelations is credited to the rise in software industry. A few years ago, software was bundled in with the hardware bought. It was never considered to have great value. However, the scenario today is quite different. In this article, Why  Python language and how it is the new “in thing” in todays’ IT world.

      Following pointers will be covered in this article,

      So let us get started then,

      Python In Artificial Intelligence

      One of the key features of python language is its simplicity in code writing. It uses 1/5th of the code when compared to other object oriented programs. This factor makes it the most sort after language used in trending domains like AI. AI has a wide horizon under which it deals with machine learning and deep learning.

      Python has a variety of libraries that appeal to the needs of any programmer. It has some prebuilt libraries such as Numpy, SciPy, Pybrain etc., which are for advance and scientific computing. Python is platform independent, which makes it quite flexible in interfacing between other technologies. In addition, the current user base of the language is very diverse. Most python developers share queries and solutions on portals, which make it a comprehensive knowledge resource as well.

      The language not only applies OOPs concepts but incorporates a scripting approach as well. There are numerous IDEs (Integrated Development Environment) like PyCharm, which allows users to carry out complex codes and algorithms of AI related projects. In an AI’s SDLC (Software Development Life Cycle) phase like testing, debugging and development, it becomes a cakewalk, when compared against other contemporary programming languages like Java, Javascript and Pearl.

      These languages would definitely yield desired results but would make tasks cumbersome. Hence, looking at the numerous advantages of python, there is no doubt that it plays a crucial aspect in today’s AI technologies.

      Moving on with this article on Why Python?

      Deep Learning In Python 

      Deep learning is another trending domain in todays’ world of Artificial Intelligence. Deep learning techniques are so powerful because they represent and learn of how to solve a problem in the best possible way. This is called as “Representation Learning”.  The deep learning programs are trained with numerous examples that make its predictions accurate. Deep learning models are extensively used in colorizing images and videos. It is used in identification of objects in photographs popularly termed as ‘face-recognition’.   

      Python is the best platform to get started with deep learning models. Python is quick and easy to understand. It has a ton of features that make deep learning projects faster to operate and develop. The two most versatile libraries used by any deep learning expert is “Theano” and “Tensorflow”. These are quiet technical and used exhaustively by research groups. The “Keras” library is written in pure python which provides an interface for the above two libraries.

      Moving on with this article on Why Python?

      Python Developer Salary

      If you are currently, a python developer this part might be music to your ears. We have discussed the value that python carries in today’s tech space and there is no reason not to believe that developers are paid handsomely. The average salary is about $123,743 as per “Googroo” and “Indeed” websites. Python lives up to be the hottest skill any IT professional can possess in this generation. The below graph shows a sharp spike for Python developers as compared to other languages.

      Next in this article on Why Python?

      Python Programming Language 

      Now that we know how important Python is to the world and us. Let us deep dive into learning some of the technical aspects of the programming language. The below illustrated topics are rudimentary and would be easy to grasp. 

      Next in this article on Why Python?

      Break In Python

      The break command in python is a commonly used to terminate the usual flow of a program abruptly. It is very similar to the break statement used in C programming. Let us consider the below illustration for clarity. This program checks for the number of factors of a number entered by the user. The while loop acts as an infinite loop that never terminates the program. Based on the user input, the number of factors is computed or in case user input is zero, appropriate statements are presented. After the execution of the entire program, the infinite iteration is withheld by the break command. In its absence, the program will run indefinitely.

       while(1):

      print(“nnHey ! Welcome to EDUREKA n”)

      print(“How are you today ?”)

       a=int(input(“nPlease enter the number = “))

       count =0

       if (a==0):

       print (“nnPlease enter non zero numbern”)

       print (“This program is now terminatedn”)

       print (“Thank You”)

      else:

       for x in range (1,a+1):

         if (x%2==0)

           count = count+1

       print (“n The number of factors of 2 is”, count)

       print (“n thank you for using this programn”)

      break;

      Output

      Next in this article on Why Python?

      Python Variables  

      Variables in Python are like containers to store certain some data values. Python does not have any particular method of declaring variables before utilizing them. The data type of such variables can be changed anywhere in the program flow. However, there are a few rules to follow while variable declaration:

      • A variable must start with a letter or an underscore character
      • A variable cannot start with a number
      • A variable cannot have special characters. It must be only alpha numeric.
      • A variable is case sensitive. NUMBER, Number and number are three different variables although they look similar.

      In Python, we can assign variables differently.

      • X,Y,Z = “Car”, “Bus”, “Bike” (Here, three variables can be declared in a single line to three different values)
      • X=Y=Z= 1000 (Here all three variables are associated to the same value in one statement)

      Using the “+” symbol we can add variables. If strings are stored in those variables then we refer to this as concatenation. If they store arithmetic values, then we consider it as usual mathematical calculations.

      • A=”EDUREKA IS A”
      • B=”GREAT WAY TO”
      • C=” LEARN PYTHON”
      • Print (A+B+C). This will result in “EDUREKA IS A GREAT WAY TO LEARN PYTHON”

      It is mandatory to note that one should ensure homogeneity while performing such operations. The variables that carry different datatypes should not be combined. If X=1000 and Y=”DATA SCIENCE”. The X+Y would throw an error. 

      Next in this article on Why Python?

      Slicing In Python 

      Slicing in python is to derive a sub string from a main string. Consider the below illustration of code.

      print(“nWelcome to Edurekan”)

      pyString=input(“Enter a string of your choice = ” )

      print(“nn The output is = n”)

      print(pyString[slice(0,3)])

      print(“nThank you! have a nice day “) 

      Output

      In the below example, “ICCWORLDCUP” is a string, which is a user input. The sub string derived from the program is “ICC”. How did this happen? The main statement responsible for this functionality is line 24. The index of the slice function picks out the characters from index 0 (starting index) and goes up to index 2. Within the range of 0,3 the letters ICC become a new string and this is the output.  

      Another way of slicing is with regard to negative index. This is also a good way for substring reversal. The parameters for string slicing function increases to 3. The first being the starting index from the end of the string, the second being the ending index and the third being the interval. Let us have a look.

      print(“nWELCOME TO EDUREKA n”)

      pyString=input(“Enter a string of your choice =”)

      print(“n nThe output is = n”)

      print(pyString[slice(-1,-5,-1)])

      print(“nThank You ! Have a nice day”) 

      Output

      In the ‘slice’ function, the first -1 points at the last letter “M” of the string. The cursor counts backwards with an interval of 1 and stops after 4 counts which leads to the output “MARG” which is the last 4 letters “GRAM” being reversed.

      This brings us to the end of this article on Why Python?

      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. Got a question for us? Mention them in the comments section of “Why Python?” article and we will get back to you.

      What is ITIL®? – One Stop Solution to IT Infrastructure Library

      $
      0
      0

      Though profit and loss hold an integral value in any business model, businesses all over the world, however, strive to provide a better service and value to its customers. But this is possible only if your business has a proper and organized IT infrastructure. ITIL® is one of the best and leading IT Service Management framework which is recognized globally. Through the medium of this article, I will give you complete insights into what is ITIL®.

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

      So, let’s get started.

      What is ITIL®?

      ITIL® stands for Information Technology Infrastructure Library. It is a set of guidelines that helps an IT practitioner in delivering the best services. These guidelines are nothing but the best practices which are observed, gathered and put together over time to deliver anything but the best services. ITIL provides direction to an organization and its people in utilizing IT as a tool for changing, transforming, and developing the business. It mainly aims to enhance the overall performance of the business and deliver predicted service levels. It also helps the IT practitioners in delivering impactful and tech-powered services to the customers across the globe.

      The systematic and structured approach of ITIL towards the IT service management helps an organization in managing risk, establishing cost-effective practices, strengthening customer relations. All these ultimately result in building a stable IT environment. In other words, ITIL is being adopted by the companies worldwide as it helps them in recognizing their benefits through structured and detailed processes. The organizations implementing this methodology are powered by the right technologies which are relevant for them, thus enhancing resource optimization.

      I hope this gives you a clear understanding of what is ITIL® all about. Let’s now move and see what are the various advantages of using ITIL.

      Advantages of ITIL®

      Below I have listed down a few of the advantages of implementing ITIL®:

      1. With a structured approach, ITIL provides a stronger alignment of IT with business
      2. It helps in improving service delivery and hence provides better customer satisfaction
      3. ITIL optimizes the resource utilization which results in lower costs and expenses
      4. It provides wider visibility of the IT costs and various assets
      5. ITIL also helps in identifying business risk and service disruption with better management of services
      6. It enables a highly stable service environment that is completely feasible with constant business changes

      Now that you are aware of how ITIL helps businesses, let’s now see how the idea of ITIL came into existence.

      ITIL® Evolution

      Initiation

      The concept of ITIL® was first released in 1989 formerly known as GITIM (Government Information Technology Infrastructure Management). It was released with the aim of improving support and delivery for the organizations. By the early 1990s, a wide number of government agencies and private sector companies began to implement it worldwide. ITIL was soon extended to a 30-volume catalog which contained the best IT practices for catering client and business needs.

      ITIL v2

      In 2000, ITIL went through its first major change and was named as ITIL® v2. This version mainly focussed to make ITIL an easily accessible framework and arranged the previously 30 – volume framework into 9 modules. With this change, ITIL gradually became the standard de-facto for IT best practices and big brands worldwide like Microsoft started adopting ITIL® making it the most widely used IT service management tool.

      ITIL® v3 a.k.a. ITIL® Refresh Project

      In 2007, ITIL went through one more major revision. This version of ITIL® emphasized more on IT business integration and built around the concept of service lifestyle structure. In this version, all 26 ITIL processes and functions were condensed into 5 volumes and on release gained the name ITIL Refresh Project. This version of ITIL adopted a lifecycle approach to service management.

      Revision of ITIL® v3

      In 2011, AXELOS released a revised version of ITIL® which resolved the major errors and inconsistencies that were faced in ITIL v3. In this version, the ITIL service catalog was divided into 5 volumes: ITIL Service Strategy, ITIL Service Design, ITIL Service Transition, ITIL Service Operation and ITIL Continual Service Improvement. Later in 2013, ownership of ITIL was handed over to AXELOS Ltd.

      ITIL® v4

      The latest version of  ITIL® that is ITIL v4 was released early in 2019. ITIL v4 provides better practical guidance to use ITIL, especially in collaborative environments. With this, organizations can now easily align ITIL with other frameworks such as DevOps, Agile, and Lean, etc. This version of ITIL holds a holistic philosophy towards service management which makes it broader and more inclusive for today’s IT environment.

      But have you ever wondered how ITIL is so successful? In the next section of this article on What is ITIL®, let’s find out the reasons for ITIL being so effective.

      ITIL® Elements

      ITIL framework is built upon three main pillars which make ITIL® extensively flexible, scalable and versatile framework. These three pillars are:

      1. Processes
      2. Function
      3. KPIs

      Let’s me now explain each of them one by one in detail.

      ITIL® Processes

       ITIL categorizes the IT Service Management (ITSM) into 5 five service lifecycle stages which are:

      1. Service Strategy is the stage which helps the organizations in identifying their business mission and vision. This also helps in developing strategies to meet customer requirements and priorities.
      2. Service Design is the stage of designing processes and functions. In this, service management processes, technology, infrastructure, and products are planned and designed.
      3. Service Transition is the process of project management where it focuses on maintaining the current state of service all while deploying the new organizational changes. It also helps in risk mitigation.
      4. Service Operations is the stage which offers various ways to manage IT services on a regular basis.
      5. Continual Service Improvement is the stage that introduces the improvements and policy changes/ updates within the ITIL process framework.

      There are 26 processes in ITIL framework which have been segregated into the above five process areas. These processes are nothing but a sequence of activities with some inputs, triggers, and specific outputs.

      ITIL® Function

      The ITIL Function is a team or group of people and the tools which they use to perform one or more processes or activities. For example, a service desk which manages the service requests, complaints or questions from the customers, etc.

      ITIL® KPIs

      KPIs (Key Performance Indicators) are used to measure the performance of an organization. KPIs helps a business in obtaining various information such as the effectiveness and efficiency of their processes, bottlenecks faced, etc. But the main function of KPIs is to help companies in discovering ways which will help them to manage and optimize their internal operations better.

      This brings us to the end of this article on what is ITIL®.

      If you found this ‘What is ITIL®‘ article relevant, check out the ITIL® Certification Training by Edureka, a trusted online learning company with a network of more than 250,000 satisfied learners spread across the globe. This course is designed to give you the right expertise and skills that provide a modular approach to the ITIL® framework and consists of various aspects of ITIL® best practices like ITIL® service operation and design.

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

      Everything you Must Know about Velocity in Agile

      $
      0
      0

      Agile enables to decrease the effort and amount of planning that is needed to commence projects and thus focuses on the creation of valuable products and services that can be offered to customers and users quickly. On the contrary, organizations that are not familiar with agile or are newly introduced to it are often clueless about how to make the output of their teams predictable and consistent. We will understand the following topics in this Velocity in Agile Article:

       

      What is Velocity in Agile?

      To measure the progress of your agile teams, Velocity is a great metric tool that is applied. In layman’s language, velocity refers to the amount of work done by the team in a given amount of time. There are various parameters of measuring velocity for a team.

      It can be measured in the hours taken by an individual, a number of tasks or story points. It depends on whatever unit of measurement you use to calculate your work.

       

      Velocity in Kanban and Scrum

      In KanBan, a constant set of tasks are dealt with by the teams wherein all the tasks are of the same size and pose the same amount of burden. In this case, velocity can be measured by the number of tasks completed in a single day. By calculating the daily velocities over the span of a week’s time and arriving at its average, you can then predict and estimate the amount of work the team can tackle over a longer period of time.

      On the other hand, the velocity of a Scrum team refers to the number of story points of person-hours that are completed in a sprint.

       

      How to use Velocity

      Using Velocity gives great insight into a team’s development and progress as it is used to measure productivity and make predictions as well for the team to perform better. On the contrary, it does not contain all the necessary relevant information which is required to make good and reliable predictions.

      • For this purpose, Scrum masters, Release Managers, and Product Owners need to brainstorm and focus on details. Velocity as a tool proves to be beneficial when it is used with stable and highly experienced teams who have been working together for long and have been estimating together as well. The velocity will prove to be less efficient and meaningful if the team members keep changing frequently or are absent for long.

      • Another case in which the velocity can suffer is if the product backlog is missing user stories and this is most likely to happen over a long period of time. One of the most promising benefits of agile is that it gives you the skill and ability to respond quickly to changes in the customer’s needs and incorporate these alterations into your product in a relatively less frame of time.

      • It proves to be a great advantage when it comes to planning releases in detail efficiently, well ahead of time. It is important to keep in mind that velocity can be measured through a time frame as well (iterations, sprints or weeks). But, once you decide how to measure the velocity you should continue measuring it the same way as you go forward in your project. For example, to measure velocity in agile usually, the number of user points in a sprint is measured by the Scrum teams.

      • After this is measured on the basis of a few sprints, the team is able to predict how many user points should be completed per sprint. Then the team can arrive at an estimation of how many sprints they would require to complete a given project and thus be able to measure the efficiency of the team as well along the way.

       

      How does Velocity in Agile help measure efficiency?

      You cannot rely on the numbers provided by agile velocity. Rather it is the trends that will ultimately measure and facilitate efficiency. Thus, velocity cannot be used and relied on as an efficiency goal. It is important to understand what this means.

      When the team witnesses velocity numbers decreasing, they wonder and focus on what can be done to get the numbers higher or back up to where they were. This poses great pressure on developers to achieve a specific velocity goal. Instead, if your velocity numbers are spiraling downwards, the team should dig deeper and analyze the possible inefficiencies that could be causing the decline in the numbers.

      In order to yield a more accurate timeline and budget, you could aim for a slightly lower velocity number going ahead in the project. At the same time, a rapid increase in velocity numbers should not be avoided as it could indicate that the team is going too fast and is not maintaining as well as producing the desired quality of work.

      The safest and best way to use velocity in agile is to be realistic and keep the goal simple in order to identify inefficiencies in the project. Hence, the ultimate objective of velocity is to be able to achieve efficiency while maintaining quality.

       

      Advantage and Disadvantage of Velocity

      Along with possibly increasing the overall ability and capacity of the team, velocity enables the development team to arrive at an estimate of how many product backlogs they may forecast for the current sprint. The product owner can get an understanding of the speed at which a team can work through the backlog and he can revise the predicted delivery time based on the velocity of the development team.

      Velocity as a metric is highly appreciated as the Scrum team can understand their own progress, their strengths as well as their shortcomings in order to perform better in the coming sprints. 

      On the other hand, velocity should not be used as a measure to analyze the team’s performance. It is vital for team transparency to exist for smooth functioning and delivery of the product. 

      To conclude, velocity is not an end goal but as a result. It should be used for continuous improvement of the team and not for any other purpose. The moment this metric is used for another purpose, the teams will cease to reap its benefits and will ultimately result in losing focus on their agility goals.

       

      With this, we come to an end of this Velocity in Agile Article. I hope you got an understanding of the concepts of Velocity, and how useful it is in Agile, Scrum and Kanban.

      The Certified Scrum Master Training  at Edureka provides a comprehensive overview of the Scrum framework for agile project management and will prepare you to become a certified Scrum Master. You’ll learn the fundamentals of Scrum such as the Scrum life cycle, how to organise a Scrum team and set up a project, and how to implement a Scrum, from releases and sprints to enterprise transformation. This two-day classroom training will open new career opportunities for you in multiple industry sectors. 

      Viewing all 1753 articles
      Browse latest View live