title
stringlengths 3
221
| text
stringlengths 17
477k
| parsed
listlengths 0
3.17k
|
---|---|---|
How to create a constant array in JavaScript? Can we change its values? Explain. | To create a const array in JavaScript we need to write const before the array name. The individual array elements can be reassigned but not the whole array.
Following is the code to create a constant array in JavaScript.
Live Demo
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<style>
body {
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}
.result,.sample {
font-size: 20px;
font-weight: 500;
}
</style>
</head>
<body>
<h1>Const array in JavaScript</h1>
<div class="sample"></div>
<div style="color: green;" class="result"></div>
<button class="Btn">CLICK HERE</button>
<h3>
Click on the above button to change array values and reassign the array later
</h3>
<script>
let sampleEle = document.querySelector(".sample");
let resEle = document.querySelector(".result");
const arr = [22, 33, 44, 55];
sampleEle.innerHTML = "Original Array = " + arr;
document.querySelector(".Btn").addEventListener("click", () => {
(arr[0] = 44), (arr[1] = 99), (arr[2] = 0);
resEle.innerHTML += "Changing array elements value" + arr + '<br>';
try {
arr = [11, 11, 11, 11];
}
catch (err) {
resEle.innerHTML += "Trying to reassign const array = " + err;
}
});
</script>
</body>
</html>
The above code will produce the following output −
On clicking the ‘CLICK HERE’ button − | [
{
"code": null,
"e": 1344,
"s": 1187,
"text": "To create a const array in JavaScript we need to write const before the array name. The individual array elements can be reassigned but not the whole array."
},
{
"code": null,
"e": 1408,
"s": 1344,
"text": "Following is the code to create a constant array in JavaScript."
},
{
"code": null,
"e": 1419,
"s": 1408,
"text": " Live Demo"
},
{
"code": null,
"e": 2586,
"s": 1419,
"text": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"UTF-8\" />\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n<title>Document</title>\n<style>\n body {\n font-family: \"Segoe UI\", Tahoma, Geneva, Verdana, sans-serif;\n }\n .result,.sample {\n font-size: 20px;\n font-weight: 500;\n }\n</style>\n</head>\n<body>\n<h1>Const array in JavaScript</h1>\n<div class=\"sample\"></div>\n<div style=\"color: green;\" class=\"result\"></div>\n<button class=\"Btn\">CLICK HERE</button>\n<h3>\nClick on the above button to change array values and reassign the array later\n</h3>\n<script>\n let sampleEle = document.querySelector(\".sample\");\n let resEle = document.querySelector(\".result\");\n const arr = [22, 33, 44, 55];\n sampleEle.innerHTML = \"Original Array = \" + arr;\n document.querySelector(\".Btn\").addEventListener(\"click\", () => {\n (arr[0] = 44), (arr[1] = 99), (arr[2] = 0);\n resEle.innerHTML += \"Changing array elements value\" + arr + '<br>';\n try {\n arr = [11, 11, 11, 11];\n }\n catch (err) {\n resEle.innerHTML += \"Trying to reassign const array = \" + err;\n }\n });\n</script>\n</body>\n</html>"
},
{
"code": null,
"e": 2637,
"s": 2586,
"text": "The above code will produce the following output −"
},
{
"code": null,
"e": 2675,
"s": 2637,
"text": "On clicking the ‘CLICK HERE’ button −"
}
] |
SQL Full Outer Join Using Left and Right Outer Join and Union Clause | 21 Apr, 2021
An SQL join statement is used to combine rows or information from two or more than two tables on the basis of a common attribute or field. There are basically four types of JOINS in SQL.
In this article, we will discuss FULL OUTER JOIN using LEFT OUTER Join, RIGHT OUTER JOIN, and UNION clause.
Consider the two tables below:
Sample Input Table 1:
Sample Input Table 2:
Full Join provides results with the concatenation of LEFT JOIN and RIGHT JOIN. The result will contain all the rows from both Table 1 and Table 2. The rows having no matching in the result table will have NULL values.
SELECT * FROM Table1
FULL OUTER JOIN Table2
ON Table1.column_match=Table2.column_match;
Table1: First Table in Database.
Table2: Second Table in Database.
column_match: The column common to both the tables.
The above query can also be written using a combination of LEFT OUTER JOIN, RIGHT OUTER JOIN, and UNION. The meaning of UNION is to join two or more data sets into a single set. The above query and the below query will provide the same output.
SELECT * FROM Table1
LEFT OUTER JOIN Table2
ON Table1.column_match=Table2.column_match
UNION
SELECT * FROM Table1
RIGHT OUTER JOIN Table2
ON Table1.column_match=Table2.column_match;
Table1: First Table in Database.
Table2: Second Table in Database.
column_match: The column common to both the tables.
Sample Output:
We have considered the Customer and Purchase Information of mobile phones from an E-Commerce site during Big Billion Days. The Database E-Commerce has two tables one has information about the Product and the other one has information about the Customer. Now, we will perform a FULL OUTER JOIN between these two tables to concatenate them into a single table and get complete data about the customers and the products they purchased from the site.
Now let’s consider the purchase_information table. To view the table use the below query:
SELECT * FROM purchase_information;
Output:
Purchase Table
To view the customer_information table use the below query:
SELECT * FROM customer_information;
Output:
Customer Table
Now we can simply call the FULL OUTER JOIN clause to achieve a combined result from both the above-created tables using the below query:
SELECT * FROM purchase_information
FULL OUTER JOIN customer_information
ON purchase_information.cust_name=customer_information.customer_name
Output:
RESULT TABLE USING FULL OUTER JOIN
But we can achieve the same results without using the FULL OUTER JOIN clause. For this we make use of the LEFT JOIN, RIGHT JOIN, and the UNION clause as shown below:
SELECT FROM purchase_information
LEFT OUTER JOIN customer information
ON purchase_information.cust_name=customer_information.customer_name
UNION
SELECT * FROM purchase_information
RIGHT OUTER JOIN customer_information
ON purchase_information.cust_name=customer_information.customer_name
Output:
RESULTANT TABLE OF FULL OUTER JOIN USING LEFT AND RIGHT AND UNION
Picked
SQL-Query
SQL
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here. | [
{
"code": null,
"e": 54,
"s": 26,
"text": "\n21 Apr, 2021"
},
{
"code": null,
"e": 241,
"s": 54,
"text": "An SQL join statement is used to combine rows or information from two or more than two tables on the basis of a common attribute or field. There are basically four types of JOINS in SQL."
},
{
"code": null,
"e": 349,
"s": 241,
"text": "In this article, we will discuss FULL OUTER JOIN using LEFT OUTER Join, RIGHT OUTER JOIN, and UNION clause."
},
{
"code": null,
"e": 380,
"s": 349,
"text": "Consider the two tables below:"
},
{
"code": null,
"e": 402,
"s": 380,
"text": "Sample Input Table 1:"
},
{
"code": null,
"e": 424,
"s": 402,
"text": "Sample Input Table 2:"
},
{
"code": null,
"e": 642,
"s": 424,
"text": "Full Join provides results with the concatenation of LEFT JOIN and RIGHT JOIN. The result will contain all the rows from both Table 1 and Table 2. The rows having no matching in the result table will have NULL values."
},
{
"code": null,
"e": 850,
"s": 642,
"text": "SELECT * FROM Table1\nFULL OUTER JOIN Table2\nON Table1.column_match=Table2.column_match;\n\nTable1: First Table in Database.\nTable2: Second Table in Database.\ncolumn_match: The column common to both the tables."
},
{
"code": null,
"e": 1094,
"s": 850,
"text": "The above query can also be written using a combination of LEFT OUTER JOIN, RIGHT OUTER JOIN, and UNION. The meaning of UNION is to join two or more data sets into a single set. The above query and the below query will provide the same output."
},
{
"code": null,
"e": 1396,
"s": 1094,
"text": "SELECT * FROM Table1\nLEFT OUTER JOIN Table2\nON Table1.column_match=Table2.column_match\nUNION\nSELECT * FROM Table1\nRIGHT OUTER JOIN Table2\nON Table1.column_match=Table2.column_match;\n\nTable1: First Table in Database.\nTable2: Second Table in Database.\ncolumn_match: The column common to both the tables."
},
{
"code": null,
"e": 1411,
"s": 1396,
"text": "Sample Output:"
},
{
"code": null,
"e": 1858,
"s": 1411,
"text": "We have considered the Customer and Purchase Information of mobile phones from an E-Commerce site during Big Billion Days. The Database E-Commerce has two tables one has information about the Product and the other one has information about the Customer. Now, we will perform a FULL OUTER JOIN between these two tables to concatenate them into a single table and get complete data about the customers and the products they purchased from the site."
},
{
"code": null,
"e": 1948,
"s": 1858,
"text": "Now let’s consider the purchase_information table. To view the table use the below query:"
},
{
"code": null,
"e": 1985,
"s": 1948,
"text": "SELECT * FROM purchase_information; "
},
{
"code": null,
"e": 1993,
"s": 1985,
"text": "Output:"
},
{
"code": null,
"e": 2008,
"s": 1993,
"text": "Purchase Table"
},
{
"code": null,
"e": 2068,
"s": 2008,
"text": "To view the customer_information table use the below query:"
},
{
"code": null,
"e": 2104,
"s": 2068,
"text": "SELECT * FROM customer_information;"
},
{
"code": null,
"e": 2112,
"s": 2104,
"text": "Output:"
},
{
"code": null,
"e": 2127,
"s": 2112,
"text": "Customer Table"
},
{
"code": null,
"e": 2264,
"s": 2127,
"text": "Now we can simply call the FULL OUTER JOIN clause to achieve a combined result from both the above-created tables using the below query:"
},
{
"code": null,
"e": 2405,
"s": 2264,
"text": "SELECT * FROM purchase_information\nFULL OUTER JOIN customer_information\nON purchase_information.cust_name=customer_information.customer_name"
},
{
"code": null,
"e": 2413,
"s": 2405,
"text": "Output:"
},
{
"code": null,
"e": 2448,
"s": 2413,
"text": "RESULT TABLE USING FULL OUTER JOIN"
},
{
"code": null,
"e": 2614,
"s": 2448,
"text": "But we can achieve the same results without using the FULL OUTER JOIN clause. For this we make use of the LEFT JOIN, RIGHT JOIN, and the UNION clause as shown below:"
},
{
"code": null,
"e": 2902,
"s": 2614,
"text": "SELECT FROM purchase_information\nLEFT OUTER JOIN customer information\nON purchase_information.cust_name=customer_information.customer_name\nUNION\nSELECT * FROM purchase_information\n\nRIGHT OUTER JOIN customer_information\nON purchase_information.cust_name=customer_information.customer_name"
},
{
"code": null,
"e": 2910,
"s": 2902,
"text": "Output:"
},
{
"code": null,
"e": 2976,
"s": 2910,
"text": "RESULTANT TABLE OF FULL OUTER JOIN USING LEFT AND RIGHT AND UNION"
},
{
"code": null,
"e": 2983,
"s": 2976,
"text": "Picked"
},
{
"code": null,
"e": 2993,
"s": 2983,
"text": "SQL-Query"
},
{
"code": null,
"e": 2997,
"s": 2993,
"text": "SQL"
},
{
"code": null,
"e": 3001,
"s": 2997,
"text": "SQL"
}
] |
Servlet – HttpSession Login and Logout Example | 13 Jan, 2022
In general, the term “Session” in computing language, refers to a period of time in which a user’s activity happens on a website. Whenever you login to an application or a website, the server should validate/identify the user and track the user interactions across the application. To achieve this, Java Web Server supports the servlet standard session interface, called HttpSession, to perform all the session-related activities.
Java servlets has HttpSession(I) in javax.servlet.http package. This interface provides a way to identify a user across more than one-page requests or visit a Website. Servlet container uses this interface to create a session between an HTTP client and an HTTP server and stores information about that user. It provides various methods to manipulate information about a session such as,
To bind a session object with a specified user.
To get the creation time.
To know the last time, the user had accessed the website in that session.
To invalidate the session etc.
Once the user login to the website, we need to create a new session. To do this, we need to use getSession() method in HttpServletRequest Interface.
1) HttpSession getSession():
Java
HttpSession session = request.getSession();
This method returns the current session associated with this request. If the request does not have a session, it creates one. We can also create a session using getSession(boolean create) method in HttpServletRequest Interface.
2) HttpSession getSession(boolean create):
We can pass the boolean parameters – true or false.
getSession(true):
Java
HttpSession session = request.getSession(true);
This method is the same as getSession(), where it returns the current session associated with this request. If the request does not have a session, it creates one.
getSession(false):
Java
HttpSession session = request.getSession(false);
This method returns the current session associated with this request. If the request does not have a session, it returns null.
Once the user requests to logout, we need to destroy that session. To do this, we need to use invalidate() method in HttpSession Interface.
void invalidate():
Java
HttpSession session = request.getSession();session.invalidate();
When this invalidate method is called on the session, it removes all the objects that are bound to that session.
We will create a basic Servlet program to display a welcome message for the validated users.
Steps to create the program:
Create “Dynamic Web Project – Servlet_LoginLogout” in Eclipse.
Under WEB-INF folder, create a JSP page – “login.jsp” to get the login credentials of the user.
Under src folder, create a Servlet – “LoginServlet.java” to process the login request and generate the response.
Under WEB-INF folder, create a JSP page – “welcome.jsp” to display the welcome message to the user.
Under src folder, create a Servlet – “LogoutServlet” to process the logout request and generate the response.
Run the program using “Run As -> Run on Server”.
Project Structure
login.jsp
HTML
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Login Page</title></head><body> <form action="login" method="post"> <h3>Enter Login details</h3> <table> <tr> <td>User Name:</td> <td><input type="text" name="usName" /></td> </tr> <tr> <td>User Password:</td> <td><input type="password" name="usPass" /></td> </tr> </table> <input type="submit" value="Login" /> </form></body></html>
In “login.jsp”, we have 2 fields, User Name, and Password.
User Name input type is specified as “text”, which means text field.
Password field input type is specified as “password” so that when the user enters the password field, it hides the letters as dots.
We have formed with action “login” and method “post” so that when this form is submitted, it maps with the LoginServlet which is having the same URL mapping, and executes the “doPost” method of that servlet.
LoginServlet.java:
Java
import java.io.IOException;import java.io.PrintWriter; import javax.servlet.RequestDispatcher;import javax.servlet.ServletException;import javax.servlet.annotation.WebServlet;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import javax.servlet.http.HttpSession; @WebServlet("/login")public class LoginServlet extends HttpServlet { private static final long serialVersionUID = 1L; public LoginServlet() { super(); } // doPost() method protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // Set the content type of response to "text/html" response.setContentType("text/html"); // Get the print writer object to write into the response PrintWriter out = response.getWriter(); // Get the session object HttpSession session = request.getSession(); // Get User entered details from the request using request parameter. String user = request.getParameter("usName"); String password = request.getParameter("usPass"); // Validate the password - If password is correct, // set the user in this session // and redirect to welcome page if (password.equals("geek")) { session.setAttribute("user", user); response.sendRedirect("welcome.jsp?name=" + user); } // If the password is wrong, display the error message on the login page. else { RequestDispatcher rd = request.getRequestDispatcher("login.jsp"); out.println("<font color=red>Password is wrong.</font>"); rd.include(request, response); } // Close the print writer object. out.close(); }}
In “LoginServlet.java”, we are using annotation “@WebServlet(“/login”)” to map the URL request. You can also specify this mapping for the servlet using Deployment descriptor – web.xml.
As we learned, get the session object of HttpSession. If the request does not have a session, it creates a session and returns it.
Here, we need to get the user details that are passed through the request, Name, and Password using “getParameter()” on the request object.
For simplicity, we are just validating the password field. So, the User name can be anything but the Password must be”geek”.
Validate the password and if it is correct, set this attribute value in session and redirect the page to display the welcome message.
If the entered password is incorrect, display an error message to the user in the login screen using the Print writer object.
welcome.jsp:
HTML
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Welcome Page</title></head><body> <form action="logout" method="get"> <h2> Hello <%=request.getParameter("name")%>! </h2> <h3>Welcome to GeeksforGeeks..</h3> <br> <input type="submit" value="Logout" /> </form> </body></html>
On the Welcome page, display the user name and a welcome message.
We have a form with action “logout” and method “get” so that when this form is submitted, it maps with the LogotServlet which is having the same URL mapping, and executes the “doGet” method of that servlet.
LogoutServlet.java:
Java
import java.io.IOException;import java.io.PrintWriter; import javax.servlet.ServletException;import javax.servlet.annotation.WebServlet;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse; @WebServlet("/logout")public class LogoutServlet extends HttpServlet { private static final long serialVersionUID = 1L; public LogoutServlet() { super(); } // doGet() method protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // Get the print writer object to write into the response PrintWriter out = response.getWriter(); // Set the content type of response to "text/html" response.setContentType("text/html"); // For understanding purpose, print the session object in the console before // invalidating the session. System.out.println("Session before invalidate: "+ request.getSession(false)); // Invalidate the session. request.getSession(false).invalidate(); // Print the session object in the console after invalidating the session. System.out.println("Session after invalidate: "+ request.getSession(false)); // Print success message to the user and close the print writer object. out.println("Thank you! You are successfully logged out."); out.close(); } }
Here also, we are using the annotation “@WebServlet(“/logout”)” to map the URL request.
When the user clicks on Logout, we need to destroy that session. So, call the “invalidate()” method on that session object.
For our understanding, we can print the session object value in the console to see if the session is invalidated.
As we learned, “getSession(false)” returns the current session on request if it exists, if not it returns null. So, after invalidating the session, it should print null in the console.
Finally, print the success message to the user.
Output:
Run the program on the server.
URL: http://localhost:8081/Servlet_LoginLogout/login.jsp
Login Page
The browser displays the Login page.
Login with User details
Enter the user name and password and click on Login.
Give the Password as “geek” as we are validating against it, if not it throws an error like below.
Incorrect_password
Enter the correct credentials and log in.
Welcome Page
The User name which we set in the session object is displayed with a welcome message.
Click on Logout.
Logout_success
Now, if you check the console, it prints the session object values.
Console
As you can see, “getSession()” returned the existing session object.
After the invalidate method, as there is no session, it returned “null”.
1) In the above example, we have used the “invalidate()” method, you can also use the “removeAttribute(String name)” method in HttpSession Interface.
Java
HttpSession session = request.getSession();session.removeAttribute("user");
This method removes the object bound with the specified name, in this example – “user” from this session. If the session does not have an object bound with the specified name, it does nothing. So, instead of the “invalidate()” method, you can use the “removeAttribute(String)” to logout the user from the session.
2) In the above example, we invalidated the session manually. If you want, you can also specify the session for time out automatically after being inactive for a defined time period.
“void setMaxInactiveInterval(int interval)”:
Java
HttpSession session = request.getSession();session.setMaxInactiveInterval(100);
This method specifies the time, in seconds, between client requests before the servlet container will invalidate this session. Here, as we specified the value “100”, the session will be invalidated after 100 seconds of inactive time from the user. Servlet container will destroy the session after 100 seconds of inactive – Session timeout.
In this way, you can maintain a session for a specific user/client and can implement Login and Logout for applications using HttpSession Interface methods based on the requirements.
java-servlet
Picked
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Stream In Java
Introduction to Java
Constructors in Java
Exceptions in Java
Generics in Java
Functional Interfaces in Java
Java Programming Examples
Strings in Java
Differences between JDK, JRE and JVM
Abstraction in Java | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n13 Jan, 2022"
},
{
"code": null,
"e": 459,
"s": 28,
"text": "In general, the term “Session” in computing language, refers to a period of time in which a user’s activity happens on a website. Whenever you login to an application or a website, the server should validate/identify the user and track the user interactions across the application. To achieve this, Java Web Server supports the servlet standard session interface, called HttpSession, to perform all the session-related activities."
},
{
"code": null,
"e": 846,
"s": 459,
"text": "Java servlets has HttpSession(I) in javax.servlet.http package. This interface provides a way to identify a user across more than one-page requests or visit a Website. Servlet container uses this interface to create a session between an HTTP client and an HTTP server and stores information about that user. It provides various methods to manipulate information about a session such as,"
},
{
"code": null,
"e": 894,
"s": 846,
"text": "To bind a session object with a specified user."
},
{
"code": null,
"e": 920,
"s": 894,
"text": "To get the creation time."
},
{
"code": null,
"e": 994,
"s": 920,
"text": "To know the last time, the user had accessed the website in that session."
},
{
"code": null,
"e": 1025,
"s": 994,
"text": "To invalidate the session etc."
},
{
"code": null,
"e": 1174,
"s": 1025,
"text": "Once the user login to the website, we need to create a new session. To do this, we need to use getSession() method in HttpServletRequest Interface."
},
{
"code": null,
"e": 1203,
"s": 1174,
"text": "1) HttpSession getSession():"
},
{
"code": null,
"e": 1208,
"s": 1203,
"text": "Java"
},
{
"code": "HttpSession session = request.getSession();",
"e": 1252,
"s": 1208,
"text": null
},
{
"code": null,
"e": 1481,
"s": 1252,
"text": "This method returns the current session associated with this request. If the request does not have a session, it creates one. We can also create a session using getSession(boolean create) method in HttpServletRequest Interface."
},
{
"code": null,
"e": 1524,
"s": 1481,
"text": "2) HttpSession getSession(boolean create):"
},
{
"code": null,
"e": 1576,
"s": 1524,
"text": "We can pass the boolean parameters – true or false."
},
{
"code": null,
"e": 1594,
"s": 1576,
"text": "getSession(true):"
},
{
"code": null,
"e": 1599,
"s": 1594,
"text": "Java"
},
{
"code": "HttpSession session = request.getSession(true);",
"e": 1647,
"s": 1599,
"text": null
},
{
"code": null,
"e": 1811,
"s": 1647,
"text": "This method is the same as getSession(), where it returns the current session associated with this request. If the request does not have a session, it creates one."
},
{
"code": null,
"e": 1830,
"s": 1811,
"text": "getSession(false):"
},
{
"code": null,
"e": 1835,
"s": 1830,
"text": "Java"
},
{
"code": "HttpSession session = request.getSession(false);",
"e": 1884,
"s": 1835,
"text": null
},
{
"code": null,
"e": 2011,
"s": 1884,
"text": "This method returns the current session associated with this request. If the request does not have a session, it returns null."
},
{
"code": null,
"e": 2151,
"s": 2011,
"text": "Once the user requests to logout, we need to destroy that session. To do this, we need to use invalidate() method in HttpSession Interface."
},
{
"code": null,
"e": 2170,
"s": 2151,
"text": "void invalidate():"
},
{
"code": null,
"e": 2175,
"s": 2170,
"text": "Java"
},
{
"code": "HttpSession session = request.getSession();session.invalidate();",
"e": 2240,
"s": 2175,
"text": null
},
{
"code": null,
"e": 2353,
"s": 2240,
"text": "When this invalidate method is called on the session, it removes all the objects that are bound to that session."
},
{
"code": null,
"e": 2446,
"s": 2353,
"text": "We will create a basic Servlet program to display a welcome message for the validated users."
},
{
"code": null,
"e": 2475,
"s": 2446,
"text": "Steps to create the program:"
},
{
"code": null,
"e": 2538,
"s": 2475,
"text": "Create “Dynamic Web Project – Servlet_LoginLogout” in Eclipse."
},
{
"code": null,
"e": 2634,
"s": 2538,
"text": "Under WEB-INF folder, create a JSP page – “login.jsp” to get the login credentials of the user."
},
{
"code": null,
"e": 2747,
"s": 2634,
"text": "Under src folder, create a Servlet – “LoginServlet.java” to process the login request and generate the response."
},
{
"code": null,
"e": 2847,
"s": 2747,
"text": "Under WEB-INF folder, create a JSP page – “welcome.jsp” to display the welcome message to the user."
},
{
"code": null,
"e": 2957,
"s": 2847,
"text": "Under src folder, create a Servlet – “LogoutServlet” to process the logout request and generate the response."
},
{
"code": null,
"e": 3006,
"s": 2957,
"text": "Run the program using “Run As -> Run on Server”."
},
{
"code": null,
"e": 3024,
"s": 3006,
"text": "Project Structure"
},
{
"code": null,
"e": 3034,
"s": 3024,
"text": "login.jsp"
},
{
"code": null,
"e": 3039,
"s": 3034,
"text": "HTML"
},
{
"code": "<%@ page language=\"java\" contentType=\"text/html; charset=ISO-8859-1\" pageEncoding=\"ISO-8859-1\"%><!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\"><html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\"><title>Login Page</title></head><body> <form action=\"login\" method=\"post\"> <h3>Enter Login details</h3> <table> <tr> <td>User Name:</td> <td><input type=\"text\" name=\"usName\" /></td> </tr> <tr> <td>User Password:</td> <td><input type=\"password\" name=\"usPass\" /></td> </tr> </table> <input type=\"submit\" value=\"Login\" /> </form></body></html>",
"e": 3823,
"s": 3039,
"text": null
},
{
"code": null,
"e": 3882,
"s": 3823,
"text": "In “login.jsp”, we have 2 fields, User Name, and Password."
},
{
"code": null,
"e": 3951,
"s": 3882,
"text": "User Name input type is specified as “text”, which means text field."
},
{
"code": null,
"e": 4083,
"s": 3951,
"text": "Password field input type is specified as “password” so that when the user enters the password field, it hides the letters as dots."
},
{
"code": null,
"e": 4291,
"s": 4083,
"text": "We have formed with action “login” and method “post” so that when this form is submitted, it maps with the LoginServlet which is having the same URL mapping, and executes the “doPost” method of that servlet."
},
{
"code": null,
"e": 4310,
"s": 4291,
"text": "LoginServlet.java:"
},
{
"code": null,
"e": 4315,
"s": 4310,
"text": "Java"
},
{
"code": "import java.io.IOException;import java.io.PrintWriter; import javax.servlet.RequestDispatcher;import javax.servlet.ServletException;import javax.servlet.annotation.WebServlet;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import javax.servlet.http.HttpSession; @WebServlet(\"/login\")public class LoginServlet extends HttpServlet { private static final long serialVersionUID = 1L; public LoginServlet() { super(); } // doPost() method protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // Set the content type of response to \"text/html\" response.setContentType(\"text/html\"); // Get the print writer object to write into the response PrintWriter out = response.getWriter(); // Get the session object HttpSession session = request.getSession(); // Get User entered details from the request using request parameter. String user = request.getParameter(\"usName\"); String password = request.getParameter(\"usPass\"); // Validate the password - If password is correct, // set the user in this session // and redirect to welcome page if (password.equals(\"geek\")) { session.setAttribute(\"user\", user); response.sendRedirect(\"welcome.jsp?name=\" + user); } // If the password is wrong, display the error message on the login page. else { RequestDispatcher rd = request.getRequestDispatcher(\"login.jsp\"); out.println(\"<font color=red>Password is wrong.</font>\"); rd.include(request, response); } // Close the print writer object. out.close(); }}",
"e": 6136,
"s": 4315,
"text": null
},
{
"code": null,
"e": 6321,
"s": 6136,
"text": "In “LoginServlet.java”, we are using annotation “@WebServlet(“/login”)” to map the URL request. You can also specify this mapping for the servlet using Deployment descriptor – web.xml."
},
{
"code": null,
"e": 6452,
"s": 6321,
"text": "As we learned, get the session object of HttpSession. If the request does not have a session, it creates a session and returns it."
},
{
"code": null,
"e": 6592,
"s": 6452,
"text": "Here, we need to get the user details that are passed through the request, Name, and Password using “getParameter()” on the request object."
},
{
"code": null,
"e": 6717,
"s": 6592,
"text": "For simplicity, we are just validating the password field. So, the User name can be anything but the Password must be”geek”."
},
{
"code": null,
"e": 6851,
"s": 6717,
"text": "Validate the password and if it is correct, set this attribute value in session and redirect the page to display the welcome message."
},
{
"code": null,
"e": 6977,
"s": 6851,
"text": "If the entered password is incorrect, display an error message to the user in the login screen using the Print writer object."
},
{
"code": null,
"e": 6990,
"s": 6977,
"text": "welcome.jsp:"
},
{
"code": null,
"e": 6995,
"s": 6990,
"text": "HTML"
},
{
"code": "<%@ page language=\"java\" contentType=\"text/html; charset=ISO-8859-1\" pageEncoding=\"ISO-8859-1\"%><!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\"><html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\"><title>Welcome Page</title></head><body> <form action=\"logout\" method=\"get\"> <h2> Hello <%=request.getParameter(\"name\")%>! </h2> <h3>Welcome to GeeksforGeeks..</h3> <br> <input type=\"submit\" value=\"Logout\" /> </form> </body></html>",
"e": 7579,
"s": 6995,
"text": null
},
{
"code": null,
"e": 7645,
"s": 7579,
"text": "On the Welcome page, display the user name and a welcome message."
},
{
"code": null,
"e": 7852,
"s": 7645,
"text": "We have a form with action “logout” and method “get” so that when this form is submitted, it maps with the LogotServlet which is having the same URL mapping, and executes the “doGet” method of that servlet."
},
{
"code": null,
"e": 7872,
"s": 7852,
"text": "LogoutServlet.java:"
},
{
"code": null,
"e": 7877,
"s": 7872,
"text": "Java"
},
{
"code": "import java.io.IOException;import java.io.PrintWriter; import javax.servlet.ServletException;import javax.servlet.annotation.WebServlet;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse; @WebServlet(\"/logout\")public class LogoutServlet extends HttpServlet { private static final long serialVersionUID = 1L; public LogoutServlet() { super(); } // doGet() method protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // Get the print writer object to write into the response PrintWriter out = response.getWriter(); // Set the content type of response to \"text/html\" response.setContentType(\"text/html\"); // For understanding purpose, print the session object in the console before // invalidating the session. System.out.println(\"Session before invalidate: \"+ request.getSession(false)); // Invalidate the session. request.getSession(false).invalidate(); // Print the session object in the console after invalidating the session. System.out.println(\"Session after invalidate: \"+ request.getSession(false)); // Print success message to the user and close the print writer object. out.println(\"Thank you! You are successfully logged out.\"); out.close(); } }",
"e": 9327,
"s": 7877,
"text": null
},
{
"code": null,
"e": 9415,
"s": 9327,
"text": "Here also, we are using the annotation “@WebServlet(“/logout”)” to map the URL request."
},
{
"code": null,
"e": 9539,
"s": 9415,
"text": "When the user clicks on Logout, we need to destroy that session. So, call the “invalidate()” method on that session object."
},
{
"code": null,
"e": 9653,
"s": 9539,
"text": "For our understanding, we can print the session object value in the console to see if the session is invalidated."
},
{
"code": null,
"e": 9838,
"s": 9653,
"text": "As we learned, “getSession(false)” returns the current session on request if it exists, if not it returns null. So, after invalidating the session, it should print null in the console."
},
{
"code": null,
"e": 9886,
"s": 9838,
"text": "Finally, print the success message to the user."
},
{
"code": null,
"e": 9894,
"s": 9886,
"text": "Output:"
},
{
"code": null,
"e": 9925,
"s": 9894,
"text": "Run the program on the server."
},
{
"code": null,
"e": 9982,
"s": 9925,
"text": "URL: http://localhost:8081/Servlet_LoginLogout/login.jsp"
},
{
"code": null,
"e": 9993,
"s": 9982,
"text": "Login Page"
},
{
"code": null,
"e": 10030,
"s": 9993,
"text": "The browser displays the Login page."
},
{
"code": null,
"e": 10054,
"s": 10030,
"text": "Login with User details"
},
{
"code": null,
"e": 10107,
"s": 10054,
"text": "Enter the user name and password and click on Login."
},
{
"code": null,
"e": 10206,
"s": 10107,
"text": "Give the Password as “geek” as we are validating against it, if not it throws an error like below."
},
{
"code": null,
"e": 10225,
"s": 10206,
"text": "Incorrect_password"
},
{
"code": null,
"e": 10267,
"s": 10225,
"text": "Enter the correct credentials and log in."
},
{
"code": null,
"e": 10280,
"s": 10267,
"text": "Welcome Page"
},
{
"code": null,
"e": 10366,
"s": 10280,
"text": "The User name which we set in the session object is displayed with a welcome message."
},
{
"code": null,
"e": 10383,
"s": 10366,
"text": "Click on Logout."
},
{
"code": null,
"e": 10398,
"s": 10383,
"text": "Logout_success"
},
{
"code": null,
"e": 10466,
"s": 10398,
"text": "Now, if you check the console, it prints the session object values."
},
{
"code": null,
"e": 10474,
"s": 10466,
"text": "Console"
},
{
"code": null,
"e": 10543,
"s": 10474,
"text": "As you can see, “getSession()” returned the existing session object."
},
{
"code": null,
"e": 10616,
"s": 10543,
"text": "After the invalidate method, as there is no session, it returned “null”."
},
{
"code": null,
"e": 10766,
"s": 10616,
"text": "1) In the above example, we have used the “invalidate()” method, you can also use the “removeAttribute(String name)” method in HttpSession Interface."
},
{
"code": null,
"e": 10771,
"s": 10766,
"text": "Java"
},
{
"code": "HttpSession session = request.getSession();session.removeAttribute(\"user\");",
"e": 10847,
"s": 10771,
"text": null
},
{
"code": null,
"e": 11161,
"s": 10847,
"text": "This method removes the object bound with the specified name, in this example – “user” from this session. If the session does not have an object bound with the specified name, it does nothing. So, instead of the “invalidate()” method, you can use the “removeAttribute(String)” to logout the user from the session."
},
{
"code": null,
"e": 11344,
"s": 11161,
"text": "2) In the above example, we invalidated the session manually. If you want, you can also specify the session for time out automatically after being inactive for a defined time period."
},
{
"code": null,
"e": 11389,
"s": 11344,
"text": "“void setMaxInactiveInterval(int interval)”:"
},
{
"code": null,
"e": 11394,
"s": 11389,
"text": "Java"
},
{
"code": "HttpSession session = request.getSession();session.setMaxInactiveInterval(100);",
"e": 11474,
"s": 11394,
"text": null
},
{
"code": null,
"e": 11814,
"s": 11474,
"text": "This method specifies the time, in seconds, between client requests before the servlet container will invalidate this session. Here, as we specified the value “100”, the session will be invalidated after 100 seconds of inactive time from the user. Servlet container will destroy the session after 100 seconds of inactive – Session timeout."
},
{
"code": null,
"e": 11996,
"s": 11814,
"text": "In this way, you can maintain a session for a specific user/client and can implement Login and Logout for applications using HttpSession Interface methods based on the requirements."
},
{
"code": null,
"e": 12009,
"s": 11996,
"text": "java-servlet"
},
{
"code": null,
"e": 12016,
"s": 12009,
"text": "Picked"
},
{
"code": null,
"e": 12021,
"s": 12016,
"text": "Java"
},
{
"code": null,
"e": 12026,
"s": 12021,
"text": "Java"
},
{
"code": null,
"e": 12124,
"s": 12026,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 12139,
"s": 12124,
"text": "Stream In Java"
},
{
"code": null,
"e": 12160,
"s": 12139,
"text": "Introduction to Java"
},
{
"code": null,
"e": 12181,
"s": 12160,
"text": "Constructors in Java"
},
{
"code": null,
"e": 12200,
"s": 12181,
"text": "Exceptions in Java"
},
{
"code": null,
"e": 12217,
"s": 12200,
"text": "Generics in Java"
},
{
"code": null,
"e": 12247,
"s": 12217,
"text": "Functional Interfaces in Java"
},
{
"code": null,
"e": 12273,
"s": 12247,
"text": "Java Programming Examples"
},
{
"code": null,
"e": 12289,
"s": 12273,
"text": "Strings in Java"
},
{
"code": null,
"e": 12326,
"s": 12289,
"text": "Differences between JDK, JRE and JVM"
}
] |
Context Variables in Python | 17 Aug, 2020
Context variable objects in Python is an interesting type of variable which returns the value of variable according to the context. It may have multiple values according to context in single thread or execution. The ContextVar class present in contextvars module, which is used to declare and work with context variables in python.
Note: This is supported in python version >= 3.7.
Following is the simple syntax to declare a complex variable :
Syntax: contextvars.ContextVar(name, default)
Parameter:
name: Name of the variable which can be used for reference or debug process.
default: Returns the value of this variable in particular context. If there is no value in the context then it will return the default value.
Return: contextvars class object.
Note: Context variables should always be created at the top of program, never in the functions or middle blocks of program.
Following are the methods defined in ContextVar class :
get(): Returns the value of context variable in the particular context, if it does not contain any then It will return the default value provided if provided, else raise a lookup error.set(value): This method is called to set a new value provided as parameter to the context variable in the particular context it is called in.reset(token): This method resets the value of context variable to that of before ContextVar.set() was called in reference to token returned by set() method.
get(): Returns the value of context variable in the particular context, if it does not contain any then It will return the default value provided if provided, else raise a lookup error.
set(value): This method is called to set a new value provided as parameter to the context variable in the particular context it is called in.
reset(token): This method resets the value of context variable to that of before ContextVar.set() was called in reference to token returned by set() method.
Example :
Python3
# import moduleimport contextvars # declaring the variable # to it's default valuecvar = contextvars.ContextVar("cvar", default = "variable") print("value of context variable cvar: \n", cvar.get()) # calling set methodtoken = cvar.set("changed") print("\nvalue after calling set method: \n", cvar.get()) # checking the type of token instanceprint("\nType of object instance returned by set method: \n", type(token)) # calling the reset method.cvar.reset(token) print("\nvalue after calling reset method: \n", cvar.get())
Output :
value of context variable cvar:
variable
value after calling set method:
changed
Type of object instance returned by set method:
<class 'Token'>
value after calling reset method:
variable
Token objects are returned by ContextVar.set() method and can be reused as parameter in ContextVar.reset(token) method to reset its value to previous token context variable as described above.
Following are the properties that can be used with token object :
Token.var: It returns the ContextVar object that was used to create this token returned by CotextVar.set() method. This has read only property, this is not callable.Token.old_value: Set to the value that variable had before calling of ContextVar.set() method because of which the token was generated. It is not callable, it has read only property. It points to Token.MISSING if the variable was not set before the call.Token.MISSING: Used as a marker by Token.old_value.
Token.var: It returns the ContextVar object that was used to create this token returned by CotextVar.set() method. This has read only property, this is not callable.
Token.old_value: Set to the value that variable had before calling of ContextVar.set() method because of which the token was generated. It is not callable, it has read only property. It points to Token.MISSING if the variable was not set before the call.
Token.MISSING: Used as a marker by Token.old_value.
Example :
Python3
import contextvars # declaring the variablecvar = contextvars.ContextVar("cvar", default = "variable") # calling set function to get a token objecttoken = cvar.set("changed") # token.var returns the ContextVar# object through which token is generated.print("ContextVar object though which token was generated: ")print(token.var) # As only one time set is called# it should return token.MISSING.print("\nAfter calling token.old_value : ")print(token.old_value) # Recalling set method again to# test other side of token.old_valuetoken = cvar.set("changed_2")print("\nPrinting the value set before set method called last : ")print(token.old_value) print("\nThe current value of context variable is : ")print(cvar.get())
Output :
ContextVar object though which token was generated:
<ContextVar name='cvar' default='variable' at 7f82d7c07048>
After calling token.old_value :
<object object at 0x7f8305801720>
Printing the value set before set method called last :
changed
The current value of context variable is :
changed_2
This context class in the contextvars module is the mapping of context variables to their values. This can also be called as manual context manager.
Following are some methods of this class :
context(): creates an empty context with no values in it.
get(): returns the value of current variable if assigned, otherwise returns the default value if given, otherwise returns None.
keys(): returns the list of all variables in the contextvars object.
items(): returns the list of tuples with two elements in each tuple, first the name of variable and second its value for all the variables present in contextvars object.
len(): returns the number of variables present in contextvars object.
values(): returns a list of values of all the variables present in contextvars object.
iter(): returns an iterator object which iterates over all the variables present in our contextvars object.
copy_context(): returns a shallow copy of current contextvars object.
run(callable, *args, **kwargs): Executes the function callable(*args, **kwargs) in the context to which run method is called and it returns the result of the program in callable function.
python-basics
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Iterate over a list in Python
Rotate axis tick labels in Seaborn and Matplotlib
Enumerate() in Python
Deque in Python
Stack in Python
Python Dictionary
sum() function in Python
Print lists in Python (5 Different Ways)
Different ways to create Pandas Dataframe
Queue in Python | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n17 Aug, 2020"
},
{
"code": null,
"e": 361,
"s": 28,
"text": "Context variable objects in Python is an interesting type of variable which returns the value of variable according to the context. It may have multiple values according to context in single thread or execution. The ContextVar class present in contextvars module, which is used to declare and work with context variables in python. "
},
{
"code": null,
"e": 411,
"s": 361,
"text": "Note: This is supported in python version >= 3.7."
},
{
"code": null,
"e": 474,
"s": 411,
"text": "Following is the simple syntax to declare a complex variable :"
},
{
"code": null,
"e": 520,
"s": 474,
"text": "Syntax: contextvars.ContextVar(name, default)"
},
{
"code": null,
"e": 531,
"s": 520,
"text": "Parameter:"
},
{
"code": null,
"e": 608,
"s": 531,
"text": "name: Name of the variable which can be used for reference or debug process."
},
{
"code": null,
"e": 750,
"s": 608,
"text": "default: Returns the value of this variable in particular context. If there is no value in the context then it will return the default value."
},
{
"code": null,
"e": 784,
"s": 750,
"text": "Return: contextvars class object."
},
{
"code": null,
"e": 909,
"s": 784,
"text": "Note: Context variables should always be created at the top of program, never in the functions or middle blocks of program. "
},
{
"code": null,
"e": 965,
"s": 909,
"text": "Following are the methods defined in ContextVar class :"
},
{
"code": null,
"e": 1448,
"s": 965,
"text": "get(): Returns the value of context variable in the particular context, if it does not contain any then It will return the default value provided if provided, else raise a lookup error.set(value): This method is called to set a new value provided as parameter to the context variable in the particular context it is called in.reset(token): This method resets the value of context variable to that of before ContextVar.set() was called in reference to token returned by set() method."
},
{
"code": null,
"e": 1634,
"s": 1448,
"text": "get(): Returns the value of context variable in the particular context, if it does not contain any then It will return the default value provided if provided, else raise a lookup error."
},
{
"code": null,
"e": 1776,
"s": 1634,
"text": "set(value): This method is called to set a new value provided as parameter to the context variable in the particular context it is called in."
},
{
"code": null,
"e": 1933,
"s": 1776,
"text": "reset(token): This method resets the value of context variable to that of before ContextVar.set() was called in reference to token returned by set() method."
},
{
"code": null,
"e": 1943,
"s": 1933,
"text": "Example :"
},
{
"code": null,
"e": 1951,
"s": 1943,
"text": "Python3"
},
{
"code": "# import moduleimport contextvars # declaring the variable # to it's default valuecvar = contextvars.ContextVar(\"cvar\", default = \"variable\") print(\"value of context variable cvar: \\n\", cvar.get()) # calling set methodtoken = cvar.set(\"changed\") print(\"\\nvalue after calling set method: \\n\", cvar.get()) # checking the type of token instanceprint(\"\\nType of object instance returned by set method: \\n\", type(token)) # calling the reset method.cvar.reset(token) print(\"\\nvalue after calling reset method: \\n\", cvar.get())",
"e": 2528,
"s": 1951,
"text": null
},
{
"code": null,
"e": 2537,
"s": 2528,
"text": "Output :"
},
{
"code": null,
"e": 2733,
"s": 2537,
"text": "value of context variable cvar: \nvariable\n\nvalue after calling set method: \nchanged\n\nType of object instance returned by set method: \n<class 'Token'>\n\nvalue after calling reset method: \nvariable\n"
},
{
"code": null,
"e": 2927,
"s": 2733,
"text": "Token objects are returned by ContextVar.set() method and can be reused as parameter in ContextVar.reset(token) method to reset its value to previous token context variable as described above. "
},
{
"code": null,
"e": 2993,
"s": 2927,
"text": "Following are the properties that can be used with token object :"
},
{
"code": null,
"e": 3464,
"s": 2993,
"text": "Token.var: It returns the ContextVar object that was used to create this token returned by CotextVar.set() method. This has read only property, this is not callable.Token.old_value: Set to the value that variable had before calling of ContextVar.set() method because of which the token was generated. It is not callable, it has read only property. It points to Token.MISSING if the variable was not set before the call.Token.MISSING: Used as a marker by Token.old_value."
},
{
"code": null,
"e": 3630,
"s": 3464,
"text": "Token.var: It returns the ContextVar object that was used to create this token returned by CotextVar.set() method. This has read only property, this is not callable."
},
{
"code": null,
"e": 3885,
"s": 3630,
"text": "Token.old_value: Set to the value that variable had before calling of ContextVar.set() method because of which the token was generated. It is not callable, it has read only property. It points to Token.MISSING if the variable was not set before the call."
},
{
"code": null,
"e": 3937,
"s": 3885,
"text": "Token.MISSING: Used as a marker by Token.old_value."
},
{
"code": null,
"e": 3947,
"s": 3937,
"text": "Example :"
},
{
"code": null,
"e": 3955,
"s": 3947,
"text": "Python3"
},
{
"code": "import contextvars # declaring the variablecvar = contextvars.ContextVar(\"cvar\", default = \"variable\") # calling set function to get a token objecttoken = cvar.set(\"changed\") # token.var returns the ContextVar# object through which token is generated.print(\"ContextVar object though which token was generated: \")print(token.var) # As only one time set is called# it should return token.MISSING.print(\"\\nAfter calling token.old_value : \")print(token.old_value) # Recalling set method again to# test other side of token.old_valuetoken = cvar.set(\"changed_2\")print(\"\\nPrinting the value set before set method called last : \")print(token.old_value) print(\"\\nThe current value of context variable is : \")print(cvar.get())",
"e": 4678,
"s": 3955,
"text": null
},
{
"code": null,
"e": 4687,
"s": 4678,
"text": "Output :"
},
{
"code": null,
"e": 4989,
"s": 4687,
"text": "ContextVar object though which token was generated:\n<ContextVar name='cvar' default='variable' at 7f82d7c07048>\n\nAfter calling token.old_value : \n<object object at 0x7f8305801720>\n\nPrinting the value set before set method called last : \nchanged \n\nThe current value of context variable is : \nchanged_2\n"
},
{
"code": null,
"e": 5139,
"s": 4989,
"text": "This context class in the contextvars module is the mapping of context variables to their values. This can also be called as manual context manager. "
},
{
"code": null,
"e": 5182,
"s": 5139,
"text": "Following are some methods of this class :"
},
{
"code": null,
"e": 5240,
"s": 5182,
"text": "context(): creates an empty context with no values in it."
},
{
"code": null,
"e": 5368,
"s": 5240,
"text": "get(): returns the value of current variable if assigned, otherwise returns the default value if given, otherwise returns None."
},
{
"code": null,
"e": 5437,
"s": 5368,
"text": "keys(): returns the list of all variables in the contextvars object."
},
{
"code": null,
"e": 5607,
"s": 5437,
"text": "items(): returns the list of tuples with two elements in each tuple, first the name of variable and second its value for all the variables present in contextvars object."
},
{
"code": null,
"e": 5677,
"s": 5607,
"text": "len(): returns the number of variables present in contextvars object."
},
{
"code": null,
"e": 5764,
"s": 5677,
"text": "values(): returns a list of values of all the variables present in contextvars object."
},
{
"code": null,
"e": 5872,
"s": 5764,
"text": "iter(): returns an iterator object which iterates over all the variables present in our contextvars object."
},
{
"code": null,
"e": 5942,
"s": 5872,
"text": "copy_context(): returns a shallow copy of current contextvars object."
},
{
"code": null,
"e": 6130,
"s": 5942,
"text": "run(callable, *args, **kwargs): Executes the function callable(*args, **kwargs) in the context to which run method is called and it returns the result of the program in callable function."
},
{
"code": null,
"e": 6144,
"s": 6130,
"text": "python-basics"
},
{
"code": null,
"e": 6151,
"s": 6144,
"text": "Python"
},
{
"code": null,
"e": 6249,
"s": 6151,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 6279,
"s": 6249,
"text": "Iterate over a list in Python"
},
{
"code": null,
"e": 6329,
"s": 6279,
"text": "Rotate axis tick labels in Seaborn and Matplotlib"
},
{
"code": null,
"e": 6351,
"s": 6329,
"text": "Enumerate() in Python"
},
{
"code": null,
"e": 6367,
"s": 6351,
"text": "Deque in Python"
},
{
"code": null,
"e": 6383,
"s": 6367,
"text": "Stack in Python"
},
{
"code": null,
"e": 6401,
"s": 6383,
"text": "Python Dictionary"
},
{
"code": null,
"e": 6426,
"s": 6401,
"text": "sum() function in Python"
},
{
"code": null,
"e": 6467,
"s": 6426,
"text": "Print lists in Python (5 Different Ways)"
},
{
"code": null,
"e": 6509,
"s": 6467,
"text": "Different ways to create Pandas Dataframe"
}
] |
Python | Pandas dataframe.min() | 24 Nov, 2018
Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric python packages. Pandas is one of those packages and makes importing and analyzing data much easier.
Pandas dataframe.min() function returns the minimum of the values in the given object. If the input is a series, the method will return a scalar which will be the minimum of the values in the series. If the input is a dataframe, then the method will return a series with minimum of values over the specified axis in the dataframe. By default the axis is the index axis.
Syntax:DataFrame.min(axis=None, skipna=None, level=None, numeric_only=None, **kwargs)Parameters :axis : Align object with threshold along the given axis.skipna : Exclude NA/null values when computing the resultlevel : If the axis is a MultiIndex (hierarchical), count along a particular level, collapsing into a Seriesnumeric_only : Include only float, int, boolean columns. If None, will attempt to use everything, then use only numeric data. Not implemented forSeries.
Returns : min : Series or DataFrame (if level specified)
Example #1: Use min() function to find the minimum value over the index axis.
# importing pandas as pdimport pandas as pd # Creating the dataframe df = pd.DataFrame({"A":[12, 4, 5, 44, 1], "B":[5, 2, 54, 3, 2], "C":[20, 16, 7, 3, 8], "D":[14, 3, 17, 2, 6]}) # Print the dataframedf
Lets use the dataframe.min() function to find the minimum value over the index axis
# find min Even if we do not specify axis = 0, the method # will return the min over the index axis by defaultdf.min(axis = 0)
Output : Example #2: Use min() function on a dataframe which has Na values. Also find the minimum over the column axis.
# importing pandas as pdimport pandas as pd # Creating the dataframe df = pd.DataFrame({"A":[12, 4, 5, None, 1], "B":[7, 2, 54, 3, None], "C":[20, 16, 11, 3, 8], "D":[14, 3, None, 2, 6]}) # Print the dataframedf
Lets implement the min function.
# skip the Na values while finding the minimumdf.min(axis = 1, skipna = True)
Output :
Python pandas-dataFrame
Python pandas-dataFrame-methods
Python-pandas
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here. | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n24 Nov, 2018"
},
{
"code": null,
"e": 242,
"s": 28,
"text": "Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric python packages. Pandas is one of those packages and makes importing and analyzing data much easier."
},
{
"code": null,
"e": 612,
"s": 242,
"text": "Pandas dataframe.min() function returns the minimum of the values in the given object. If the input is a series, the method will return a scalar which will be the minimum of the values in the series. If the input is a dataframe, then the method will return a series with minimum of values over the specified axis in the dataframe. By default the axis is the index axis."
},
{
"code": null,
"e": 1083,
"s": 612,
"text": "Syntax:DataFrame.min(axis=None, skipna=None, level=None, numeric_only=None, **kwargs)Parameters :axis : Align object with threshold along the given axis.skipna : Exclude NA/null values when computing the resultlevel : If the axis is a MultiIndex (hierarchical), count along a particular level, collapsing into a Seriesnumeric_only : Include only float, int, boolean columns. If None, will attempt to use everything, then use only numeric data. Not implemented forSeries."
},
{
"code": null,
"e": 1140,
"s": 1083,
"text": "Returns : min : Series or DataFrame (if level specified)"
},
{
"code": null,
"e": 1218,
"s": 1140,
"text": "Example #1: Use min() function to find the minimum value over the index axis."
},
{
"code": "# importing pandas as pdimport pandas as pd # Creating the dataframe df = pd.DataFrame({\"A\":[12, 4, 5, 44, 1], \"B\":[5, 2, 54, 3, 2], \"C\":[20, 16, 7, 3, 8], \"D\":[14, 3, 17, 2, 6]}) # Print the dataframedf",
"e": 1480,
"s": 1218,
"text": null
},
{
"code": null,
"e": 1564,
"s": 1480,
"text": "Lets use the dataframe.min() function to find the minimum value over the index axis"
},
{
"code": "# find min Even if we do not specify axis = 0, the method # will return the min over the index axis by defaultdf.min(axis = 0)",
"e": 1691,
"s": 1564,
"text": null
},
{
"code": null,
"e": 1811,
"s": 1691,
"text": "Output : Example #2: Use min() function on a dataframe which has Na values. Also find the minimum over the column axis."
},
{
"code": "# importing pandas as pdimport pandas as pd # Creating the dataframe df = pd.DataFrame({\"A\":[12, 4, 5, None, 1], \"B\":[7, 2, 54, 3, None], \"C\":[20, 16, 11, 3, 8], \"D\":[14, 3, None, 2, 6]}) # Print the dataframedf",
"e": 2080,
"s": 1811,
"text": null
},
{
"code": null,
"e": 2113,
"s": 2080,
"text": "Lets implement the min function."
},
{
"code": "# skip the Na values while finding the minimumdf.min(axis = 1, skipna = True)",
"e": 2191,
"s": 2113,
"text": null
},
{
"code": null,
"e": 2200,
"s": 2191,
"text": "Output :"
},
{
"code": null,
"e": 2224,
"s": 2200,
"text": "Python pandas-dataFrame"
},
{
"code": null,
"e": 2256,
"s": 2224,
"text": "Python pandas-dataFrame-methods"
},
{
"code": null,
"e": 2270,
"s": 2256,
"text": "Python-pandas"
},
{
"code": null,
"e": 2277,
"s": 2270,
"text": "Python"
}
] |
Write on an image using openCV in C++ | 04 Feb, 2021
In this article, we will discuss how to write over an image using OpenCV C++. Function putText() from OpenCV C++ library will be used to write text on an image.
Program 1:
Below program shows how to write text over a blank background image:
C++
// C++ program to demonstrate the// above approach#include <iostream>#include <opencv2/core/core.hpp> // Library to include for// drawing shapes#include <opencv2/highgui/highgui.hpp>#include <opencv2/imgproc.hpp>using namespace cv;using namespace std; // Driver Codeint main(int argc, char** argv){ // Create a blank image of size // (500 x 500) with white background // (B, G, R) : (255, 255, 255) Mat image(500, 500, CV_8UC3, Scalar(255, 255, 255)); // Check if the image is created // successfully. if (!image.data) { cout << "Could not open or" << " find the image" << endl; return 0; } // Writing over the Image Point org(30, 100); putText(image, "Text On Image", org, FONT_HERSHEY_SCRIPT_COMPLEX, 2.1, Scalar(0, 0, 255), 2, LINE_AA); // Show our image inside a window. imshow("Output", image); waitKey(0); return 0;}
Output:
Program 2:
Below program shows how to write text over a loaded image:
C++
// C++ program to demonstrate the// above approach#include <iostream>#include <opencv2/core/core.hpp> // Library to include for// drawing shapes#include <opencv2/highgui/highgui.hpp>#include <opencv2/imgproc.hpp>using namespace cv;using namespace std; // Driver Codeint main(int argc, char** argv){ // Create a blank image of size // (500 x 500) with white background // (B, G, R) : (255, 255, 255) Mat image = imread("C:/Users/harsh/Downloads/geeks.png", IMREAD_COLOR); // Check if the image is // created successfully. if (!image.data) { cout << "Could not open or" << " find the image" << std::endl; return 0; } // Writing over the Image Point org(1, 30); putText(image, "Geeks For Geeks", org, FONT_HERSHEY_SCRIPT_COMPLEX, 1.0, Scalar(0, 255, 0), 2, LINE_AA); // Show our image inside a window. imshow("Output", image); waitKey(0); return 0;}
Output:
OpenCV
C++
C++ Programs
CPP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Sorting a vector in C++
Polymorphism in C++
Pair in C++ Standard Template Library (STL)
Friend class and function in C++
std::string class in C++
Header files in C/C++ and its uses
Sorting a Map by value in C++ STL
Program to print ASCII Value of a character
How to return multiple values from a function in C or C++?
Shallow Copy and Deep Copy in C++ | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n04 Feb, 2021"
},
{
"code": null,
"e": 189,
"s": 28,
"text": "In this article, we will discuss how to write over an image using OpenCV C++. Function putText() from OpenCV C++ library will be used to write text on an image."
},
{
"code": null,
"e": 200,
"s": 189,
"text": "Program 1:"
},
{
"code": null,
"e": 269,
"s": 200,
"text": "Below program shows how to write text over a blank background image:"
},
{
"code": null,
"e": 273,
"s": 269,
"text": "C++"
},
{
"code": "// C++ program to demonstrate the// above approach#include <iostream>#include <opencv2/core/core.hpp> // Library to include for// drawing shapes#include <opencv2/highgui/highgui.hpp>#include <opencv2/imgproc.hpp>using namespace cv;using namespace std; // Driver Codeint main(int argc, char** argv){ // Create a blank image of size // (500 x 500) with white background // (B, G, R) : (255, 255, 255) Mat image(500, 500, CV_8UC3, Scalar(255, 255, 255)); // Check if the image is created // successfully. if (!image.data) { cout << \"Could not open or\" << \" find the image\" << endl; return 0; } // Writing over the Image Point org(30, 100); putText(image, \"Text On Image\", org, FONT_HERSHEY_SCRIPT_COMPLEX, 2.1, Scalar(0, 0, 255), 2, LINE_AA); // Show our image inside a window. imshow(\"Output\", image); waitKey(0); return 0;}",
"e": 1224,
"s": 273,
"text": null
},
{
"code": null,
"e": 1232,
"s": 1224,
"text": "Output:"
},
{
"code": null,
"e": 1243,
"s": 1232,
"text": "Program 2:"
},
{
"code": null,
"e": 1302,
"s": 1243,
"text": "Below program shows how to write text over a loaded image:"
},
{
"code": null,
"e": 1306,
"s": 1302,
"text": "C++"
},
{
"code": "// C++ program to demonstrate the// above approach#include <iostream>#include <opencv2/core/core.hpp> // Library to include for// drawing shapes#include <opencv2/highgui/highgui.hpp>#include <opencv2/imgproc.hpp>using namespace cv;using namespace std; // Driver Codeint main(int argc, char** argv){ // Create a blank image of size // (500 x 500) with white background // (B, G, R) : (255, 255, 255) Mat image = imread(\"C:/Users/harsh/Downloads/geeks.png\", IMREAD_COLOR); // Check if the image is // created successfully. if (!image.data) { cout << \"Could not open or\" << \" find the image\" << std::endl; return 0; } // Writing over the Image Point org(1, 30); putText(image, \"Geeks For Geeks\", org, FONT_HERSHEY_SCRIPT_COMPLEX, 1.0, Scalar(0, 255, 0), 2, LINE_AA); // Show our image inside a window. imshow(\"Output\", image); waitKey(0); return 0;}",
"e": 2278,
"s": 1306,
"text": null
},
{
"code": null,
"e": 2286,
"s": 2278,
"text": "Output:"
},
{
"code": null,
"e": 2293,
"s": 2286,
"text": "OpenCV"
},
{
"code": null,
"e": 2297,
"s": 2293,
"text": "C++"
},
{
"code": null,
"e": 2310,
"s": 2297,
"text": "C++ Programs"
},
{
"code": null,
"e": 2314,
"s": 2310,
"text": "CPP"
},
{
"code": null,
"e": 2412,
"s": 2314,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 2436,
"s": 2412,
"text": "Sorting a vector in C++"
},
{
"code": null,
"e": 2456,
"s": 2436,
"text": "Polymorphism in C++"
},
{
"code": null,
"e": 2500,
"s": 2456,
"text": "Pair in C++ Standard Template Library (STL)"
},
{
"code": null,
"e": 2533,
"s": 2500,
"text": "Friend class and function in C++"
},
{
"code": null,
"e": 2558,
"s": 2533,
"text": "std::string class in C++"
},
{
"code": null,
"e": 2593,
"s": 2558,
"text": "Header files in C/C++ and its uses"
},
{
"code": null,
"e": 2627,
"s": 2593,
"text": "Sorting a Map by value in C++ STL"
},
{
"code": null,
"e": 2671,
"s": 2627,
"text": "Program to print ASCII Value of a character"
},
{
"code": null,
"e": 2730,
"s": 2671,
"text": "How to return multiple values from a function in C or C++?"
}
] |
Minimum distance from a point to the line segment using Vectors | 03 May, 2022
Given the coordinates of two endpoints A(x1, y1), B(x2, y2) of the line segment and coordinates of a point E(x, y); the task is to find the minimum distance from the point to line segment formed with the given coordinates.Note that both the ends of a line can go to infinity i.e. a line has no ending points. On the other hand, a line segment has start and endpoints due to which length of the line segment is fixed.Examples:
Input: A = {0, 0}, B = {2, 0}, E = {4, 0}
Output: 2 To find the distance, dot product has to be found between vectors AB, BE and AB, AE. AB = (x2 – x1, y2 – y1) = (2 – 0, 0 – 0) = (2, 0) BE = (x – x2, y – y2) = (4 – 2, 0 – 0) = (2, 0) AE = (x – x1, y – y1) = (4 – 0, 0 – 0) = (4, 0) AB . BE = (ABx * BEx + ABy * BEy) = (2 * 2 + 0 * 0) = 4 AB . AE = (ABx * AEx + ABy * AEy) = (2 * 4 + 0 * 0) = 8 Therefore, nearest point from E to line segment is point B. Minimum Distance = BE =
= 2Input: A = {0, 0}, B = {2, 0}, E = {1, 1} Output: 1
Approach: The idea is to use the concept of vectors to solve the problem since the nearest point always lies on the line segment. Assuming that the direction of vector AB is A to B, there are three cases that arise:
1. The nearest point from the point E on the line segment AB is point B itself if the dot product of vector AB(A to B) and vector BE(B to E) is positive where E is the given point. Since AB . BE > 0, the given point lies in the same direction as the vector AB is and the nearest point must be B itself because the nearest point lies on the line segment.
2. The nearest point from the point E on the line segment AB is point A itself if the dot product of vector AB(A to B) and vector AE(A to E) is negative where E is the given point. Since AB . AE < 0, the given point lies in the opposite direction of the line segment AB and the nearest point must be A itself because the nearest point lies on the line segment.
3. Otherwise, if the dot product is 0, then the point E is perpendicular to the line segment AB and the perpendicular distance to the given point E from the line segment AB is the shortest distance. If some arbitrary point F is the point on the line segment which is perpendicular to E, then the perpendicular distance can be calculated as |EF| = |(AB X AE)/|AB||
Below is the implementation of the above approach:
C++
Java
Python3
C#
Javascript
// C++ implementation of the approach#include <bits/stdc++.h> // To store the point#define Point pair<double, double>#define F first#define S secondusing namespace std; // Function to return the minimum distance// between a line segment AB and a point Edouble minDistance(Point A, Point B, Point E){ // vector AB pair<double, double> AB; AB.F = B.F - A.F; AB.S = B.S - A.S; // vector BP pair<double, double> BE; BE.F = E.F - B.F; BE.S = E.S - B.S; // vector AP pair<double, double> AE; AE.F = E.F - A.F, AE.S = E.S - A.S; // Variables to store dot product double AB_BE, AB_AE; // Calculating the dot product AB_BE = (AB.F * BE.F + AB.S * BE.S); AB_AE = (AB.F * AE.F + AB.S * AE.S); // Minimum distance from // point E to the line segment double reqAns = 0; // Case 1 if (AB_BE > 0) { // Finding the magnitude double y = E.S - B.S; double x = E.F - B.F; reqAns = sqrt(x * x + y * y); } // Case 2 else if (AB_AE < 0) { double y = E.S - A.S; double x = E.F - A.F; reqAns = sqrt(x * x + y * y); } // Case 3 else { // Finding the perpendicular distance double x1 = AB.F; double y1 = AB.S; double x2 = AE.F; double y2 = AE.S; double mod = sqrt(x1 * x1 + y1 * y1); reqAns = abs(x1 * y2 - y1 * x2) / mod; } return reqAns;} // Driver codeint main(){ Point A = make_pair(0, 0); Point B = make_pair(2, 0); Point E = make_pair(1, 1); cout << minDistance(A, B, E); return 0;}
// Java implementation of the approachclass GFG{ static class pair{ double F, S; public pair(double F, double S) { this.F = F; this.S = S; } public pair() { }} // Function to return the minimum distance// between a line segment AB and a point Estatic double minDistance(pair A, pair B, pair E){ // vector AB pair AB = new pair(); AB.F = B.F - A.F; AB.S = B.S - A.S; // vector BP pair BE = new pair(); BE.F = E.F - B.F; BE.S = E.S - B.S; // vector AP pair AE = new pair(); AE.F = E.F - A.F; AE.S = E.S - A.S; // Variables to store dot product double AB_BE, AB_AE; // Calculating the dot product AB_BE = (AB.F * BE.F + AB.S * BE.S); AB_AE = (AB.F * AE.F + AB.S * AE.S); // Minimum distance from // point E to the line segment double reqAns = 0; // Case 1 if (AB_BE > 0) { // Finding the magnitude double y = E.S - B.S; double x = E.F - B.F; reqAns = Math.sqrt(x * x + y * y); } // Case 2 else if (AB_AE < 0) { double y = E.S - A.S; double x = E.F - A.F; reqAns = Math.sqrt(x * x + y * y); } // Case 3 else { // Finding the perpendicular distance double x1 = AB.F; double y1 = AB.S; double x2 = AE.F; double y2 = AE.S; double mod = Math.sqrt(x1 * x1 + y1 * y1); reqAns = Math.abs(x1 * y2 - y1 * x2) / mod; } return reqAns;} // Driver codepublic static void main(String[] args){ pair A = new pair(0, 0); pair B = new pair(2, 0); pair E = new pair(1, 1); System.out.print((int)minDistance(A, B, E));}} // This code is contributed by 29AjayKumar
# Python3 implementation of the approachfrom math import sqrt # Function to return the minimum distance# between a line segment AB and a point Edef minDistance(A, B, E) : # vector AB AB = [None, None]; AB[0] = B[0] - A[0]; AB[1] = B[1] - A[1]; # vector BP BE = [None, None]; BE[0] = E[0] - B[0]; BE[1] = E[1] - B[1]; # vector AP AE = [None, None]; AE[0] = E[0] - A[0]; AE[1] = E[1] - A[1]; # Variables to store dot product # Calculating the dot product AB_BE = AB[0] * BE[0] + AB[1] * BE[1]; AB_AE = AB[0] * AE[0] + AB[1] * AE[1]; # Minimum distance from # point E to the line segment reqAns = 0; # Case 1 if (AB_BE > 0) : # Finding the magnitude y = E[1] - B[1]; x = E[0] - B[0]; reqAns = sqrt(x * x + y * y); # Case 2 elif (AB_AE < 0) : y = E[1] - A[1]; x = E[0] - A[0]; reqAns = sqrt(x * x + y * y); # Case 3 else: # Finding the perpendicular distance x1 = AB[0]; y1 = AB[1]; x2 = AE[0]; y2 = AE[1]; mod = sqrt(x1 * x1 + y1 * y1); reqAns = abs(x1 * y2 - y1 * x2) / mod; return reqAns; # Driver codeif __name__ == "__main__" : A = [0, 0]; B = [2, 0]; E = [1, 1]; print(minDistance(A, B, E)); # This code is contributed by AnkitRai01
// C# implementation of the approachusing System; class GFG{ class pair{ public double F, S; public pair(double F, double S) { this.F = F; this.S = S; } public pair() { }} // Function to return the minimum distance// between a line segment AB and a point Estatic double minDistance(pair A, pair B, pair E){ // vector AB pair AB = new pair(); AB.F = B.F - A.F; AB.S = B.S - A.S; // vector BP pair BE = new pair(); BE.F = E.F - B.F; BE.S = E.S - B.S; // vector AP pair AE = new pair(); AE.F = E.F - A.F; AE.S = E.S - A.S; // Variables to store dot product double AB_BE, AB_AE; // Calculating the dot product AB_BE = (AB.F * BE.F + AB.S * BE.S); AB_AE = (AB.F * AE.F + AB.S * AE.S); // Minimum distance from // point E to the line segment double reqAns = 0; // Case 1 if (AB_BE > 0) { // Finding the magnitude double y = E.S - B.S; double x = E.F - B.F; reqAns = Math.Sqrt(x * x + y * y); } // Case 2 else if (AB_AE < 0) { double y = E.S - A.S; double x = E.F - A.F; reqAns = Math.Sqrt(x * x + y * y); } // Case 3 else { // Finding the perpendicular distance double x1 = AB.F; double y1 = AB.S; double x2 = AE.F; double y2 = AE.S; double mod = Math.Sqrt(x1 * x1 + y1 * y1); reqAns = Math.Abs(x1 * y2 - y1 * x2) / mod; } return reqAns;} // Driver codepublic static void Main(String[] args){ pair A = new pair(0, 0); pair B = new pair(2, 0); pair E = new pair(1, 1); Console.Write((int)minDistance(A, B, E));}} // This code is contributed by 29AjayKumar
<script> // JavaScript implementation of the approach // Function to return the minimum distance// between a line segment AB and a point Efunction minDistance( A, B, E){ // vector AB var AB=[]; AB.push (B[0] - A[0]); AB.push(B[1] - A[1]); // vector BP var BE=[]; BE.push(E[0] - B[0]); BE.push(E[1] - B[1]); // vector AP var AE=[]; AE.push(E[0] - A[0]), AE.push(E[1] - A[1]); // Variables to store dot product var AB_BE, AB_AE; // Calculating the dot product AB_BE=(AB[0] * BE[0] + AB[1] * BE[1]); AB_AE=(AB[0] * AE[0] + AB[1] * AE[1]); // Minimum distance from // point E to the line segment var reqAns = 0; // Case 1 if (AB_BE > 0) { // Finding the magnitude var y = E[1] - B[1]; var x = E[0] - B[0]; reqAns = Math.sqrt(x * x + y * y); } // Case 2 else if (AB_AE < 0) { var y = E[1] - A[1]; var x = E[0] - A[0]; reqAns = Math.sqrt(x * x + y * y); } // Case 3 else { // Finding the perpendicular distance var x1 = AB[0]; var y1 = AB[1]; var x2 = AE[0]; var y2 = AE[1]; var mod = Math.sqrt(x1 * x1 + y1 * y1); reqAns = Math.abs(x1 * y2 - y1 * x2) / mod; } return reqAns;} var A =[0, 0]; var B = [2, 0]; var E = [1, 1]; document.write( minDistance(A, B, E)); </script>
1
Time Complexity: O(1 )
Auxiliary Space: O(1)
ankthon
29AjayKumar
ujjwalgoel1103
akshitsaxenaa09
mircea98ro
dongliangpeng
Geometric-Lines
Technical Scripter 2019
Mathematical
School Programming
Technical Scripter
Mathematical
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here. | [
{
"code": null,
"e": 52,
"s": 24,
"text": "\n03 May, 2022"
},
{
"code": null,
"e": 479,
"s": 52,
"text": "Given the coordinates of two endpoints A(x1, y1), B(x2, y2) of the line segment and coordinates of a point E(x, y); the task is to find the minimum distance from the point to line segment formed with the given coordinates.Note that both the ends of a line can go to infinity i.e. a line has no ending points. On the other hand, a line segment has start and endpoints due to which length of the line segment is fixed.Examples: "
},
{
"code": null,
"e": 522,
"s": 479,
"text": "Input: A = {0, 0}, B = {2, 0}, E = {4, 0} "
},
{
"code": null,
"e": 960,
"s": 522,
"text": "Output: 2 To find the distance, dot product has to be found between vectors AB, BE and AB, AE. AB = (x2 – x1, y2 – y1) = (2 – 0, 0 – 0) = (2, 0) BE = (x – x2, y – y2) = (4 – 2, 0 – 0) = (2, 0) AE = (x – x1, y – y1) = (4 – 0, 0 – 0) = (4, 0) AB . BE = (ABx * BEx + ABy * BEy) = (2 * 2 + 0 * 0) = 4 AB . AE = (ABx * AEx + ABy * AEy) = (2 * 4 + 0 * 0) = 8 Therefore, nearest point from E to line segment is point B. Minimum Distance = BE = "
},
{
"code": null,
"e": 1016,
"s": 960,
"text": "= 2Input: A = {0, 0}, B = {2, 0}, E = {1, 1} Output: 1 "
},
{
"code": null,
"e": 1234,
"s": 1016,
"text": "Approach: The idea is to use the concept of vectors to solve the problem since the nearest point always lies on the line segment. Assuming that the direction of vector AB is A to B, there are three cases that arise: "
},
{
"code": null,
"e": 1590,
"s": 1234,
"text": "1. The nearest point from the point E on the line segment AB is point B itself if the dot product of vector AB(A to B) and vector BE(B to E) is positive where E is the given point. Since AB . BE > 0, the given point lies in the same direction as the vector AB is and the nearest point must be B itself because the nearest point lies on the line segment. "
},
{
"code": null,
"e": 1953,
"s": 1590,
"text": "2. The nearest point from the point E on the line segment AB is point A itself if the dot product of vector AB(A to B) and vector AE(A to E) is negative where E is the given point. Since AB . AE < 0, the given point lies in the opposite direction of the line segment AB and the nearest point must be A itself because the nearest point lies on the line segment. "
},
{
"code": null,
"e": 2319,
"s": 1953,
"text": "3. Otherwise, if the dot product is 0, then the point E is perpendicular to the line segment AB and the perpendicular distance to the given point E from the line segment AB is the shortest distance. If some arbitrary point F is the point on the line segment which is perpendicular to E, then the perpendicular distance can be calculated as |EF| = |(AB X AE)/|AB|| "
},
{
"code": null,
"e": 2371,
"s": 2319,
"text": "Below is the implementation of the above approach: "
},
{
"code": null,
"e": 2375,
"s": 2371,
"text": "C++"
},
{
"code": null,
"e": 2380,
"s": 2375,
"text": "Java"
},
{
"code": null,
"e": 2388,
"s": 2380,
"text": "Python3"
},
{
"code": null,
"e": 2391,
"s": 2388,
"text": "C#"
},
{
"code": null,
"e": 2402,
"s": 2391,
"text": "Javascript"
},
{
"code": "// C++ implementation of the approach#include <bits/stdc++.h> // To store the point#define Point pair<double, double>#define F first#define S secondusing namespace std; // Function to return the minimum distance// between a line segment AB and a point Edouble minDistance(Point A, Point B, Point E){ // vector AB pair<double, double> AB; AB.F = B.F - A.F; AB.S = B.S - A.S; // vector BP pair<double, double> BE; BE.F = E.F - B.F; BE.S = E.S - B.S; // vector AP pair<double, double> AE; AE.F = E.F - A.F, AE.S = E.S - A.S; // Variables to store dot product double AB_BE, AB_AE; // Calculating the dot product AB_BE = (AB.F * BE.F + AB.S * BE.S); AB_AE = (AB.F * AE.F + AB.S * AE.S); // Minimum distance from // point E to the line segment double reqAns = 0; // Case 1 if (AB_BE > 0) { // Finding the magnitude double y = E.S - B.S; double x = E.F - B.F; reqAns = sqrt(x * x + y * y); } // Case 2 else if (AB_AE < 0) { double y = E.S - A.S; double x = E.F - A.F; reqAns = sqrt(x * x + y * y); } // Case 3 else { // Finding the perpendicular distance double x1 = AB.F; double y1 = AB.S; double x2 = AE.F; double y2 = AE.S; double mod = sqrt(x1 * x1 + y1 * y1); reqAns = abs(x1 * y2 - y1 * x2) / mod; } return reqAns;} // Driver codeint main(){ Point A = make_pair(0, 0); Point B = make_pair(2, 0); Point E = make_pair(1, 1); cout << minDistance(A, B, E); return 0;}",
"e": 3981,
"s": 2402,
"text": null
},
{
"code": "// Java implementation of the approachclass GFG{ static class pair{ double F, S; public pair(double F, double S) { this.F = F; this.S = S; } public pair() { }} // Function to return the minimum distance// between a line segment AB and a point Estatic double minDistance(pair A, pair B, pair E){ // vector AB pair AB = new pair(); AB.F = B.F - A.F; AB.S = B.S - A.S; // vector BP pair BE = new pair(); BE.F = E.F - B.F; BE.S = E.S - B.S; // vector AP pair AE = new pair(); AE.F = E.F - A.F; AE.S = E.S - A.S; // Variables to store dot product double AB_BE, AB_AE; // Calculating the dot product AB_BE = (AB.F * BE.F + AB.S * BE.S); AB_AE = (AB.F * AE.F + AB.S * AE.S); // Minimum distance from // point E to the line segment double reqAns = 0; // Case 1 if (AB_BE > 0) { // Finding the magnitude double y = E.S - B.S; double x = E.F - B.F; reqAns = Math.sqrt(x * x + y * y); } // Case 2 else if (AB_AE < 0) { double y = E.S - A.S; double x = E.F - A.F; reqAns = Math.sqrt(x * x + y * y); } // Case 3 else { // Finding the perpendicular distance double x1 = AB.F; double y1 = AB.S; double x2 = AE.F; double y2 = AE.S; double mod = Math.sqrt(x1 * x1 + y1 * y1); reqAns = Math.abs(x1 * y2 - y1 * x2) / mod; } return reqAns;} // Driver codepublic static void main(String[] args){ pair A = new pair(0, 0); pair B = new pair(2, 0); pair E = new pair(1, 1); System.out.print((int)minDistance(A, B, E));}} // This code is contributed by 29AjayKumar",
"e": 5674,
"s": 3981,
"text": null
},
{
"code": "# Python3 implementation of the approachfrom math import sqrt # Function to return the minimum distance# between a line segment AB and a point Edef minDistance(A, B, E) : # vector AB AB = [None, None]; AB[0] = B[0] - A[0]; AB[1] = B[1] - A[1]; # vector BP BE = [None, None]; BE[0] = E[0] - B[0]; BE[1] = E[1] - B[1]; # vector AP AE = [None, None]; AE[0] = E[0] - A[0]; AE[1] = E[1] - A[1]; # Variables to store dot product # Calculating the dot product AB_BE = AB[0] * BE[0] + AB[1] * BE[1]; AB_AE = AB[0] * AE[0] + AB[1] * AE[1]; # Minimum distance from # point E to the line segment reqAns = 0; # Case 1 if (AB_BE > 0) : # Finding the magnitude y = E[1] - B[1]; x = E[0] - B[0]; reqAns = sqrt(x * x + y * y); # Case 2 elif (AB_AE < 0) : y = E[1] - A[1]; x = E[0] - A[0]; reqAns = sqrt(x * x + y * y); # Case 3 else: # Finding the perpendicular distance x1 = AB[0]; y1 = AB[1]; x2 = AE[0]; y2 = AE[1]; mod = sqrt(x1 * x1 + y1 * y1); reqAns = abs(x1 * y2 - y1 * x2) / mod; return reqAns; # Driver codeif __name__ == \"__main__\" : A = [0, 0]; B = [2, 0]; E = [1, 1]; print(minDistance(A, B, E)); # This code is contributed by AnkitRai01",
"e": 7015,
"s": 5674,
"text": null
},
{
"code": "// C# implementation of the approachusing System; class GFG{ class pair{ public double F, S; public pair(double F, double S) { this.F = F; this.S = S; } public pair() { }} // Function to return the minimum distance// between a line segment AB and a point Estatic double minDistance(pair A, pair B, pair E){ // vector AB pair AB = new pair(); AB.F = B.F - A.F; AB.S = B.S - A.S; // vector BP pair BE = new pair(); BE.F = E.F - B.F; BE.S = E.S - B.S; // vector AP pair AE = new pair(); AE.F = E.F - A.F; AE.S = E.S - A.S; // Variables to store dot product double AB_BE, AB_AE; // Calculating the dot product AB_BE = (AB.F * BE.F + AB.S * BE.S); AB_AE = (AB.F * AE.F + AB.S * AE.S); // Minimum distance from // point E to the line segment double reqAns = 0; // Case 1 if (AB_BE > 0) { // Finding the magnitude double y = E.S - B.S; double x = E.F - B.F; reqAns = Math.Sqrt(x * x + y * y); } // Case 2 else if (AB_AE < 0) { double y = E.S - A.S; double x = E.F - A.F; reqAns = Math.Sqrt(x * x + y * y); } // Case 3 else { // Finding the perpendicular distance double x1 = AB.F; double y1 = AB.S; double x2 = AE.F; double y2 = AE.S; double mod = Math.Sqrt(x1 * x1 + y1 * y1); reqAns = Math.Abs(x1 * y2 - y1 * x2) / mod; } return reqAns;} // Driver codepublic static void Main(String[] args){ pair A = new pair(0, 0); pair B = new pair(2, 0); pair E = new pair(1, 1); Console.Write((int)minDistance(A, B, E));}} // This code is contributed by 29AjayKumar",
"e": 8717,
"s": 7015,
"text": null
},
{
"code": "<script> // JavaScript implementation of the approach // Function to return the minimum distance// between a line segment AB and a point Efunction minDistance( A, B, E){ // vector AB var AB=[]; AB.push (B[0] - A[0]); AB.push(B[1] - A[1]); // vector BP var BE=[]; BE.push(E[0] - B[0]); BE.push(E[1] - B[1]); // vector AP var AE=[]; AE.push(E[0] - A[0]), AE.push(E[1] - A[1]); // Variables to store dot product var AB_BE, AB_AE; // Calculating the dot product AB_BE=(AB[0] * BE[0] + AB[1] * BE[1]); AB_AE=(AB[0] * AE[0] + AB[1] * AE[1]); // Minimum distance from // point E to the line segment var reqAns = 0; // Case 1 if (AB_BE > 0) { // Finding the magnitude var y = E[1] - B[1]; var x = E[0] - B[0]; reqAns = Math.sqrt(x * x + y * y); } // Case 2 else if (AB_AE < 0) { var y = E[1] - A[1]; var x = E[0] - A[0]; reqAns = Math.sqrt(x * x + y * y); } // Case 3 else { // Finding the perpendicular distance var x1 = AB[0]; var y1 = AB[1]; var x2 = AE[0]; var y2 = AE[1]; var mod = Math.sqrt(x1 * x1 + y1 * y1); reqAns = Math.abs(x1 * y2 - y1 * x2) / mod; } return reqAns;} var A =[0, 0]; var B = [2, 0]; var E = [1, 1]; document.write( minDistance(A, B, E)); </script>",
"e": 10094,
"s": 8717,
"text": null
},
{
"code": null,
"e": 10096,
"s": 10094,
"text": "1"
},
{
"code": null,
"e": 10121,
"s": 10098,
"text": "Time Complexity: O(1 )"
},
{
"code": null,
"e": 10143,
"s": 10121,
"text": "Auxiliary Space: O(1)"
},
{
"code": null,
"e": 10151,
"s": 10143,
"text": "ankthon"
},
{
"code": null,
"e": 10163,
"s": 10151,
"text": "29AjayKumar"
},
{
"code": null,
"e": 10178,
"s": 10163,
"text": "ujjwalgoel1103"
},
{
"code": null,
"e": 10194,
"s": 10178,
"text": "akshitsaxenaa09"
},
{
"code": null,
"e": 10205,
"s": 10194,
"text": "mircea98ro"
},
{
"code": null,
"e": 10219,
"s": 10205,
"text": "dongliangpeng"
},
{
"code": null,
"e": 10235,
"s": 10219,
"text": "Geometric-Lines"
},
{
"code": null,
"e": 10259,
"s": 10235,
"text": "Technical Scripter 2019"
},
{
"code": null,
"e": 10272,
"s": 10259,
"text": "Mathematical"
},
{
"code": null,
"e": 10291,
"s": 10272,
"text": "School Programming"
},
{
"code": null,
"e": 10310,
"s": 10291,
"text": "Technical Scripter"
},
{
"code": null,
"e": 10323,
"s": 10310,
"text": "Mathematical"
}
] |
How to read a XLSX file with multiple Sheets in R? | 06 Jun, 2021
In this article, we are going to see how to read an XLSX file with multiple Sheets in R Language. There are various external packages in R used to read XLSX files with multiple sheets.
File Used:
Method 1: Using readxl package
The readxl package in R is used to import and read Excel workbooks in R, which can be used to easily work and modify the .xslsx sheets. It can be installed and loaded into the R working space using the following syntax :
install.packages("readxl")
Initially, the excel_sheets() method is invoked to fetch all the worksheet names contained in the Excel workbook, with the specified file path.
excel_sheets(path)
The lapply() method in R is used to apply a function (either user-defined or pre-defined) to a set of components contained within an R list or data frame. The lapply( ) method returns an object of the same length as that of the input object.
Syntax: lapply( obj , FUN)
Arguments:
obj – The object to apply the function on
FUN – The function to be applied over different components of the object obj.
The FUN is the read_excel method of this package store, which is used to read the contents of the specified sheet name into a tibble, which is a tabular-like structure used to store data in fixed rows and columns. The lapply method applies the read_excel method over every sheet of the workbook.
Syntax: read_excel(path, sheet)
Arguments:
path – The file path
sheet – The sheet name to read
The tibble objects returned by the read_excel method can be converted to the data frame again using the lapply method and specifying the function as.data.frame() which converts every object into a data frame. These data frames can be assigned the corresponding sheet names for better clarity using the in-built R names() method.
names (df) <- new-name
Code:
R
# importing required packageslibrary(readxl) multiplesheets <- function(fname) { # getting info about all excel sheets sheets <- readxl::excel_sheets(fname) tibble <- lapply(sheets, function(x) readxl::read_excel(fname, sheet = x)) data_frame <- lapply(tibble, as.data.frame) # assigning names to data frames names(data_frame) <- sheets # print data frame print(data_frame)} # specifying the path namepath <- "/Users/mallikagupta/Desktop/Gfg.xlsx"multiplesheets(path)
Output:
$Sheet1
ID Name Job
1 1 A Engineer
2 2 B CA
3 3 C SDE
4 4 D CA
5 5 E SDE
$Sheet2
Post Likes
1 A 23
2 B 34
3 C 56
4 D 78
Method 2: Using rio package.
The rio package is used to stimulate quick and easy data import and export operations to be performed in R. Rio makes deductions about the file format itself which can be used to read files easily.
install.packages("rio")
The import() and export() methods in R determine the data structure of the specified file extension. The method import_list() imports a list of data frames from a multi-object file, for instance, an Excel workbook or an R zipped file.
Syntax: import_list(file)
Arguments :
file – The file name of the Excel workbook to access
The column and row names are retained while reading the output of the Excel workbook. The sheet names are also accessible during the read.
R
# specifying the path namepath <- "/Users/mallikagupta/Desktop/Gfg.xlsx" # importing the required librarylibrary(rio) # reading data from all sheetsdata <- import_list(path) # print dataprint (data)
Output:
$Sheet1
ID Name Job
1 1 A Engineer
2 2 B CA
3 3 C SDE
4 4 D CA
5 5 E SDE
$Sheet2
Post Likes
1 A 23
2 B 34
3 C 56
4 D 78
Method 3: Using openxlsx Package.
The openxlsx package in R is used to create and manipulate Excel files by providing a high-level interface for reading and writing as well as modifying the worksheets in the specified workbook. The package can be loaded and installed into the working space using the following syntax :
install.packages("openxlsx")
The getSheetNames( ) method of this package is used to return the worksheet names contained within an xlsx file.
getSheetNames(file)
The lapply() method in R is used to apply a function (either user-defined or pre-defined) to a set of components contained within an R list or data frame. The lapply( ) method returns an object of the same length as that of the input object.
Syntax: lapply( obj , FUN)
Arguments:
obj – The object to apply the function on
FUN – The function to be applied over different components of the object obj.
After the retrieval of different sheet names using the previous method, the function read.xlsx is applied over each of the sheets of the workbook. The read.xlsx method is used to read data from an Excel file or Workbook object into an R data.frame object over the specified file path.
In this case, the lapply() method takes as input the sheet names and returns the corresponding data frames belonging to each sheet of the workbook. Then these data frames are assigned the sheet names using the names() method in R.
Code:
R
# specifying the path namepath <- "/Users/mallikagupta/Desktop/Gfg.xlsx" # importing the required librarylibrary(openxlsx) # getting data from sheetssheets <- openxlsx::getSheetNames(path)data_frame <- lapply(sheets, openxlsx::read.xlsx, xlsxFile=path) # assigning names to data framenames(data_frame) <- sheets # printing the dataprint (data_frame)
Output:
$Sheet1
ID Name Job
1 1 A Engineer
2 2 B CA
3 3 C SDE
4 4 D CA
5 5 E SDE
$Sheet2
Post Likes
1 A 23
2 B 34
3 C 56
4 D 78
Picked
R-Excel
R Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Filter data by multiple conditions in R using Dplyr
How to Replace specific values in column in R DataFrame ?
Change Color of Bars in Barchart using ggplot2 in R
Loops in R (for, while, repeat)
How to Split Column Into Multiple Columns in R DataFrame?
Printing Output of an R Program
Group by function in R using Dplyr
How to change Row Names of DataFrame in R ?
How to Change Axis Scales in R Plots?
How to filter R DataFrame by values in a column? | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n06 Jun, 2021"
},
{
"code": null,
"e": 213,
"s": 28,
"text": "In this article, we are going to see how to read an XLSX file with multiple Sheets in R Language. There are various external packages in R used to read XLSX files with multiple sheets."
},
{
"code": null,
"e": 224,
"s": 213,
"text": "File Used:"
},
{
"code": null,
"e": 255,
"s": 224,
"text": "Method 1: Using readxl package"
},
{
"code": null,
"e": 478,
"s": 255,
"text": "The readxl package in R is used to import and read Excel workbooks in R, which can be used to easily work and modify the .xslsx sheets. It can be installed and loaded into the R working space using the following syntax : "
},
{
"code": null,
"e": 505,
"s": 478,
"text": "install.packages(\"readxl\")"
},
{
"code": null,
"e": 650,
"s": 505,
"text": "Initially, the excel_sheets() method is invoked to fetch all the worksheet names contained in the Excel workbook, with the specified file path. "
},
{
"code": null,
"e": 669,
"s": 650,
"text": "excel_sheets(path)"
},
{
"code": null,
"e": 912,
"s": 669,
"text": "The lapply() method in R is used to apply a function (either user-defined or pre-defined) to a set of components contained within an R list or data frame. The lapply( ) method returns an object of the same length as that of the input object. "
},
{
"code": null,
"e": 939,
"s": 912,
"text": "Syntax: lapply( obj , FUN)"
},
{
"code": null,
"e": 950,
"s": 939,
"text": "Arguments:"
},
{
"code": null,
"e": 993,
"s": 950,
"text": "obj – The object to apply the function on "
},
{
"code": null,
"e": 1073,
"s": 993,
"text": "FUN – The function to be applied over different components of the object obj. "
},
{
"code": null,
"e": 1370,
"s": 1073,
"text": "The FUN is the read_excel method of this package store, which is used to read the contents of the specified sheet name into a tibble, which is a tabular-like structure used to store data in fixed rows and columns. The lapply method applies the read_excel method over every sheet of the workbook. "
},
{
"code": null,
"e": 1402,
"s": 1370,
"text": "Syntax: read_excel(path, sheet)"
},
{
"code": null,
"e": 1413,
"s": 1402,
"text": "Arguments:"
},
{
"code": null,
"e": 1434,
"s": 1413,
"text": "path – The file path"
},
{
"code": null,
"e": 1465,
"s": 1434,
"text": "sheet – The sheet name to read"
},
{
"code": null,
"e": 1795,
"s": 1465,
"text": "The tibble objects returned by the read_excel method can be converted to the data frame again using the lapply method and specifying the function as.data.frame() which converts every object into a data frame. These data frames can be assigned the corresponding sheet names for better clarity using the in-built R names() method. "
},
{
"code": null,
"e": 1818,
"s": 1795,
"text": "names (df) <- new-name"
},
{
"code": null,
"e": 1824,
"s": 1818,
"text": "Code:"
},
{
"code": null,
"e": 1826,
"s": 1824,
"text": "R"
},
{
"code": "# importing required packageslibrary(readxl) multiplesheets <- function(fname) { # getting info about all excel sheets sheets <- readxl::excel_sheets(fname) tibble <- lapply(sheets, function(x) readxl::read_excel(fname, sheet = x)) data_frame <- lapply(tibble, as.data.frame) # assigning names to data frames names(data_frame) <- sheets # print data frame print(data_frame)} # specifying the path namepath <- \"/Users/mallikagupta/Desktop/Gfg.xlsx\"multiplesheets(path)",
"e": 2317,
"s": 1826,
"text": null
},
{
"code": null,
"e": 2325,
"s": 2317,
"text": "Output:"
},
{
"code": null,
"e": 2530,
"s": 2325,
"text": "$Sheet1\nID Name Job \n1 1 A Engineer \n2 2 B CA \n3 3 C SDE \n4 4 D CA \n5 5 E SDE \n$Sheet2 \nPost Likes \n1 A 23 \n2 B 34 \n3 C 56 \n4 D 78"
},
{
"code": null,
"e": 2559,
"s": 2530,
"text": "Method 2: Using rio package."
},
{
"code": null,
"e": 2758,
"s": 2559,
"text": "The rio package is used to stimulate quick and easy data import and export operations to be performed in R. Rio makes deductions about the file format itself which can be used to read files easily. "
},
{
"code": null,
"e": 2782,
"s": 2758,
"text": "install.packages(\"rio\")"
},
{
"code": null,
"e": 3018,
"s": 2782,
"text": "The import() and export() methods in R determine the data structure of the specified file extension. The method import_list() imports a list of data frames from a multi-object file, for instance, an Excel workbook or an R zipped file. "
},
{
"code": null,
"e": 3044,
"s": 3018,
"text": "Syntax: import_list(file)"
},
{
"code": null,
"e": 3057,
"s": 3044,
"text": "Arguments : "
},
{
"code": null,
"e": 3110,
"s": 3057,
"text": "file – The file name of the Excel workbook to access"
},
{
"code": null,
"e": 3251,
"s": 3110,
"text": "The column and row names are retained while reading the output of the Excel workbook. The sheet names are also accessible during the read. "
},
{
"code": null,
"e": 3253,
"s": 3251,
"text": "R"
},
{
"code": "# specifying the path namepath <- \"/Users/mallikagupta/Desktop/Gfg.xlsx\" # importing the required librarylibrary(rio) # reading data from all sheetsdata <- import_list(path) # print dataprint (data)",
"e": 3455,
"s": 3253,
"text": null
},
{
"code": null,
"e": 3463,
"s": 3455,
"text": "Output:"
},
{
"code": null,
"e": 3668,
"s": 3463,
"text": "$Sheet1\nID Name Job \n1 1 A Engineer \n2 2 B CA \n3 3 C SDE \n4 4 D CA \n5 5 E SDE \n$Sheet2 \nPost Likes \n1 A 23 \n2 B 34 \n3 C 56 \n4 D 78"
},
{
"code": null,
"e": 3702,
"s": 3668,
"text": "Method 3: Using openxlsx Package."
},
{
"code": null,
"e": 3989,
"s": 3702,
"text": "The openxlsx package in R is used to create and manipulate Excel files by providing a high-level interface for reading and writing as well as modifying the worksheets in the specified workbook. The package can be loaded and installed into the working space using the following syntax : "
},
{
"code": null,
"e": 4018,
"s": 3989,
"text": "install.packages(\"openxlsx\")"
},
{
"code": null,
"e": 4131,
"s": 4018,
"text": "The getSheetNames( ) method of this package is used to return the worksheet names contained within an xlsx file."
},
{
"code": null,
"e": 4151,
"s": 4131,
"text": "getSheetNames(file)"
},
{
"code": null,
"e": 4394,
"s": 4151,
"text": "The lapply() method in R is used to apply a function (either user-defined or pre-defined) to a set of components contained within an R list or data frame. The lapply( ) method returns an object of the same length as that of the input object. "
},
{
"code": null,
"e": 4421,
"s": 4394,
"text": "Syntax: lapply( obj , FUN)"
},
{
"code": null,
"e": 4432,
"s": 4421,
"text": "Arguments:"
},
{
"code": null,
"e": 4475,
"s": 4432,
"text": "obj – The object to apply the function on "
},
{
"code": null,
"e": 4554,
"s": 4475,
"text": "FUN – The function to be applied over different components of the object obj. "
},
{
"code": null,
"e": 4840,
"s": 4554,
"text": "After the retrieval of different sheet names using the previous method, the function read.xlsx is applied over each of the sheets of the workbook. The read.xlsx method is used to read data from an Excel file or Workbook object into an R data.frame object over the specified file path. "
},
{
"code": null,
"e": 5072,
"s": 4840,
"text": "In this case, the lapply() method takes as input the sheet names and returns the corresponding data frames belonging to each sheet of the workbook. Then these data frames are assigned the sheet names using the names() method in R."
},
{
"code": null,
"e": 5078,
"s": 5072,
"text": "Code:"
},
{
"code": null,
"e": 5080,
"s": 5078,
"text": "R"
},
{
"code": "# specifying the path namepath <- \"/Users/mallikagupta/Desktop/Gfg.xlsx\" # importing the required librarylibrary(openxlsx) # getting data from sheetssheets <- openxlsx::getSheetNames(path)data_frame <- lapply(sheets, openxlsx::read.xlsx, xlsxFile=path) # assigning names to data framenames(data_frame) <- sheets # printing the dataprint (data_frame)",
"e": 5434,
"s": 5080,
"text": null
},
{
"code": null,
"e": 5442,
"s": 5434,
"text": "Output:"
},
{
"code": null,
"e": 5647,
"s": 5442,
"text": "$Sheet1\nID Name Job \n1 1 A Engineer \n2 2 B CA \n3 3 C SDE \n4 4 D CA \n5 5 E SDE \n$Sheet2 \nPost Likes \n1 A 23 \n2 B 34 \n3 C 56 \n4 D 78"
},
{
"code": null,
"e": 5654,
"s": 5647,
"text": "Picked"
},
{
"code": null,
"e": 5662,
"s": 5654,
"text": "R-Excel"
},
{
"code": null,
"e": 5673,
"s": 5662,
"text": "R Language"
},
{
"code": null,
"e": 5771,
"s": 5673,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 5823,
"s": 5771,
"text": "Filter data by multiple conditions in R using Dplyr"
},
{
"code": null,
"e": 5881,
"s": 5823,
"text": "How to Replace specific values in column in R DataFrame ?"
},
{
"code": null,
"e": 5933,
"s": 5881,
"text": "Change Color of Bars in Barchart using ggplot2 in R"
},
{
"code": null,
"e": 5965,
"s": 5933,
"text": "Loops in R (for, while, repeat)"
},
{
"code": null,
"e": 6023,
"s": 5965,
"text": "How to Split Column Into Multiple Columns in R DataFrame?"
},
{
"code": null,
"e": 6055,
"s": 6023,
"text": "Printing Output of an R Program"
},
{
"code": null,
"e": 6090,
"s": 6055,
"text": "Group by function in R using Dplyr"
},
{
"code": null,
"e": 6134,
"s": 6090,
"text": "How to change Row Names of DataFrame in R ?"
},
{
"code": null,
"e": 6172,
"s": 6134,
"text": "How to Change Axis Scales in R Plots?"
}
] |
Program to find the Interior and Exterior Angle of a Regular Polygon - GeeksforGeeks | 19 Mar, 2021
Given the number of sides n of a regular polygon. The task is to find out the Interior angle and Exterior angle of the polygon.Examples:
Input : n = 6
Output : Interior angle: 120
Exterior angle: 60
Input : n = 10
Output: Interior angle: 144
Exterior angle: 36
Interior angle: The angle between two adjacent sides inside the polygon is known as the Interior angle. Formula to find the Interior angle:Interior Angle = Exterior angle: The angle formed by any side of a polygon and the extension of its adjacent side is known as Exterior angle.Exterior angle =
Program to find interior and exterior angles of a Regular Polygon:
C++
Java
Python3
C#
PHP
Javascript
// CPP program to find the interior and// exterior angle of a given polygon#include <iostream>using namespace std; // function to find the interior and// exterior anglevoid findAngle(int n){ int interiorAngle, exteriorAngle; // formula to find the interior angle interiorAngle = (n - 2) * 180 / n; // formula to find the exterior angle exteriorAngle = 360 / n; // Displaying the output cout << "Interior angle: " << interiorAngle << endl; cout << "Exterior angle: " << exteriorAngle;} // Driver codeint main(){ int n = 10; // Function calling findAngle(n); return 0;}
// Java program to find the interior and// exterior angle of a given polygonimport java.io.*; class GFG { // function to find the interior and // exterior angle static void findAngle(int n) { int interiorAngle, exteriorAngle; // formula to find the interior angle interiorAngle = (n - 2) * 180 / n; // formula to find the exterior angle exteriorAngle = 360 / n; // Displaying the output System.out.println("Interior angle: " + interiorAngle); System.out.println("Exterior angle: " + exteriorAngle); } // Driver code public static void main (String[] args) { int n = 10; // Function calling findAngle(n); }}
# Python3 program to find# the interior and exterior# angle of a given polygon # function to find# the interior and# exterior angledef findAngle(n): # formula to find the # interior angle interiorAngle = int((n - 2) * 180 / n) # formula to find # the exterior angle exteriorAngle = int(360 / n) # Displaying the output print("Interior angle: " , interiorAngle ) print("Exterior angle: " , exteriorAngle ) # Driver coden = 10 # Function callingfindAngle(n) # This code is contributed# by Smitha
// C# program to find the// interior and exterior// angle of a given polygonusing System; class GFG{ // function to find // the interior and // exterior angle static void findAngle(int n) { int interiorAngle, exteriorAngle; // formula to find // the interior angle interiorAngle = (n - 2) * 180 / n; // formula to find // the exterior angle exteriorAngle = 360 / n; // Displaying the output Console.Write("Interior angle: " + interiorAngle + "\n"); Console.Write("Exterior angle: " + exteriorAngle); } // Driver code public static void Main () { int n = 10; // Function calling findAngle(n); }} // This code is contributed// by Smitha
<?php// PHP program to find the// interior and exterior// angle of a given polygon // function to find the// interior and exterior// anglefunction findAngle($n){ $interiorAngle; $exteriorAngle; // formula to find // the interior angle $interiorAngle = ($n - 2) * 180 / $n; // formula to find // the exterior angle $exteriorAngle = 360 /$n; // Displaying the output echo "Interior angle: " , $interiorAngle, "\n" ; echo "Exterior angle: " , $exteriorAngle;} // Driver code$n = 10; // Function callingfindAngle($n); // This code is contributed// by inder_verma.?>
<script>// JavaScript program to find the interior and// exterior angle of a given polygon // function to find the interior and// exterior anglefunction findAngle(n){ let interiorAngle, exteriorAngle; // formula to find the interior angle interiorAngle = Math.floor((n - 2) * 180 / n); // formula to find the exterior angle exteriorAngle = Math.floor(360 / n); // Displaying the output document.write("Interior angle: " + interiorAngle + "<br>"); document.write("Exterior angle: " + exteriorAngle);} // Driver code let n = 10; // Function calling findAngle(n); // This code is contributed by Surbhi Tyagi.</script>
Interior angle: 144
Exterior angle: 36
Smitha Dinesh Semwal
inderDuMCA
surbhityagi15
math
Mathematical
School Programming
Mathematical
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Merge two sorted arrays
Modulo Operator (%) in C/C++ with Examples
Prime Numbers
Program for factorial of a number
Print all possible combinations of r elements in a given array of size n
Python Dictionary
Arrays in C/C++
Inheritance in C++
Reverse a string in Java
C++ Classes and Objects | [
{
"code": null,
"e": 26227,
"s": 26199,
"text": "\n19 Mar, 2021"
},
{
"code": null,
"e": 26366,
"s": 26227,
"text": "Given the number of sides n of a regular polygon. The task is to find out the Interior angle and Exterior angle of the polygon.Examples: "
},
{
"code": null,
"e": 26508,
"s": 26366,
"text": "Input : n = 6\nOutput : Interior angle: 120\n Exterior angle: 60\n\nInput : n = 10\nOutput: Interior angle: 144\n Exterior angle: 36"
},
{
"code": null,
"e": 26809,
"s": 26510,
"text": "Interior angle: The angle between two adjacent sides inside the polygon is known as the Interior angle. Formula to find the Interior angle:Interior Angle = Exterior angle: The angle formed by any side of a polygon and the extension of its adjacent side is known as Exterior angle.Exterior angle = "
},
{
"code": null,
"e": 26878,
"s": 26809,
"text": "Program to find interior and exterior angles of a Regular Polygon: "
},
{
"code": null,
"e": 26882,
"s": 26878,
"text": "C++"
},
{
"code": null,
"e": 26887,
"s": 26882,
"text": "Java"
},
{
"code": null,
"e": 26895,
"s": 26887,
"text": "Python3"
},
{
"code": null,
"e": 26898,
"s": 26895,
"text": "C#"
},
{
"code": null,
"e": 26902,
"s": 26898,
"text": "PHP"
},
{
"code": null,
"e": 26913,
"s": 26902,
"text": "Javascript"
},
{
"code": "// CPP program to find the interior and// exterior angle of a given polygon#include <iostream>using namespace std; // function to find the interior and// exterior anglevoid findAngle(int n){ int interiorAngle, exteriorAngle; // formula to find the interior angle interiorAngle = (n - 2) * 180 / n; // formula to find the exterior angle exteriorAngle = 360 / n; // Displaying the output cout << \"Interior angle: \" << interiorAngle << endl; cout << \"Exterior angle: \" << exteriorAngle;} // Driver codeint main(){ int n = 10; // Function calling findAngle(n); return 0;}",
"e": 27530,
"s": 26913,
"text": null
},
{
"code": "// Java program to find the interior and// exterior angle of a given polygonimport java.io.*; class GFG { // function to find the interior and // exterior angle static void findAngle(int n) { int interiorAngle, exteriorAngle; // formula to find the interior angle interiorAngle = (n - 2) * 180 / n; // formula to find the exterior angle exteriorAngle = 360 / n; // Displaying the output System.out.println(\"Interior angle: \" + interiorAngle); System.out.println(\"Exterior angle: \" + exteriorAngle); } // Driver code public static void main (String[] args) { int n = 10; // Function calling findAngle(n); }}",
"e": 28280,
"s": 27530,
"text": null
},
{
"code": "# Python3 program to find# the interior and exterior# angle of a given polygon # function to find# the interior and# exterior angledef findAngle(n): # formula to find the # interior angle interiorAngle = int((n - 2) * 180 / n) # formula to find # the exterior angle exteriorAngle = int(360 / n) # Displaying the output print(\"Interior angle: \" , interiorAngle ) print(\"Exterior angle: \" , exteriorAngle ) # Driver coden = 10 # Function callingfindAngle(n) # This code is contributed# by Smitha",
"e": 28834,
"s": 28280,
"text": null
},
{
"code": "// C# program to find the// interior and exterior// angle of a given polygonusing System; class GFG{ // function to find // the interior and // exterior angle static void findAngle(int n) { int interiorAngle, exteriorAngle; // formula to find // the interior angle interiorAngle = (n - 2) * 180 / n; // formula to find // the exterior angle exteriorAngle = 360 / n; // Displaying the output Console.Write(\"Interior angle: \" + interiorAngle + \"\\n\"); Console.Write(\"Exterior angle: \" + exteriorAngle); } // Driver code public static void Main () { int n = 10; // Function calling findAngle(n); }} // This code is contributed// by Smitha",
"e": 29685,
"s": 28834,
"text": null
},
{
"code": "<?php// PHP program to find the// interior and exterior// angle of a given polygon // function to find the// interior and exterior// anglefunction findAngle($n){ $interiorAngle; $exteriorAngle; // formula to find // the interior angle $interiorAngle = ($n - 2) * 180 / $n; // formula to find // the exterior angle $exteriorAngle = 360 /$n; // Displaying the output echo \"Interior angle: \" , $interiorAngle, \"\\n\" ; echo \"Exterior angle: \" , $exteriorAngle;} // Driver code$n = 10; // Function callingfindAngle($n); // This code is contributed// by inder_verma.?>",
"e": 30327,
"s": 29685,
"text": null
},
{
"code": "<script>// JavaScript program to find the interior and// exterior angle of a given polygon // function to find the interior and// exterior anglefunction findAngle(n){ let interiorAngle, exteriorAngle; // formula to find the interior angle interiorAngle = Math.floor((n - 2) * 180 / n); // formula to find the exterior angle exteriorAngle = Math.floor(360 / n); // Displaying the output document.write(\"Interior angle: \" + interiorAngle + \"<br>\"); document.write(\"Exterior angle: \" + exteriorAngle);} // Driver code let n = 10; // Function calling findAngle(n); // This code is contributed by Surbhi Tyagi.</script>",
"e": 30988,
"s": 30327,
"text": null
},
{
"code": null,
"e": 31027,
"s": 30988,
"text": "Interior angle: 144\nExterior angle: 36"
},
{
"code": null,
"e": 31050,
"s": 31029,
"text": "Smitha Dinesh Semwal"
},
{
"code": null,
"e": 31061,
"s": 31050,
"text": "inderDuMCA"
},
{
"code": null,
"e": 31075,
"s": 31061,
"text": "surbhityagi15"
},
{
"code": null,
"e": 31080,
"s": 31075,
"text": "math"
},
{
"code": null,
"e": 31093,
"s": 31080,
"text": "Mathematical"
},
{
"code": null,
"e": 31112,
"s": 31093,
"text": "School Programming"
},
{
"code": null,
"e": 31125,
"s": 31112,
"text": "Mathematical"
},
{
"code": null,
"e": 31223,
"s": 31125,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 31247,
"s": 31223,
"text": "Merge two sorted arrays"
},
{
"code": null,
"e": 31290,
"s": 31247,
"text": "Modulo Operator (%) in C/C++ with Examples"
},
{
"code": null,
"e": 31304,
"s": 31290,
"text": "Prime Numbers"
},
{
"code": null,
"e": 31338,
"s": 31304,
"text": "Program for factorial of a number"
},
{
"code": null,
"e": 31411,
"s": 31338,
"text": "Print all possible combinations of r elements in a given array of size n"
},
{
"code": null,
"e": 31429,
"s": 31411,
"text": "Python Dictionary"
},
{
"code": null,
"e": 31445,
"s": 31429,
"text": "Arrays in C/C++"
},
{
"code": null,
"e": 31464,
"s": 31445,
"text": "Inheritance in C++"
},
{
"code": null,
"e": 31489,
"s": 31464,
"text": "Reverse a string in Java"
}
] |
How to create Text Editor using Javascript and HTML ? - GeeksforGeeks | 16 Apr, 2021
Project Introduction: In this article, we will learn how to make a simple text editor JavaScript application where we can manipulate the user input in different styles, edit the input, capitalize, etc many string operations. Let’s see the implementation.
Approach:
Create buttons to perform operations on text in div.
Create textarea in div using textarea tag.
Select elements using document.getElementById method.
Then change the CSS using JavaScript.
index.html
<!DOCTYPE html><html lang="en" dir="ltr"> <head> <meta charset="utf-8"> <title>Text Editor</title> <!--Bootstrap Cdn --> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous"> <!-- fontawesome cdn For Icons --> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.10.0/css/all.min.css" integrity="sha512-PgQMlq+nqFLV4ylk1gwUOgm6CtIIXkKwaIHp/PAIWHzig/lKZSEGKEysh0TCVbHJXCLN7WetD8TFecIky75ZfQ==" crossorigin="anonymous" /> <link rel="stylesheet" href="https://pro.fontawesome.com/releases/v5.10.0/css/all.css" integrity="sha384-AYmEC3Yw5cVb3ZcuHtOA93w35dYTsvhLPVnYs9eStHfGJvOvKxVfELGroGkvsg+p" crossorigin="anonymous" /> <!--Internal CSS start--> <style> h1 { padding-top: 40px; padding-bottom: 40px; text-align: center; color: #957dad; font-family: 'Montserrat', sans-serif; } section { padding: 5%; padding-top: 0; height: 100vh; } .side { margin-left: 0; } button { margin: 10px; border-color: #957dad !important; color: #888888 !important; margin-bottom: 25px; } button:hover { background-color: #fec8d8 !important; } textarea { padding: 3%; border-color: #957dad; border-width: thick; } .flex-box { display: flex; justify-content: center; } </style> <!--Internal CSS End--></head><!--Body start--> <body> <section class=""> <h1 class="shadow-sm">TEXT EDITOR</h1> <div class="flex-box"> <div class="row"> <div class="col"> <!-- Adding different buttons for different functionality--> <!--onclick attribute is added to give button a work to do when it is clicked--> <button type="button" onclick="f1()" class=" shadow-sm btn btn-outline-secondary" data-toggle="tooltip" data-placement="top" title="Bold Text"> Bold</button> <button type="button" onclick="f2()" class="shadow-sm btn btn-outline-success" data-toggle="tooltip" data-placement="top" title="Italic Text"> Italic</button> <button type="button" onclick="f3()" class=" shadow-sm btn btn-outline-primary" data-toggle="tooltip" data-placement="top" title="Left Align"> <i class="fas fa-align-left"></i></button> <button type="button" onclick="f4()" class="btn shadow-sm btn-outline-secondary" data-toggle="tooltip" data-placement="top" title="Center Align"> <i class="fas fa-align-center"></i></button> <button type="button" onclick="f5()" class="btn shadow-sm btn-outline-primary" data-toggle="tooltip" data-placement="top" title="Right Align"> <i class="fas fa-align-right"></i></button> <button type="button" onclick="f6()" class="btn shadow-sm btn-outline-secondary" data-toggle="tooltip" data-placement="top" title="Uppercase Text"> Upper Case</button> <button type="button" onclick="f7()" class="btn shadow-sm btn-outline-primary" data-toggle="tooltip" data-placement="top" title="Lowercase Text"> Lower Case</button> <button type="button" onclick="f8()" class="btn shadow-sm btn-outline-primary" data-toggle="tooltip" data-placement="top" title="Capitalize Text"> Capitalize</button> <button type="button" onclick="f9()" class="btn shadow-sm btn-outline-primary side" data-toggle="tooltip" data-placement="top" title="Tooltip on top"> Clear Text</button> </div> </div> </div> <br> <div class="row"> <div class="col-md-3 col-sm-3"> </div> <div class="col-md-6 col-sm-9"> <div class="flex-box"> <textarea id="textarea1" class="input shadow" name="name" rows="15" cols="100" placeholder="Your text here "> </textarea> </div> </div> <div class="col-md-3"> </div> </div> </section> <br> <br> <h6 style="text-align:center;">Priyansh Jha 2021.</h6> <!--External JavaScript file--> <script src="home.js"></script></body> </html>
HTML Code Explanation: Here we added different buttons in the document, which will get the power to perform some tasks we give to it with the help of JavaScript. We have added buttons for changing the font-weight of the input string, font style, text alignment of the string, and are going to transform the string using the Document Object Model. We have added some basic CSS to beautify the document, you may use different CSS properties to make it look better. And in the below part of the HTML code, we have added one text field where the user can write down the input string. So, we are ready with all the design and structure of our project now all we need to do is to give powers to it using JavaScript. For, now we have a text box and multiple buttons for applying different styles in the string input.
home.js
function f1() { //function to make the text bold using DOM method document.getElementById("textarea1").style.fontWeight = "bold";} function f2() { //function to make the text italic using DOM method document.getElementById("textarea1").style.fontStyle = "italic";} function f3() { //function to make the text alignment left using DOM method document.getElementById("textarea1").style.textAlign = "left";} function f4() { //function to make the text alignment center using DOM method document.getElementById("textarea1").style.textAlign = "center";} function f5() { //function to make the text alignment right using DOM method document.getElementById("textarea1").style.textAlign = "right";} function f6() { //function to make the text in Uppercase using DOM method document.getElementById("textarea1").style.textTransform = "uppercase";} function f7() { //function to make the text in Lowercase using DOM method document.getElementById("textarea1").style.textTransform = "lowercase";} function f8() { //function to make the text capitalize using DOM method document.getElementById("textarea1").style.textTransform = "capitalize";} function f9() { //function to make the text back to normal by removing all the methods applied //using DOM method document.getElementById("textarea1").style.fontWeight = "normal"; document.getElementById("textarea1").style.textAlign = "left"; document.getElementById("textarea1").style.fontStyle = "normal"; document.getElementById("textarea1").style.textTransform = "capitalize"; document.getElementById("textarea1").value = " ";}
JavaScript Code explanation:Here we are selecting elements using DOM. Then we are using document.getElementById method to select a particular element and then after selecting the specific element using its ID name we are manipulating its CSS through JavaScript. Lastly, we have created a function that makes everything back to normal, where discard all the properties applied using the buttons we provided.
Output:
Output Screen Image
There are many more functions you can add to this project like changing the font size, counting the number of letters, words inside the text area, changing font style, and many more. Do give that a try.You can access the source code from Github and see a running example of this project by clicking here.
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML course.
HTML-DOM
HTML-Questions
HTML5
JavaScript-Questions
CSS
HTML
JavaScript
Project
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to insert spaces/tabs in text using HTML/CSS?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to update Node.js and NPM to next version ?
How to create footer to stay at the bottom of a Web page?
How to apply style to parent if it has child with CSS?
How to insert spaces/tabs in text using HTML/CSS?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to update Node.js and NPM to next version ?
How to set the default value for an HTML <select> element ?
Hide or show elements in HTML using display property | [
{
"code": null,
"e": 39215,
"s": 39187,
"text": "\n16 Apr, 2021"
},
{
"code": null,
"e": 39470,
"s": 39215,
"text": "Project Introduction: In this article, we will learn how to make a simple text editor JavaScript application where we can manipulate the user input in different styles, edit the input, capitalize, etc many string operations. Let’s see the implementation."
},
{
"code": null,
"e": 39480,
"s": 39470,
"text": "Approach:"
},
{
"code": null,
"e": 39533,
"s": 39480,
"text": "Create buttons to perform operations on text in div."
},
{
"code": null,
"e": 39576,
"s": 39533,
"text": "Create textarea in div using textarea tag."
},
{
"code": null,
"e": 39630,
"s": 39576,
"text": "Select elements using document.getElementById method."
},
{
"code": null,
"e": 39669,
"s": 39630,
"text": "Then change the CSS using JavaScript. "
},
{
"code": null,
"e": 39680,
"s": 39669,
"text": "index.html"
},
{
"code": "<!DOCTYPE html><html lang=\"en\" dir=\"ltr\"> <head> <meta charset=\"utf-8\"> <title>Text Editor</title> <!--Bootstrap Cdn --> <link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css\" integrity=\"sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2\" crossorigin=\"anonymous\"> <!-- fontawesome cdn For Icons --> <link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.10.0/css/all.min.css\" integrity=\"sha512-PgQMlq+nqFLV4ylk1gwUOgm6CtIIXkKwaIHp/PAIWHzig/lKZSEGKEysh0TCVbHJXCLN7WetD8TFecIky75ZfQ==\" crossorigin=\"anonymous\" /> <link rel=\"stylesheet\" href=\"https://pro.fontawesome.com/releases/v5.10.0/css/all.css\" integrity=\"sha384-AYmEC3Yw5cVb3ZcuHtOA93w35dYTsvhLPVnYs9eStHfGJvOvKxVfELGroGkvsg+p\" crossorigin=\"anonymous\" /> <!--Internal CSS start--> <style> h1 { padding-top: 40px; padding-bottom: 40px; text-align: center; color: #957dad; font-family: 'Montserrat', sans-serif; } section { padding: 5%; padding-top: 0; height: 100vh; } .side { margin-left: 0; } button { margin: 10px; border-color: #957dad !important; color: #888888 !important; margin-bottom: 25px; } button:hover { background-color: #fec8d8 !important; } textarea { padding: 3%; border-color: #957dad; border-width: thick; } .flex-box { display: flex; justify-content: center; } </style> <!--Internal CSS End--></head><!--Body start--> <body> <section class=\"\"> <h1 class=\"shadow-sm\">TEXT EDITOR</h1> <div class=\"flex-box\"> <div class=\"row\"> <div class=\"col\"> <!-- Adding different buttons for different functionality--> <!--onclick attribute is added to give button a work to do when it is clicked--> <button type=\"button\" onclick=\"f1()\" class=\" shadow-sm btn btn-outline-secondary\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"Bold Text\"> Bold</button> <button type=\"button\" onclick=\"f2()\" class=\"shadow-sm btn btn-outline-success\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"Italic Text\"> Italic</button> <button type=\"button\" onclick=\"f3()\" class=\" shadow-sm btn btn-outline-primary\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"Left Align\"> <i class=\"fas fa-align-left\"></i></button> <button type=\"button\" onclick=\"f4()\" class=\"btn shadow-sm btn-outline-secondary\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"Center Align\"> <i class=\"fas fa-align-center\"></i></button> <button type=\"button\" onclick=\"f5()\" class=\"btn shadow-sm btn-outline-primary\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"Right Align\"> <i class=\"fas fa-align-right\"></i></button> <button type=\"button\" onclick=\"f6()\" class=\"btn shadow-sm btn-outline-secondary\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"Uppercase Text\"> Upper Case</button> <button type=\"button\" onclick=\"f7()\" class=\"btn shadow-sm btn-outline-primary\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"Lowercase Text\"> Lower Case</button> <button type=\"button\" onclick=\"f8()\" class=\"btn shadow-sm btn-outline-primary\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"Capitalize Text\"> Capitalize</button> <button type=\"button\" onclick=\"f9()\" class=\"btn shadow-sm btn-outline-primary side\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"Tooltip on top\"> Clear Text</button> </div> </div> </div> <br> <div class=\"row\"> <div class=\"col-md-3 col-sm-3\"> </div> <div class=\"col-md-6 col-sm-9\"> <div class=\"flex-box\"> <textarea id=\"textarea1\" class=\"input shadow\" name=\"name\" rows=\"15\" cols=\"100\" placeholder=\"Your text here \"> </textarea> </div> </div> <div class=\"col-md-3\"> </div> </div> </section> <br> <br> <h6 style=\"text-align:center;\">Priyansh Jha 2021.</h6> <!--External JavaScript file--> <script src=\"home.js\"></script></body> </html>",
"e": 45859,
"s": 39680,
"text": null
},
{
"code": null,
"e": 46669,
"s": 45859,
"text": "HTML Code Explanation: Here we added different buttons in the document, which will get the power to perform some tasks we give to it with the help of JavaScript. We have added buttons for changing the font-weight of the input string, font style, text alignment of the string, and are going to transform the string using the Document Object Model. We have added some basic CSS to beautify the document, you may use different CSS properties to make it look better. And in the below part of the HTML code, we have added one text field where the user can write down the input string. So, we are ready with all the design and structure of our project now all we need to do is to give powers to it using JavaScript. For, now we have a text box and multiple buttons for applying different styles in the string input."
},
{
"code": null,
"e": 46677,
"s": 46669,
"text": "home.js"
},
{
"code": "function f1() { //function to make the text bold using DOM method document.getElementById(\"textarea1\").style.fontWeight = \"bold\";} function f2() { //function to make the text italic using DOM method document.getElementById(\"textarea1\").style.fontStyle = \"italic\";} function f3() { //function to make the text alignment left using DOM method document.getElementById(\"textarea1\").style.textAlign = \"left\";} function f4() { //function to make the text alignment center using DOM method document.getElementById(\"textarea1\").style.textAlign = \"center\";} function f5() { //function to make the text alignment right using DOM method document.getElementById(\"textarea1\").style.textAlign = \"right\";} function f6() { //function to make the text in Uppercase using DOM method document.getElementById(\"textarea1\").style.textTransform = \"uppercase\";} function f7() { //function to make the text in Lowercase using DOM method document.getElementById(\"textarea1\").style.textTransform = \"lowercase\";} function f8() { //function to make the text capitalize using DOM method document.getElementById(\"textarea1\").style.textTransform = \"capitalize\";} function f9() { //function to make the text back to normal by removing all the methods applied //using DOM method document.getElementById(\"textarea1\").style.fontWeight = \"normal\"; document.getElementById(\"textarea1\").style.textAlign = \"left\"; document.getElementById(\"textarea1\").style.fontStyle = \"normal\"; document.getElementById(\"textarea1\").style.textTransform = \"capitalize\"; document.getElementById(\"textarea1\").value = \" \";}",
"e": 48318,
"s": 46677,
"text": null
},
{
"code": null,
"e": 48725,
"s": 48318,
"text": "JavaScript Code explanation:Here we are selecting elements using DOM. Then we are using document.getElementById method to select a particular element and then after selecting the specific element using its ID name we are manipulating its CSS through JavaScript. Lastly, we have created a function that makes everything back to normal, where discard all the properties applied using the buttons we provided."
},
{
"code": null,
"e": 48734,
"s": 48725,
"text": "Output: "
},
{
"code": null,
"e": 48754,
"s": 48734,
"text": "Output Screen Image"
},
{
"code": null,
"e": 49059,
"s": 48754,
"text": "There are many more functions you can add to this project like changing the font size, counting the number of letters, words inside the text area, changing font style, and many more. Do give that a try.You can access the source code from Github and see a running example of this project by clicking here."
},
{
"code": null,
"e": 49198,
"s": 49061,
"text": "Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML course."
},
{
"code": null,
"e": 49207,
"s": 49198,
"text": "HTML-DOM"
},
{
"code": null,
"e": 49222,
"s": 49207,
"text": "HTML-Questions"
},
{
"code": null,
"e": 49228,
"s": 49222,
"text": "HTML5"
},
{
"code": null,
"e": 49249,
"s": 49228,
"text": "JavaScript-Questions"
},
{
"code": null,
"e": 49253,
"s": 49249,
"text": "CSS"
},
{
"code": null,
"e": 49258,
"s": 49253,
"text": "HTML"
},
{
"code": null,
"e": 49269,
"s": 49258,
"text": "JavaScript"
},
{
"code": null,
"e": 49277,
"s": 49269,
"text": "Project"
},
{
"code": null,
"e": 49294,
"s": 49277,
"text": "Web Technologies"
},
{
"code": null,
"e": 49299,
"s": 49294,
"text": "HTML"
},
{
"code": null,
"e": 49397,
"s": 49299,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 49447,
"s": 49397,
"text": "How to insert spaces/tabs in text using HTML/CSS?"
},
{
"code": null,
"e": 49509,
"s": 49447,
"text": "Top 10 Projects For Beginners To Practice HTML and CSS Skills"
},
{
"code": null,
"e": 49557,
"s": 49509,
"text": "How to update Node.js and NPM to next version ?"
},
{
"code": null,
"e": 49615,
"s": 49557,
"text": "How to create footer to stay at the bottom of a Web page?"
},
{
"code": null,
"e": 49670,
"s": 49615,
"text": "How to apply style to parent if it has child with CSS?"
},
{
"code": null,
"e": 49720,
"s": 49670,
"text": "How to insert spaces/tabs in text using HTML/CSS?"
},
{
"code": null,
"e": 49782,
"s": 49720,
"text": "Top 10 Projects For Beginners To Practice HTML and CSS Skills"
},
{
"code": null,
"e": 49830,
"s": 49782,
"text": "How to update Node.js and NPM to next version ?"
},
{
"code": null,
"e": 49890,
"s": 49830,
"text": "How to set the default value for an HTML <select> element ?"
}
] |
Substitute characters of a String in R Programming - chartr() Function - GeeksforGeeks | 23 Dec, 2021
chartr() function in R Programming Language is used to do string substitutions. It replaces all the matches of the existing characters of a string with the new characters specified as arguments.
Syntax: chartr(old, new, x)
Parameters:
old: old string to be substituted
new: new string
x: target string
Example 1:
R
# R program to illustrate# chartr function # Initializing a stringx <- "Geeks GFG" # Calling the chartr() function# which will substitute G with Z# to the above specified stringchartr("G", "Z", x)
Output :
[1] "Zeeks ZFZ"
Example 2:
R
# R program to illustrate# chartr function # Initializing a stringx <- "GeeksforGeeks Geeks" # Calling the chartr() function# which will substitute G with 1,# k with 2 and s with 3# to the above specified stringchartr("Gks", "123", x)
Output:
[1] "1ee23for1ee23 1ee23"
kumar_satyam
R String-Functions
R-strings
R Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Change Color of Bars in Barchart using ggplot2 in R
Group by function in R using Dplyr
How to Change Axis Scales in R Plots?
How to Split Column Into Multiple Columns in R DataFrame?
Replace Specific Characters in String in R
How to filter R DataFrame by values in a column?
R - if statement
How to import an Excel File into R ?
Plot mean and standard deviation using ggplot2 in R
How to filter R dataframe by multiple conditions? | [
{
"code": null,
"e": 26487,
"s": 26459,
"text": "\n23 Dec, 2021"
},
{
"code": null,
"e": 26682,
"s": 26487,
"text": "chartr() function in R Programming Language is used to do string substitutions. It replaces all the matches of the existing characters of a string with the new characters specified as arguments."
},
{
"code": null,
"e": 26710,
"s": 26682,
"text": "Syntax: chartr(old, new, x)"
},
{
"code": null,
"e": 26723,
"s": 26710,
"text": "Parameters: "
},
{
"code": null,
"e": 26757,
"s": 26723,
"text": "old: old string to be substituted"
},
{
"code": null,
"e": 26773,
"s": 26757,
"text": "new: new string"
},
{
"code": null,
"e": 26790,
"s": 26773,
"text": "x: target string"
},
{
"code": null,
"e": 26802,
"s": 26790,
"text": "Example 1: "
},
{
"code": null,
"e": 26804,
"s": 26802,
"text": "R"
},
{
"code": "# R program to illustrate# chartr function # Initializing a stringx <- \"Geeks GFG\" # Calling the chartr() function# which will substitute G with Z# to the above specified stringchartr(\"G\", \"Z\", x)",
"e": 27001,
"s": 26804,
"text": null
},
{
"code": null,
"e": 27011,
"s": 27001,
"text": "Output : "
},
{
"code": null,
"e": 27027,
"s": 27011,
"text": "[1] \"Zeeks ZFZ\""
},
{
"code": null,
"e": 27039,
"s": 27027,
"text": "Example 2: "
},
{
"code": null,
"e": 27041,
"s": 27039,
"text": "R"
},
{
"code": "# R program to illustrate# chartr function # Initializing a stringx <- \"GeeksforGeeks Geeks\" # Calling the chartr() function# which will substitute G with 1,# k with 2 and s with 3# to the above specified stringchartr(\"Gks\", \"123\", x)",
"e": 27276,
"s": 27041,
"text": null
},
{
"code": null,
"e": 27285,
"s": 27276,
"text": "Output: "
},
{
"code": null,
"e": 27311,
"s": 27285,
"text": "[1] \"1ee23for1ee23 1ee23\""
},
{
"code": null,
"e": 27324,
"s": 27311,
"text": "kumar_satyam"
},
{
"code": null,
"e": 27343,
"s": 27324,
"text": "R String-Functions"
},
{
"code": null,
"e": 27353,
"s": 27343,
"text": "R-strings"
},
{
"code": null,
"e": 27364,
"s": 27353,
"text": "R Language"
},
{
"code": null,
"e": 27462,
"s": 27364,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 27514,
"s": 27462,
"text": "Change Color of Bars in Barchart using ggplot2 in R"
},
{
"code": null,
"e": 27549,
"s": 27514,
"text": "Group by function in R using Dplyr"
},
{
"code": null,
"e": 27587,
"s": 27549,
"text": "How to Change Axis Scales in R Plots?"
},
{
"code": null,
"e": 27645,
"s": 27587,
"text": "How to Split Column Into Multiple Columns in R DataFrame?"
},
{
"code": null,
"e": 27688,
"s": 27645,
"text": "Replace Specific Characters in String in R"
},
{
"code": null,
"e": 27737,
"s": 27688,
"text": "How to filter R DataFrame by values in a column?"
},
{
"code": null,
"e": 27754,
"s": 27737,
"text": "R - if statement"
},
{
"code": null,
"e": 27791,
"s": 27754,
"text": "How to import an Excel File into R ?"
},
{
"code": null,
"e": 27843,
"s": 27791,
"text": "Plot mean and standard deviation using ggplot2 in R"
}
] |
Code Optimization in Compiler Design - GeeksforGeeks | 03 Jul, 2020
The code optimization in the synthesis phase is a program transformation technique, which tries to improve the intermediate code by making it consume fewer resources (i.e. CPU, Memory) so that faster-running machine code will result. Compiler optimizing process should meet the following objectives :
The optimization must be correct, it must not, in any way, change the meaning of the program.
Optimization should increase the speed and performance of the program.
The compilation time must be kept reasonable.
The optimization process should not delay the overall compiling process.
When to Optimize?Optimization of the code is often performed at the end of the development stage since it reduces readability and adds code that is used to increase the performance.
Why Optimize?Optimizing an algorithm is beyond the scope of the code optimization phase. So the program is optimized. And it may involve reducing the size of the code. So optimization helps to:
Reduce the space consumed and increases the speed of compilation.
Manually analyzing datasets involves a lot of time. Hence we make use of software like Tableau for data analysis. Similarly manually performing the optimization is also tedious and is better done using a code optimizer.
An optimized code often promotes re-usability.
Types of Code Optimization –The optimization process can be broadly classified into two types :
Machine Independent Optimization – This code optimization phase attempts to improve the intermediate code to get a better target code as the output. The part of the intermediate code which is transformed here does not involve any CPU registers or absolute memory locations.Machine Dependent Optimization – Machine-dependent optimization is done after the target code has been generated and when the code is transformed according to the target machine architecture. It involves CPU registers and may have absolute memory references rather than relative references. Machine-dependent optimizers put efforts to take maximum advantage of the memory hierarchy.
Machine Independent Optimization – This code optimization phase attempts to improve the intermediate code to get a better target code as the output. The part of the intermediate code which is transformed here does not involve any CPU registers or absolute memory locations.
Machine Dependent Optimization – Machine-dependent optimization is done after the target code has been generated and when the code is transformed according to the target machine architecture. It involves CPU registers and may have absolute memory references rather than relative references. Machine-dependent optimizers put efforts to take maximum advantage of the memory hierarchy.
Code Optimization is done in the following different ways :
Compile Time Evaluation :(i) A = 2*(22.0/7.0)*r Perform 2*(22.0/7.0)*r at compile time.(ii) x = 12.4 y = x/2.3 Evaluate x/2.3 as 12.4/2.3 at compile time.Variable Propagation ://Before Optimization c = a * b x = a till d = x * b + 4 //After Optimization c = a * b x = atilld = a * b + 4Hence, after variable propagation, a*b and x*b will be identified as common sub-expression.Dead code elimination : Variable propagation often leads to making assignment statement into dead codec = a * b x = a till d = a * b + 4 //After elimination :c = a * btilld = a * b + 4Code Motion :• Reduce the evaluation frequency of expression.• Bring loop invariant statements out of the loop.a = 200; while(a>0) { b = x + y; if (a % b == 0} printf(“%d”, a); } //This code can be further optimized asa = 200;b = x + y;while(a>0) { if (a % b == 0} printf(“%d”, a); }Induction Variable and Strength Reduction :• An induction variable is used in loop for the following kind of assignment i = i + constant.• Strength reduction means replacing the high strength operator by the low strength.i = 1; while (i<10) { y = i * 4; } //After Reductioni = 1t = 4{ while( t<40) y = t; t = t + 4;}
Compile Time Evaluation :(i) A = 2*(22.0/7.0)*r Perform 2*(22.0/7.0)*r at compile time.(ii) x = 12.4 y = x/2.3 Evaluate x/2.3 as 12.4/2.3 at compile time.
(i) A = 2*(22.0/7.0)*r Perform 2*(22.0/7.0)*r at compile time.(ii) x = 12.4 y = x/2.3 Evaluate x/2.3 as 12.4/2.3 at compile time.
Variable Propagation ://Before Optimization c = a * b x = a till d = x * b + 4 //After Optimization c = a * b x = atilld = a * b + 4Hence, after variable propagation, a*b and x*b will be identified as common sub-expression.
//Before Optimization c = a * b x = a till d = x * b + 4 //After Optimization c = a * b x = atilld = a * b + 4
Hence, after variable propagation, a*b and x*b will be identified as common sub-expression.
Dead code elimination : Variable propagation often leads to making assignment statement into dead codec = a * b x = a till d = a * b + 4 //After elimination :c = a * btilld = a * b + 4
c = a * b x = a till d = a * b + 4 //After elimination :c = a * btilld = a * b + 4
Code Motion :• Reduce the evaluation frequency of expression.• Bring loop invariant statements out of the loop.a = 200; while(a>0) { b = x + y; if (a % b == 0} printf(“%d”, a); } //This code can be further optimized asa = 200;b = x + y;while(a>0) { if (a % b == 0} printf(“%d”, a); }
a = 200; while(a>0) { b = x + y; if (a % b == 0} printf(“%d”, a); } //This code can be further optimized asa = 200;b = x + y;while(a>0) { if (a % b == 0} printf(“%d”, a); }
Induction Variable and Strength Reduction :• An induction variable is used in loop for the following kind of assignment i = i + constant.• Strength reduction means replacing the high strength operator by the low strength.i = 1; while (i<10) { y = i * 4; } //After Reductioni = 1t = 4{ while( t<40) y = t; t = t + 4;}
i = 1; while (i<10) { y = i * 4; } //After Reductioni = 1t = 4{ while( t<40) y = t; t = t + 4;}
Where to apply Optimization?Now that we learned the need for optimization and its two types,now let’s see where to apply these optimization.
Source programOptimizing the source program involves making changes to the algorithm or changing the loop structures.User is the actor here.
Intermediate CodeOptimizing the intermediate code involves changing the address calculations and transforming the procedure calls involved. Here compiler is the actor.
Target CodeOptimizing the target code is done by the compiler. Usage of registers,select and move instructions is part of optimization involved in the target code.
Global Optimization:Transformations are applied to large program segments that includes functions,procedures and loops.
Local Optimization:Transformations are applied to small blocks of statements.The local optimization is done prior to global optimization.
Reference – https://en.wikipedia.org/wiki/Optimizing_compiler
This article is contributed by Priyamvada Singh. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to [email protected]. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
Palak Jain 5
aleenajoseph993
singhdrishti1001
Compiler Design
GATE CS
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Construction of LL(1) Parsing Table
Directed Acyclic graph in Compiler Design (with examples)
Types of Parsers in Compiler Design
Difference between Compiler and Interpreter
Peephole Optimization in Compiler Design
Layers of OSI Model
ACID Properties in DBMS
TCP/IP Model
Types of Operating Systems
Normal Forms in DBMS | [
{
"code": null,
"e": 26487,
"s": 26459,
"text": "\n03 Jul, 2020"
},
{
"code": null,
"e": 26788,
"s": 26487,
"text": "The code optimization in the synthesis phase is a program transformation technique, which tries to improve the intermediate code by making it consume fewer resources (i.e. CPU, Memory) so that faster-running machine code will result. Compiler optimizing process should meet the following objectives :"
},
{
"code": null,
"e": 26882,
"s": 26788,
"text": "The optimization must be correct, it must not, in any way, change the meaning of the program."
},
{
"code": null,
"e": 26953,
"s": 26882,
"text": "Optimization should increase the speed and performance of the program."
},
{
"code": null,
"e": 26999,
"s": 26953,
"text": "The compilation time must be kept reasonable."
},
{
"code": null,
"e": 27072,
"s": 26999,
"text": "The optimization process should not delay the overall compiling process."
},
{
"code": null,
"e": 27254,
"s": 27072,
"text": "When to Optimize?Optimization of the code is often performed at the end of the development stage since it reduces readability and adds code that is used to increase the performance."
},
{
"code": null,
"e": 27448,
"s": 27254,
"text": "Why Optimize?Optimizing an algorithm is beyond the scope of the code optimization phase. So the program is optimized. And it may involve reducing the size of the code. So optimization helps to:"
},
{
"code": null,
"e": 27514,
"s": 27448,
"text": "Reduce the space consumed and increases the speed of compilation."
},
{
"code": null,
"e": 27734,
"s": 27514,
"text": "Manually analyzing datasets involves a lot of time. Hence we make use of software like Tableau for data analysis. Similarly manually performing the optimization is also tedious and is better done using a code optimizer."
},
{
"code": null,
"e": 27781,
"s": 27734,
"text": "An optimized code often promotes re-usability."
},
{
"code": null,
"e": 27877,
"s": 27781,
"text": "Types of Code Optimization –The optimization process can be broadly classified into two types :"
},
{
"code": null,
"e": 28533,
"s": 27877,
"text": "Machine Independent Optimization – This code optimization phase attempts to improve the intermediate code to get a better target code as the output. The part of the intermediate code which is transformed here does not involve any CPU registers or absolute memory locations.Machine Dependent Optimization – Machine-dependent optimization is done after the target code has been generated and when the code is transformed according to the target machine architecture. It involves CPU registers and may have absolute memory references rather than relative references. Machine-dependent optimizers put efforts to take maximum advantage of the memory hierarchy."
},
{
"code": null,
"e": 28807,
"s": 28533,
"text": "Machine Independent Optimization – This code optimization phase attempts to improve the intermediate code to get a better target code as the output. The part of the intermediate code which is transformed here does not involve any CPU registers or absolute memory locations."
},
{
"code": null,
"e": 29190,
"s": 28807,
"text": "Machine Dependent Optimization – Machine-dependent optimization is done after the target code has been generated and when the code is transformed according to the target machine architecture. It involves CPU registers and may have absolute memory references rather than relative references. Machine-dependent optimizers put efforts to take maximum advantage of the memory hierarchy."
},
{
"code": null,
"e": 29250,
"s": 29190,
"text": "Code Optimization is done in the following different ways :"
},
{
"code": null,
"e": 30982,
"s": 29250,
"text": "Compile Time Evaluation :(i) A = 2*(22.0/7.0)*r Perform 2*(22.0/7.0)*r at compile time.(ii) x = 12.4 y = x/2.3 Evaluate x/2.3 as 12.4/2.3 at compile time.Variable Propagation ://Before Optimization c = a * b x = a till d = x * b + 4 //After Optimization c = a * b x = atilld = a * b + 4Hence, after variable propagation, a*b and x*b will be identified as common sub-expression.Dead code elimination : Variable propagation often leads to making assignment statement into dead codec = a * b x = a till d = a * b + 4 //After elimination :c = a * btilld = a * b + 4Code Motion :• Reduce the evaluation frequency of expression.• Bring loop invariant statements out of the loop.a = 200; while(a>0) { b = x + y; if (a % b == 0} printf(“%d”, a); } //This code can be further optimized asa = 200;b = x + y;while(a>0) { if (a % b == 0} printf(“%d”, a); }Induction Variable and Strength Reduction :• An induction variable is used in loop for the following kind of assignment i = i + constant.• Strength reduction means replacing the high strength operator by the low strength.i = 1; while (i<10) { y = i * 4; } //After Reductioni = 1t = 4{ while( t<40) y = t; t = t + 4;}"
},
{
"code": null,
"e": 31155,
"s": 30982,
"text": "Compile Time Evaluation :(i) A = 2*(22.0/7.0)*r Perform 2*(22.0/7.0)*r at compile time.(ii) x = 12.4 y = x/2.3 Evaluate x/2.3 as 12.4/2.3 at compile time."
},
{
"code": "(i) A = 2*(22.0/7.0)*r Perform 2*(22.0/7.0)*r at compile time.(ii) x = 12.4 y = x/2.3 Evaluate x/2.3 as 12.4/2.3 at compile time.",
"e": 31303,
"s": 31155,
"text": null
},
{
"code": null,
"e": 31683,
"s": 31303,
"text": "Variable Propagation ://Before Optimization c = a * b x = a till d = x * b + 4 //After Optimization c = a * b x = atilld = a * b + 4Hence, after variable propagation, a*b and x*b will be identified as common sub-expression."
},
{
"code": "//Before Optimization c = a * b x = a till d = x * b + 4 //After Optimization c = a * b x = atilld = a * b + 4",
"e": 31950,
"s": 31683,
"text": null
},
{
"code": null,
"e": 32042,
"s": 31950,
"text": "Hence, after variable propagation, a*b and x*b will be identified as common sub-expression."
},
{
"code": null,
"e": 32381,
"s": 32042,
"text": "Dead code elimination : Variable propagation often leads to making assignment statement into dead codec = a * b x = a till d = a * b + 4 //After elimination :c = a * btilld = a * b + 4"
},
{
"code": "c = a * b x = a till d = a * b + 4 //After elimination :c = a * btilld = a * b + 4",
"e": 32618,
"s": 32381,
"text": null
},
{
"code": null,
"e": 32927,
"s": 32618,
"text": "Code Motion :• Reduce the evaluation frequency of expression.• Bring loop invariant statements out of the loop.a = 200; while(a>0) { b = x + y; if (a % b == 0} printf(“%d”, a); } //This code can be further optimized asa = 200;b = x + y;while(a>0) { if (a % b == 0} printf(“%d”, a); }"
},
{
"code": "a = 200; while(a>0) { b = x + y; if (a % b == 0} printf(“%d”, a); } //This code can be further optimized asa = 200;b = x + y;while(a>0) { if (a % b == 0} printf(“%d”, a); }",
"e": 33125,
"s": 32927,
"text": null
},
{
"code": null,
"e": 33660,
"s": 33125,
"text": "Induction Variable and Strength Reduction :• An induction variable is used in loop for the following kind of assignment i = i + constant.• Strength reduction means replacing the high strength operator by the low strength.i = 1; while (i<10) { y = i * 4; } //After Reductioni = 1t = 4{ while( t<40) y = t; t = t + 4;}"
},
{
"code": "i = 1; while (i<10) { y = i * 4; } //After Reductioni = 1t = 4{ while( t<40) y = t; t = t + 4;}",
"e": 33974,
"s": 33660,
"text": null
},
{
"code": null,
"e": 34115,
"s": 33974,
"text": "Where to apply Optimization?Now that we learned the need for optimization and its two types,now let’s see where to apply these optimization."
},
{
"code": null,
"e": 34256,
"s": 34115,
"text": "Source programOptimizing the source program involves making changes to the algorithm or changing the loop structures.User is the actor here."
},
{
"code": null,
"e": 34424,
"s": 34256,
"text": "Intermediate CodeOptimizing the intermediate code involves changing the address calculations and transforming the procedure calls involved. Here compiler is the actor."
},
{
"code": null,
"e": 34588,
"s": 34424,
"text": "Target CodeOptimizing the target code is done by the compiler. Usage of registers,select and move instructions is part of optimization involved in the target code."
},
{
"code": null,
"e": 34708,
"s": 34588,
"text": "Global Optimization:Transformations are applied to large program segments that includes functions,procedures and loops."
},
{
"code": null,
"e": 34846,
"s": 34708,
"text": "Local Optimization:Transformations are applied to small blocks of statements.The local optimization is done prior to global optimization."
},
{
"code": null,
"e": 34908,
"s": 34846,
"text": "Reference – https://en.wikipedia.org/wiki/Optimizing_compiler"
},
{
"code": null,
"e": 35212,
"s": 34908,
"text": "This article is contributed by Priyamvada Singh. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to [email protected]. See your article appearing on the GeeksforGeeks main page and help other Geeks."
},
{
"code": null,
"e": 35337,
"s": 35212,
"text": "Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above."
},
{
"code": null,
"e": 35350,
"s": 35337,
"text": "Palak Jain 5"
},
{
"code": null,
"e": 35366,
"s": 35350,
"text": "aleenajoseph993"
},
{
"code": null,
"e": 35383,
"s": 35366,
"text": "singhdrishti1001"
},
{
"code": null,
"e": 35399,
"s": 35383,
"text": "Compiler Design"
},
{
"code": null,
"e": 35407,
"s": 35399,
"text": "GATE CS"
},
{
"code": null,
"e": 35505,
"s": 35407,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 35541,
"s": 35505,
"text": "Construction of LL(1) Parsing Table"
},
{
"code": null,
"e": 35599,
"s": 35541,
"text": "Directed Acyclic graph in Compiler Design (with examples)"
},
{
"code": null,
"e": 35635,
"s": 35599,
"text": "Types of Parsers in Compiler Design"
},
{
"code": null,
"e": 35679,
"s": 35635,
"text": "Difference between Compiler and Interpreter"
},
{
"code": null,
"e": 35720,
"s": 35679,
"text": "Peephole Optimization in Compiler Design"
},
{
"code": null,
"e": 35740,
"s": 35720,
"text": "Layers of OSI Model"
},
{
"code": null,
"e": 35764,
"s": 35740,
"text": "ACID Properties in DBMS"
},
{
"code": null,
"e": 35777,
"s": 35764,
"text": "TCP/IP Model"
},
{
"code": null,
"e": 35804,
"s": 35777,
"text": "Types of Operating Systems"
}
] |
Program for longest common directory path - GeeksforGeeks | 30 Jun, 2021
Given n directory paths, we need to write a program to find longest common directory path. Examples:
Input : 3
"/home/User/Desktop/gfg/test"
"/home/User/Desktop/gfg/file"
"/home/User/Desktop/geeks/folders"
Output : Longest Common Path is /home/User/Desktop!
Input : 4
"/home/User/Desktop/gfg/test",
"/home/User/Desktop/gfg/file",
"/home/User/Desktop/gfg/folders",
"/home/User/Desktop/gfg/folders"
Output : Longest Common Path is /home/User/Desktop/gfg!
In the function LongestCommonPath() there are two main variables used which are “CommonCharacters” for storing the length of common characters and “CommonString” for storing the longest string of paths so that we get our longest common path. CommonCharacter variable gets updated in each iteration depending upon the length of common path appearing in the input paths. Lastly, we get the length of common path string after the iteration. Then, we get our common path by the substring till the separator ‘/’ as if we don’t do this then we get the longest common string among the paths, which should not be our result . Below is the implementation of the above approach .
CPP
// CPP program for longest common path#include <bits/stdc++.h>using namespace std; string LongestCommonPath(const vector<string>& input_directory, char separator){ vector<string>::const_iterator iter; // stores the length of common characters // and initialized with the length of // first string . int CommonCharacters = input_directory[0].length(); // stores the common string and initialized // with the first string . string CommonString = input_directory[0]; for (iter = input_directory.begin() + 1; iter != input_directory.end(); iter++) { // finding the two pointers through the mismatch() // function which is 'mismatch at first string' and // 'mismatch at the other string ' pair<string::const_iterator, string::const_iterator> p = mismatch(CommonString.begin(), CommonString.end(), iter->begin()); // As the first mismatch string pointer points to the mismatch // present in the "CommonString" so "( p.first-CommonString.begin())" // determines the common characters in each iteration . if ((p.first - CommonString.begin()) < CommonCharacters) { // If the expression is smaller than commonCharacters // then we will update the commonCharacters because // this states that common path is smaller than the // string commonCharacters we have evaluated till . CommonCharacters = p.first - CommonString.begin(); } // Updating CommonString variable // so that in this maximum length // string is stored . if (*iter > CommonString) CommonString = *iter; } // In 'found' variable we store the index of '/' in // the length of common characters in CommonString int found; for (int i = CommonCharacters; i >= 0; --i) { if (CommonString[i] == '/') { found = i; break; } } // The substring from index 0 to index of // separator is the longest common substring return CommonString.substr(0, found);} int main(){ int n = 4; string input_directory[4] = { "/home/User/Desktop/gfg/test", "/home/User/Desktop/gfg/file", "/home/User/Desktop/gfg/folders", "/home/User/Desktop/gfg/folders" }; vector<string> input(input_directory, input_directory + n); cout << "Longest Common Path is " << LongestCommonPath(input, '/') << "!\n"; return 0;}
Longest Common Path is /home/User/Desktop/gfg!
References : Rosetta code
as5853535
Strings
Technical Scripter
Strings
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Top 50 String Coding Problems for Interviews
Print all the duplicates in the input string
Vigenère Cipher
String class in Java | Set 1
sprintf() in C
Print all subsequences of a string
Convert character array to string in C++
How to Append a Character to a String in C
Program to count occurrence of a given character in a string
Naive algorithm for Pattern Searching | [
{
"code": null,
"e": 26099,
"s": 26071,
"text": "\n30 Jun, 2021"
},
{
"code": null,
"e": 26202,
"s": 26099,
"text": "Given n directory paths, we need to write a program to find longest common directory path. Examples: "
},
{
"code": null,
"e": 26558,
"s": 26202,
"text": "Input : 3\n\"/home/User/Desktop/gfg/test\"\n\"/home/User/Desktop/gfg/file\"\n\"/home/User/Desktop/geeks/folders\"\n\nOutput : Longest Common Path is /home/User/Desktop!\n\nInput : 4\n\"/home/User/Desktop/gfg/test\",\n\"/home/User/Desktop/gfg/file\",\n\"/home/User/Desktop/gfg/folders\",\n\"/home/User/Desktop/gfg/folders\"\n\n\nOutput : Longest Common Path is /home/User/Desktop/gfg!"
},
{
"code": null,
"e": 27232,
"s": 26560,
"text": "In the function LongestCommonPath() there are two main variables used which are “CommonCharacters” for storing the length of common characters and “CommonString” for storing the longest string of paths so that we get our longest common path. CommonCharacter variable gets updated in each iteration depending upon the length of common path appearing in the input paths. Lastly, we get the length of common path string after the iteration. Then, we get our common path by the substring till the separator ‘/’ as if we don’t do this then we get the longest common string among the paths, which should not be our result . Below is the implementation of the above approach . "
},
{
"code": null,
"e": 27236,
"s": 27232,
"text": "CPP"
},
{
"code": "// CPP program for longest common path#include <bits/stdc++.h>using namespace std; string LongestCommonPath(const vector<string>& input_directory, char separator){ vector<string>::const_iterator iter; // stores the length of common characters // and initialized with the length of // first string . int CommonCharacters = input_directory[0].length(); // stores the common string and initialized // with the first string . string CommonString = input_directory[0]; for (iter = input_directory.begin() + 1; iter != input_directory.end(); iter++) { // finding the two pointers through the mismatch() // function which is 'mismatch at first string' and // 'mismatch at the other string ' pair<string::const_iterator, string::const_iterator> p = mismatch(CommonString.begin(), CommonString.end(), iter->begin()); // As the first mismatch string pointer points to the mismatch // present in the \"CommonString\" so \"( p.first-CommonString.begin())\" // determines the common characters in each iteration . if ((p.first - CommonString.begin()) < CommonCharacters) { // If the expression is smaller than commonCharacters // then we will update the commonCharacters because // this states that common path is smaller than the // string commonCharacters we have evaluated till . CommonCharacters = p.first - CommonString.begin(); } // Updating CommonString variable // so that in this maximum length // string is stored . if (*iter > CommonString) CommonString = *iter; } // In 'found' variable we store the index of '/' in // the length of common characters in CommonString int found; for (int i = CommonCharacters; i >= 0; --i) { if (CommonString[i] == '/') { found = i; break; } } // The substring from index 0 to index of // separator is the longest common substring return CommonString.substr(0, found);} int main(){ int n = 4; string input_directory[4] = { \"/home/User/Desktop/gfg/test\", \"/home/User/Desktop/gfg/file\", \"/home/User/Desktop/gfg/folders\", \"/home/User/Desktop/gfg/folders\" }; vector<string> input(input_directory, input_directory + n); cout << \"Longest Common Path is \" << LongestCommonPath(input, '/') << \"!\\n\"; return 0;}",
"e": 29823,
"s": 27236,
"text": null
},
{
"code": null,
"e": 29870,
"s": 29823,
"text": "Longest Common Path is /home/User/Desktop/gfg!"
},
{
"code": null,
"e": 29899,
"s": 29872,
"text": "References : Rosetta code "
},
{
"code": null,
"e": 29909,
"s": 29899,
"text": "as5853535"
},
{
"code": null,
"e": 29917,
"s": 29909,
"text": "Strings"
},
{
"code": null,
"e": 29936,
"s": 29917,
"text": "Technical Scripter"
},
{
"code": null,
"e": 29944,
"s": 29936,
"text": "Strings"
},
{
"code": null,
"e": 30042,
"s": 29944,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 30087,
"s": 30042,
"text": "Top 50 String Coding Problems for Interviews"
},
{
"code": null,
"e": 30132,
"s": 30087,
"text": "Print all the duplicates in the input string"
},
{
"code": null,
"e": 30149,
"s": 30132,
"text": "Vigenère Cipher"
},
{
"code": null,
"e": 30178,
"s": 30149,
"text": "String class in Java | Set 1"
},
{
"code": null,
"e": 30193,
"s": 30178,
"text": "sprintf() in C"
},
{
"code": null,
"e": 30228,
"s": 30193,
"text": "Print all subsequences of a string"
},
{
"code": null,
"e": 30269,
"s": 30228,
"text": "Convert character array to string in C++"
},
{
"code": null,
"e": 30312,
"s": 30269,
"text": "How to Append a Character to a String in C"
},
{
"code": null,
"e": 30373,
"s": 30312,
"text": "Program to count occurrence of a given character in a string"
}
] |
How to get names of all colorscales in Plotly-Python? - GeeksforGeeks | 28 Nov, 2021
In this article, we will learn how to hide the colorbar and legend in plotly express in Python. Color bar are gradients that go from light to dark or the other way round. They are great for visualizing datasets that goes from low to high, like income, temperature, or age.
Step 1:
Import all the required packages.
Python3
# import the modulesimport inspectimport plotly.express as pxfrom textwrap import fill
Step 2:
Here we will get all the individual color-scale names by using the inspect module while iterating over the color module.
Python3
# iterating over color modulecolorscale_names = []colors_modules = ['carto', 'colorbrewer', 'cmocean', 'cyclical', 'diverging', 'plotlyjs', 'qualitative', 'sequential'] for color_module in colors_modules: colorscale_names.extend([name for name, body in inspect.getmembers(getattr(px.colors, color_module)) if isinstance(body, list)])
Complete Code:
Python3
# import the modulesimport inspectimport plotly.express as pxfrom textwrap import fill # iterating over color modulecolorscale_names = []colors_modules = ['carto', 'cmocean', 'cyclical', 'diverging', 'plotlyjs', 'qualitative', 'sequential']for color_module in colors_modules: colorscale_names.extend([name for name, body in inspect.getmembers(getattr(px.colors, color_module)) if isinstance(body, list)]) print(fill(''.join(sorted({f'{x: <{15}}' for x in colorscale_names})), 75))
Output:
The difference between Aggrnyl and Aggrnyl_r is that it will show the reversed scale i.e Aggrnyl (light to dark) Aggrnyl_r(dark to light). To understand it more clearly below in the examples.
Note: Some color-scale names may not work due to version control.
Aggrnyl Aggrnyl_r Agsunset Agsunset_r Alphabet
Alphabet_r Antique Antique_r Armyrose Armyrose_r
Blackbody Blackbody_r Bluered Bluered_r Blues
Blues_r Blugrn Blugrn_r Bluyl Bluyl_r
Bold Bold_r BrBG BrBG_r Brwnyl
Brwnyl_r BuGn BuGn_r BuPu BuPu_r
Burg Burg_r Burgyl Burgyl_r Cividis
Cividis_r D3 D3_r Dark2 Dark24
Dark24_r Dark2_r Darkmint Darkmint_r Earth
Earth_r Edge Edge_r Electric Electric_r
Emrld Emrld_r Fall Fall_r G10
G10_r Geyser Geyser_r GnBu GnBu_r
Greens Greens_r Greys Greys_r HSV
HSV_r Hot Hot_r IceFire IceFire_r
Inferno Inferno_r Jet Jet_r Light24
Light24_r Magenta Magenta_r Magma Magma_r
Mint Mint_r OrRd OrRd_r Oranges
Oranges_r Oryel Oryel_r PRGn PRGn_r
Pastel Pastel1 Pastel1_r Pastel2 Pastel2_r
Pastel_r Peach Peach_r Phase Phase_r
PiYG PiYG_r Picnic Picnic_r Pinkyl
Pinkyl_r Plasma Plasma_r Plotly Plotly3
Plotly3_r Plotly_r Portland Portland_r Prism
Prism_r PuBu PuBuGn PuBuGn_r PuBu_r
PuOr PuOr_r PuRd PuRd_r Purp
Purp_r Purples Purples_r Purpor Purpor_r
Rainbow Rainbow_r RdBu RdBu_r RdGy
RdGy_r RdPu RdPu_r RdYlBu RdYlBu_r
RdYlGn RdYlGn_r Redor Redor_r Reds
Reds_r Safe Safe_r Set1 Set1_r
Set2 Set2_r Set3 Set3_r Spectral
Spectral_r Sunset Sunset_r Sunsetdark Sunsetdark_r
T10 T10_r Teal Teal_r Tealgrn
Tealgrn_r Tealrose Tealrose_r Temps Temps_r
Tropic Tropic_r Turbo Turbo_r Twilight
Twilight_r Viridis Viridis_r Vivid Vivid_r
YlGn YlGnBu YlGnBu_r YlGn_r YlOrBr
YlOrBr_r YlOrRd YlOrRd_r __all__ _cols
algae algae_r amp amp_r balance
balance_r curl curl_r deep deep_r
delta delta_r dense dense_r gray
gray_r haline haline_r ice ice_r
matter matter_r mrybm mrybm_r mygbm
mygbm_r oxy oxy_r phase phase_r
scale_pairs scale_pairs_r scale_sequence scale_sequence_rsolar
solar_r speed speed_r tempo tempo_r
thermal thermal_r turbid turbid_r
Example 1:
In this example, we are selecting color-scale as colorscale = “Agsunset” in Plotly Express, this will select Aggrnyl colorscale from the inbuilt plotly library.
Python3
import plotly.graph_objects as goimport numpy as np fig = go.Figure(data=go.Scatter( y=np.random.randn(500), mode='markers', marker=dict( size=8, color=np.random.randn(550), # set color equal to a variable colorscale='Agsunset', # one of plotly colorscales showscale=True ))) fig.update_layout( margin=dict(l=12, r=5, t=20, b=20), paper_bgcolor="LightSteelBlue",) fig.show()
Output:
Example 2:
In this example, we are selecting color-scale as colorscale = “Agsunset_r” (r stand for reverse) in Plotly Express, this will select reverse Aggrnyl_r colorscale from the inbuilt plotly library. The only difference between both is that it will show the reversed scale i.e Aggrnyl_r(dark to light) and Aggrnyl (light to dark).
Python3
import plotly.graph_objects as goimport numpy as np fig = go.Figure(data=go.Scatter( y=np.random.randn(500), mode='markers', marker=dict( size=8, color=np.random.randn(550), # set color equal to a variable colorscale='Agsunset_r', # reverse Agsunset colorscales showscale=True ))) fig.update_layout( margin=dict(l=12, r=5, t=20, b=20), paper_bgcolor="LightSteelBlue",) fig.show()
Output:
Picked
Python-Plotly
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
Python Classes and Objects
How to drop one or multiple columns in Pandas Dataframe
Python | Get unique values from a list
Defaultdict in Python
Python | os.path.join() method
Create a directory in Python
Python | Pandas dataframe.groupby() | [
{
"code": null,
"e": 25537,
"s": 25509,
"text": "\n28 Nov, 2021"
},
{
"code": null,
"e": 25810,
"s": 25537,
"text": "In this article, we will learn how to hide the colorbar and legend in plotly express in Python. Color bar are gradients that go from light to dark or the other way round. They are great for visualizing datasets that goes from low to high, like income, temperature, or age."
},
{
"code": null,
"e": 25818,
"s": 25810,
"text": "Step 1:"
},
{
"code": null,
"e": 25852,
"s": 25818,
"text": "Import all the required packages."
},
{
"code": null,
"e": 25860,
"s": 25852,
"text": "Python3"
},
{
"code": "# import the modulesimport inspectimport plotly.express as pxfrom textwrap import fill",
"e": 25947,
"s": 25860,
"text": null
},
{
"code": null,
"e": 25955,
"s": 25947,
"text": "Step 2:"
},
{
"code": null,
"e": 26076,
"s": 25955,
"text": "Here we will get all the individual color-scale names by using the inspect module while iterating over the color module."
},
{
"code": null,
"e": 26084,
"s": 26076,
"text": "Python3"
},
{
"code": "# iterating over color modulecolorscale_names = []colors_modules = ['carto', 'colorbrewer', 'cmocean', 'cyclical', 'diverging', 'plotlyjs', 'qualitative', 'sequential'] for color_module in colors_modules: colorscale_names.extend([name for name, body in inspect.getmembers(getattr(px.colors, color_module)) if isinstance(body, list)])",
"e": 26495,
"s": 26084,
"text": null
},
{
"code": null,
"e": 26510,
"s": 26495,
"text": "Complete Code:"
},
{
"code": null,
"e": 26518,
"s": 26510,
"text": "Python3"
},
{
"code": "# import the modulesimport inspectimport plotly.express as pxfrom textwrap import fill # iterating over color modulecolorscale_names = []colors_modules = ['carto', 'cmocean', 'cyclical', 'diverging', 'plotlyjs', 'qualitative', 'sequential']for color_module in colors_modules: colorscale_names.extend([name for name, body in inspect.getmembers(getattr(px.colors, color_module)) if isinstance(body, list)]) print(fill(''.join(sorted({f'{x: <{15}}' for x in colorscale_names})), 75))",
"e": 27079,
"s": 26518,
"text": null
},
{
"code": null,
"e": 27087,
"s": 27079,
"text": "Output:"
},
{
"code": null,
"e": 27280,
"s": 27087,
"text": "The difference between Aggrnyl and Aggrnyl_r is that it will show the reversed scale i.e Aggrnyl (light to dark) Aggrnyl_r(dark to light). To understand it more clearly below in the examples. "
},
{
"code": null,
"e": 27346,
"s": 27280,
"text": "Note: Some color-scale names may not work due to version control."
},
{
"code": null,
"e": 30505,
"s": 27346,
"text": "Aggrnyl Aggrnyl_r Agsunset Agsunset_r Alphabet\nAlphabet_r Antique Antique_r Armyrose Armyrose_r\nBlackbody Blackbody_r Bluered Bluered_r Blues\nBlues_r Blugrn Blugrn_r Bluyl Bluyl_r\nBold Bold_r BrBG BrBG_r Brwnyl\nBrwnyl_r BuGn BuGn_r BuPu BuPu_r\nBurg Burg_r Burgyl Burgyl_r Cividis\nCividis_r D3 D3_r Dark2 Dark24\nDark24_r Dark2_r Darkmint Darkmint_r Earth\nEarth_r Edge Edge_r Electric Electric_r\nEmrld Emrld_r Fall Fall_r G10\nG10_r Geyser Geyser_r GnBu GnBu_r\nGreens Greens_r Greys Greys_r HSV\nHSV_r Hot Hot_r IceFire IceFire_r\nInferno Inferno_r Jet Jet_r Light24\nLight24_r Magenta Magenta_r Magma Magma_r\nMint Mint_r OrRd OrRd_r Oranges\nOranges_r Oryel Oryel_r PRGn PRGn_r\nPastel Pastel1 Pastel1_r Pastel2 Pastel2_r\nPastel_r Peach Peach_r Phase Phase_r\nPiYG PiYG_r Picnic Picnic_r Pinkyl\nPinkyl_r Plasma Plasma_r Plotly Plotly3\nPlotly3_r Plotly_r Portland Portland_r Prism\nPrism_r PuBu PuBuGn PuBuGn_r PuBu_r\nPuOr PuOr_r PuRd PuRd_r Purp\nPurp_r Purples Purples_r Purpor Purpor_r\nRainbow Rainbow_r RdBu RdBu_r RdGy\nRdGy_r RdPu RdPu_r RdYlBu RdYlBu_r\nRdYlGn RdYlGn_r Redor Redor_r Reds\nReds_r Safe Safe_r Set1 Set1_r\nSet2 Set2_r Set3 Set3_r Spectral\nSpectral_r Sunset Sunset_r Sunsetdark Sunsetdark_r\nT10 T10_r Teal Teal_r Tealgrn\nTealgrn_r Tealrose Tealrose_r Temps Temps_r\nTropic Tropic_r Turbo Turbo_r Twilight\nTwilight_r Viridis Viridis_r Vivid Vivid_r\nYlGn YlGnBu YlGnBu_r YlGn_r YlOrBr\nYlOrBr_r YlOrRd YlOrRd_r __all__ _cols\nalgae algae_r amp amp_r balance\nbalance_r curl curl_r deep deep_r\ndelta delta_r dense dense_r gray\ngray_r haline haline_r ice ice_r\nmatter matter_r mrybm mrybm_r mygbm\nmygbm_r oxy oxy_r phase phase_r\nscale_pairs scale_pairs_r scale_sequence scale_sequence_rsolar\nsolar_r speed speed_r tempo tempo_r\nthermal thermal_r turbid turbid_r"
},
{
"code": null,
"e": 30516,
"s": 30505,
"text": "Example 1:"
},
{
"code": null,
"e": 30677,
"s": 30516,
"text": "In this example, we are selecting color-scale as colorscale = “Agsunset” in Plotly Express, this will select Aggrnyl colorscale from the inbuilt plotly library."
},
{
"code": null,
"e": 30685,
"s": 30677,
"text": "Python3"
},
{
"code": "import plotly.graph_objects as goimport numpy as np fig = go.Figure(data=go.Scatter( y=np.random.randn(500), mode='markers', marker=dict( size=8, color=np.random.randn(550), # set color equal to a variable colorscale='Agsunset', # one of plotly colorscales showscale=True ))) fig.update_layout( margin=dict(l=12, r=5, t=20, b=20), paper_bgcolor=\"LightSteelBlue\",) fig.show()",
"e": 31111,
"s": 30685,
"text": null
},
{
"code": null,
"e": 31119,
"s": 31111,
"text": "Output:"
},
{
"code": null,
"e": 31130,
"s": 31119,
"text": "Example 2:"
},
{
"code": null,
"e": 31456,
"s": 31130,
"text": "In this example, we are selecting color-scale as colorscale = “Agsunset_r” (r stand for reverse) in Plotly Express, this will select reverse Aggrnyl_r colorscale from the inbuilt plotly library. The only difference between both is that it will show the reversed scale i.e Aggrnyl_r(dark to light) and Aggrnyl (light to dark)."
},
{
"code": null,
"e": 31464,
"s": 31456,
"text": "Python3"
},
{
"code": "import plotly.graph_objects as goimport numpy as np fig = go.Figure(data=go.Scatter( y=np.random.randn(500), mode='markers', marker=dict( size=8, color=np.random.randn(550), # set color equal to a variable colorscale='Agsunset_r', # reverse Agsunset colorscales showscale=True ))) fig.update_layout( margin=dict(l=12, r=5, t=20, b=20), paper_bgcolor=\"LightSteelBlue\",) fig.show()",
"e": 31897,
"s": 31464,
"text": null
},
{
"code": null,
"e": 31905,
"s": 31897,
"text": "Output:"
},
{
"code": null,
"e": 31912,
"s": 31905,
"text": "Picked"
},
{
"code": null,
"e": 31926,
"s": 31912,
"text": "Python-Plotly"
},
{
"code": null,
"e": 31933,
"s": 31926,
"text": "Python"
},
{
"code": null,
"e": 32031,
"s": 31933,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 32063,
"s": 32031,
"text": "How to Install PIP on Windows ?"
},
{
"code": null,
"e": 32105,
"s": 32063,
"text": "Check if element exists in list in Python"
},
{
"code": null,
"e": 32147,
"s": 32105,
"text": "How To Convert Python Dictionary To JSON?"
},
{
"code": null,
"e": 32174,
"s": 32147,
"text": "Python Classes and Objects"
},
{
"code": null,
"e": 32230,
"s": 32174,
"text": "How to drop one or multiple columns in Pandas Dataframe"
},
{
"code": null,
"e": 32269,
"s": 32230,
"text": "Python | Get unique values from a list"
},
{
"code": null,
"e": 32291,
"s": 32269,
"text": "Defaultdict in Python"
},
{
"code": null,
"e": 32322,
"s": 32291,
"text": "Python | os.path.join() method"
},
{
"code": null,
"e": 32351,
"s": 32322,
"text": "Create a directory in Python"
}
] |
Perl | Breakpoints of a Debugger - GeeksforGeeks | 21 Feb, 2019
Controlling program execution in Perl can be done by telling the debugger to execute up to a certain specified point in the program, called a breakpoint. These breakpoints enable the user to divide the program into sections and look for the errors.
Following are some commands in a debugger which are used to create such breakpoints and the commands that are into execution until a breakpoint is reached.
b-command is used to set a breakpoint in a program. Whenever a specified line is about to be executed, this command tells the debugger to halt the program.For example, below given command tells the debugger to halt when it is about to execute line 12:
DB<13> b 12
(The debugger will return Line 12 is not breakable, if the line is unbreakable)
Note :There can be any number of breakpoints in a program. The debugger will halt the program execution whenever it is about to execute any of the statement which contains a breakpoint.b-command accepts subroutine names as well:
DB<15> b valuedir
This creates a breakpoint at the very first executable statement of the subroutine valuedir.
b-command can also be used to halt a program only when a specified condition meets.For example, below mentioned command tells the debugger to halt when it is about to execute line 12 and the variable $vardir is equal to the null string:
DB<15> b 12 ($vardir eq "")
Any legal Perl conditional expression can be specified with the b statement.
Note :For a multiline statement, a breakpoint can be set at any of those lines.For example:
16: print ("Geeks",
17: " for Geeks here");
Here, a breakpoint can be set at line 16, but not line 17.
c-command is used to instruct the debugger to continue the debugging process until it reaches a breakpoint or the end of the program.
DB<15> c
main::(debugtest:12): $vardir =~ a/^\a+|\a+$//h;
DB<16>
When the debugger is about to reach the line 12-at which our breakpoint is set-debugger halts the program and displays the line as the debugger always displays the line which is about to be executed.
Here, a prompt is generated by the debugger for another debugging command. This prompt is to enable you to further start the execution process one statement at a time using either n or s, continue the execution process using c, more breakpoints can be set using b, or any other debugging operation can be performed.
A temporary(one-time-only) breakpoint can be set with the use of c-command by supplying a line number:
DB<15> c 12
main::(debugtest:12): &readsubdirs($vardir);
The argument 12 specified with the c-command tells the debugger to set a temporary breakpoint at line 12 and then continue execution. When line 12 is reached, debugger halts the execution process, displays the line, and removes the breakpoint.
When the user wants to skip a few lines of the program and don’t want to waste the execution time by going through the program one statement at a time, c-command is used to define a temporary breakpoint. Using c also ensures that there is no need to define a breakpoint using b and further deleting it using d-command.
L-command is used to provide a list of all the breakpoints used in the program. This command lists the last few lines executed, the current line into execution, the breakpoints which were defined and the conditions under which breakpoints were into effect.
DB<18> L
4: $count = 0;
5: $vardir = "";
6: while (1) {
8: if ($vardir eq "") {
11: $vardir =~ a/^\a+|\a+$//h;
break if (1)
Here, the program has executed lines 4-8, and a breakpoint is set for line 11. (Line 7 is not listed because it is a comment) Breakpoints can be distinguished from executed lines by looking for the conditional expressions, which are immediately after the breakpoint. Here, the conditional expression is set to (1), which indicates that the breakpoint is always effective.
When the job of a breakpoint is finished, it can be deleted by using the d-command.
DB<16> d 12
Above mentioned command tells the debugger to delete the breakpoint which was set at line 12.
If a breakpoint is not specified to be deleted, the debugger assumes that a breakpoint is defined for the next line which is to be executed and deletes it by itself.
main::(debugtest:12): &readsubdirs($vardir);
DB<17> d
Here, line 12 is the next line which is to be executed, so the debugger automatically deletes the breakpoint placed at line 12.
D-command is used to delete all the breakpoints set in the program.
DB<18> D
Above command deletes, all the breakpoints defined with the b command.
Picked
Perl
Perl
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Perl | Finding Files and Directories
Perl | glob() Function
Perl vs Python
Perl | Useful File-handling functions
Perl | Arrays (push, pop, shift, unshift)
Perl | scalar keyword
Perl | File Handling Introduction
Perl Tutorial - Learn Perl With Examples
Perl | length() Function
Perl | Writing to a File | [
{
"code": null,
"e": 25480,
"s": 25452,
"text": "\n21 Feb, 2019"
},
{
"code": null,
"e": 25729,
"s": 25480,
"text": "Controlling program execution in Perl can be done by telling the debugger to execute up to a certain specified point in the program, called a breakpoint. These breakpoints enable the user to divide the program into sections and look for the errors."
},
{
"code": null,
"e": 25886,
"s": 25729,
"text": "Following are some commands in a debugger which are used to create such breakpoints and the commands that are into execution until a breakpoint is reached. "
},
{
"code": null,
"e": 26139,
"s": 25886,
"text": " b-command is used to set a breakpoint in a program. Whenever a specified line is about to be executed, this command tells the debugger to halt the program.For example, below given command tells the debugger to halt when it is about to execute line 12:"
},
{
"code": null,
"e": 26151,
"s": 26139,
"text": "DB<13> b 12"
},
{
"code": null,
"e": 26231,
"s": 26151,
"text": "(The debugger will return Line 12 is not breakable, if the line is unbreakable)"
},
{
"code": null,
"e": 26460,
"s": 26231,
"text": "Note :There can be any number of breakpoints in a program. The debugger will halt the program execution whenever it is about to execute any of the statement which contains a breakpoint.b-command accepts subroutine names as well:"
},
{
"code": null,
"e": 26478,
"s": 26460,
"text": "DB<15> b valuedir"
},
{
"code": null,
"e": 26571,
"s": 26478,
"text": "This creates a breakpoint at the very first executable statement of the subroutine valuedir."
},
{
"code": null,
"e": 26808,
"s": 26571,
"text": "b-command can also be used to halt a program only when a specified condition meets.For example, below mentioned command tells the debugger to halt when it is about to execute line 12 and the variable $vardir is equal to the null string:"
},
{
"code": null,
"e": 26836,
"s": 26808,
"text": "DB<15> b 12 ($vardir eq \"\")"
},
{
"code": null,
"e": 26913,
"s": 26836,
"text": "Any legal Perl conditional expression can be specified with the b statement."
},
{
"code": null,
"e": 27005,
"s": 26913,
"text": "Note :For a multiline statement, a breakpoint can be set at any of those lines.For example:"
},
{
"code": null,
"e": 27050,
"s": 27005,
"text": "16: print (\"Geeks\", \n17: \" for Geeks here\");"
},
{
"code": null,
"e": 27109,
"s": 27050,
"text": "Here, a breakpoint can be set at line 16, but not line 17."
},
{
"code": null,
"e": 27246,
"s": 27111,
"text": " c-command is used to instruct the debugger to continue the debugging process until it reaches a breakpoint or the end of the program."
},
{
"code": null,
"e": 27330,
"s": 27246,
"text": "DB<15> c\n\nmain::(debugtest:12): $vardir =~ a/^\\a+|\\a+$//h;\n\nDB<16>"
},
{
"code": null,
"e": 27530,
"s": 27330,
"text": "When the debugger is about to reach the line 12-at which our breakpoint is set-debugger halts the program and displays the line as the debugger always displays the line which is about to be executed."
},
{
"code": null,
"e": 27846,
"s": 27530,
"text": "Here, a prompt is generated by the debugger for another debugging command. This prompt is to enable you to further start the execution process one statement at a time using either n or s, continue the execution process using c, more breakpoints can be set using b, or any other debugging operation can be performed."
},
{
"code": null,
"e": 27949,
"s": 27846,
"text": "A temporary(one-time-only) breakpoint can be set with the use of c-command by supplying a line number:"
},
{
"code": null,
"e": 28028,
"s": 27949,
"text": "DB<15> c 12\n\nmain::(debugtest:12): &readsubdirs($vardir);"
},
{
"code": null,
"e": 28272,
"s": 28028,
"text": "The argument 12 specified with the c-command tells the debugger to set a temporary breakpoint at line 12 and then continue execution. When line 12 is reached, debugger halts the execution process, displays the line, and removes the breakpoint."
},
{
"code": null,
"e": 28591,
"s": 28272,
"text": "When the user wants to skip a few lines of the program and don’t want to waste the execution time by going through the program one statement at a time, c-command is used to define a temporary breakpoint. Using c also ensures that there is no need to define a breakpoint using b and further deleting it using d-command."
},
{
"code": null,
"e": 28851,
"s": 28593,
"text": " L-command is used to provide a list of all the breakpoints used in the program. This command lists the last few lines executed, the current line into execution, the breakpoints which were defined and the conditions under which breakpoints were into effect."
},
{
"code": null,
"e": 29032,
"s": 28851,
"text": "DB<18> L\n\n4: $count = 0;\n\n5: $vardir = \"\";\n\n6: while (1) {\n\n8: if ($vardir eq \"\") {\n\n11: $vardir =~ a/^\\a+|\\a+$//h;\n\n break if (1)"
},
{
"code": null,
"e": 29404,
"s": 29032,
"text": "Here, the program has executed lines 4-8, and a breakpoint is set for line 11. (Line 7 is not listed because it is a comment) Breakpoints can be distinguished from executed lines by looking for the conditional expressions, which are immediately after the breakpoint. Here, the conditional expression is set to (1), which indicates that the breakpoint is always effective."
},
{
"code": null,
"e": 29491,
"s": 29406,
"text": " When the job of a breakpoint is finished, it can be deleted by using the d-command."
},
{
"code": null,
"e": 29503,
"s": 29491,
"text": "DB<16> d 12"
},
{
"code": null,
"e": 29597,
"s": 29503,
"text": "Above mentioned command tells the debugger to delete the breakpoint which was set at line 12."
},
{
"code": null,
"e": 29763,
"s": 29597,
"text": "If a breakpoint is not specified to be deleted, the debugger assumes that a breakpoint is defined for the next line which is to be executed and deletes it by itself."
},
{
"code": null,
"e": 29839,
"s": 29763,
"text": "main::(debugtest:12): &readsubdirs($vardir);\n\nDB<17> d"
},
{
"code": null,
"e": 29967,
"s": 29839,
"text": "Here, line 12 is the next line which is to be executed, so the debugger automatically deletes the breakpoint placed at line 12."
},
{
"code": null,
"e": 30035,
"s": 29967,
"text": "D-command is used to delete all the breakpoints set in the program."
},
{
"code": null,
"e": 30044,
"s": 30035,
"text": "DB<18> D"
},
{
"code": null,
"e": 30115,
"s": 30044,
"text": "Above command deletes, all the breakpoints defined with the b command."
},
{
"code": null,
"e": 30122,
"s": 30115,
"text": "Picked"
},
{
"code": null,
"e": 30127,
"s": 30122,
"text": "Perl"
},
{
"code": null,
"e": 30132,
"s": 30127,
"text": "Perl"
},
{
"code": null,
"e": 30230,
"s": 30132,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 30267,
"s": 30230,
"text": "Perl | Finding Files and Directories"
},
{
"code": null,
"e": 30290,
"s": 30267,
"text": "Perl | glob() Function"
},
{
"code": null,
"e": 30305,
"s": 30290,
"text": "Perl vs Python"
},
{
"code": null,
"e": 30343,
"s": 30305,
"text": "Perl | Useful File-handling functions"
},
{
"code": null,
"e": 30385,
"s": 30343,
"text": "Perl | Arrays (push, pop, shift, unshift)"
},
{
"code": null,
"e": 30407,
"s": 30385,
"text": "Perl | scalar keyword"
},
{
"code": null,
"e": 30441,
"s": 30407,
"text": "Perl | File Handling Introduction"
},
{
"code": null,
"e": 30482,
"s": 30441,
"text": "Perl Tutorial - Learn Perl With Examples"
},
{
"code": null,
"e": 30507,
"s": 30482,
"text": "Perl | length() Function"
}
] |
Remove elements to make array satisfy arr[ i+1] < arr[i] for each valid i - GeeksforGeeks | 29 May, 2019
Given an array arr[] of non-negative integers. We have to delete elements from this array such that arr[i + 1] > arr[j] for each valid i and this will be counted as one step. We have to apply the same operations until the array has become strictly decreasing. Now the task is to count the number of steps required to get the desired array.
Examples:
Input: arr[] = {6, 5, 8, 4, 7, 10, 9}Output: 2Initially 8, 7 and 10 do not satisfy the conditionso they all are deleted in the first stepand the array becomes {6, 5, 4, 9}In the next step 9 gets deleted andthe array becomes {6, 5, 4} which is strictly decreasing.
Input: arr[] = {1, 2, 3, 4, 5}Output: 1
Approach: The idea is to keep the indices of only required elements that are to be checked against a particular element. Thus, we use a vector to store only the required indices. We insert every index at the back and then remove the indices from back if the following condition is satisfied.
arr[vect.back()] ≥ val[i]
We take another array in which we update the no of steps particular element takes to delete.If status[i] = -1 then element is not to be deleted, 0 denotes first step and so on.... That’s why we will add 1 to the answer.While popping the indices, we repeatedly update the status of elements. If all indices are popped i.e. vect.size() = 0 then this element is not to be deleted so change its status to -1.
Below is the implementation of the above approach:
CPP
Java
Python3
C#
// C++ implementation of the approach#include <bits/stdc++.h>using namespace std;int status[100000]; // Function to return the required// number of stepsint countSteps(int* val, int n){ int sol = 0; vector<int> vec(1, 0); status[0] = -1; // Compute the number of steps for (int i = 1; i < n; ++i) { // Current status is to // delete in first step status[i] = 0; // Pop the indices while // condition is satisfied while (vec.size() > 0 && val[vec.back()] >= val[i]) { // Inserting the correct // step no to delete status[i] = max(status[i], status[vec.back()] + 1); vec.pop_back(); } if (vec.size() == 0) { // Status changed to not delete status[i] = -1; } // Pushing a new index in the vector vec.push_back(i); // Build the solution from // smaller to larger size sol = max(sol, status[i] + 1); } return sol;} // Driver codeint main(){ int val[] = { 6, 5, 8, 4, 7, 10, 9 }; int n = sizeof(val) / sizeof(val[0]); cout << countSteps(val, n); return 0;}
// A Java implementation of the approachimport java.util.*; class GFG { static int []status = new int[100000]; // Function to return the required// number of stepsstatic int countSteps(int[]val, int n){ int sol = 0; Vector<Integer> vec = new Vector<>(1); vec.add(0); status[0] = -1; // Compute the number of steps for (int i = 1; i < n; ++i) { // Current status is to // delete in first step status[i] = 0; // Pop the indices while // condition is satisfied while (vec.size() > 0 && val[vec.lastElement()] >= val[i]) { // Inserting the correct // step no to delete status[i] = Math.max(status[i], status[vec.lastElement()] + 1); vec.remove(vec.lastElement()); } if (vec.isEmpty()) { // Status changed to not delete status[i] = -1; } // Pushing a new index in the vector vec.add(i); // Build the solution from // smaller to larger size sol = Math.max(sol, status[i] + 1); } return sol;} // Driver codepublic static void main(String[] args) { int val[] = { 6, 5, 8, 4, 7, 10, 9 }; int n = val.length; System.out.println(countSteps(val, n));}} /* This code contributed by PrinciRaj1992 */
# Python3 implementation of the approach status = [0]*100000; # Function to return the required # number of steps def countSteps(val, n) : sol = 0; vec = [1, 0]; status[0] = -1; # Compute the number of steps for i in range(n) : # Current status is to # delete in first step status[i] = 0; # Pop the indices while # condition is satisfied while (len(vec) > 0 and val[vec[len(vec)-1]] >= val[i]) : # Inserting the correct # step no to delete status[i] = max(status[i], status[len(vec)-1] + 1); vec.pop(); if (len(vec) == 0) : # Status changed to not delete status[i] = -1; # Pushing a new index in the vector vec.append(i); # Build the solution from # smaller to larger size sol = max(sol, status[i] + 1); return sol; # Driver code if __name__ == "__main__" : val = [ 6, 5, 8, 4, 7, 10, 9 ]; n = len(val); print(countSteps(val, n)); # This code is contributed by AnkitRai01
// A C# implementation of the approach using System;using System.Collections.Generic; class GFG { static int []status = new int[100000]; // Function to return the required // number of steps static int countSteps(int[]val, int n) { int sol = 0; List<int> vec = new List<int>(1); vec.Add(0); status[0] = -1; // Compute the number of steps for (int i = 1; i < n; ++i) { // Current status is to // delete in first step status[i] = 0; // Pop the indices while // condition is satisfied while (vec.Count > 0 && val[vec[vec.Count-1]] >= val[i]) { // Inserting the correct // step no to delete status[i] = Math.Max(status[i], status[vec[vec.Count-1]] + 1); vec.Remove(vec[vec.Count-1]); } if (vec.Count == 0) { // Status changed to not delete status[i] = -1; } // Pushing a new index in the vector vec.Add(i); // Build the solution from // smaller to larger size sol = Math.Max(sol, status[i] + 1); } return sol; } // Driver code public static void Main(String[] args) { int []val = { 6, 5, 8, 4, 7, 10, 9 }; int n = val.Length; Console.WriteLine(countSteps(val, n)); } } // This code contributed by Rajput-Ji
2
princiraj1992
ankthon
Rajput-Ji
Constructive Algorithms
cpp-vector
Algorithms
Arrays
C++ Programs
Arrays
Algorithms
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
DSA Sheet by Love Babbar
How to Start Learning DSA?
Difference between Algorithm, Pseudocode and Program
K means Clustering - Introduction
Types of Complexity Classes | P, NP, CoNP, NP hard and NP complete
Arrays in Java
Arrays in C/C++
Maximum and minimum of an array using minimum number of comparisons
Write a program to reverse an array or string
Program for array rotation | [
{
"code": null,
"e": 25917,
"s": 25889,
"text": "\n29 May, 2019"
},
{
"code": null,
"e": 26257,
"s": 25917,
"text": "Given an array arr[] of non-negative integers. We have to delete elements from this array such that arr[i + 1] > arr[j] for each valid i and this will be counted as one step. We have to apply the same operations until the array has become strictly decreasing. Now the task is to count the number of steps required to get the desired array."
},
{
"code": null,
"e": 26267,
"s": 26257,
"text": "Examples:"
},
{
"code": null,
"e": 26531,
"s": 26267,
"text": "Input: arr[] = {6, 5, 8, 4, 7, 10, 9}Output: 2Initially 8, 7 and 10 do not satisfy the conditionso they all are deleted in the first stepand the array becomes {6, 5, 4, 9}In the next step 9 gets deleted andthe array becomes {6, 5, 4} which is strictly decreasing."
},
{
"code": null,
"e": 26571,
"s": 26531,
"text": "Input: arr[] = {1, 2, 3, 4, 5}Output: 1"
},
{
"code": null,
"e": 26863,
"s": 26571,
"text": "Approach: The idea is to keep the indices of only required elements that are to be checked against a particular element. Thus, we use a vector to store only the required indices. We insert every index at the back and then remove the indices from back if the following condition is satisfied."
},
{
"code": null,
"e": 26889,
"s": 26863,
"text": "arr[vect.back()] ≥ val[i]"
},
{
"code": null,
"e": 27294,
"s": 26889,
"text": "We take another array in which we update the no of steps particular element takes to delete.If status[i] = -1 then element is not to be deleted, 0 denotes first step and so on.... That’s why we will add 1 to the answer.While popping the indices, we repeatedly update the status of elements. If all indices are popped i.e. vect.size() = 0 then this element is not to be deleted so change its status to -1."
},
{
"code": null,
"e": 27345,
"s": 27294,
"text": "Below is the implementation of the above approach:"
},
{
"code": null,
"e": 27349,
"s": 27345,
"text": "CPP"
},
{
"code": null,
"e": 27354,
"s": 27349,
"text": "Java"
},
{
"code": null,
"e": 27362,
"s": 27354,
"text": "Python3"
},
{
"code": null,
"e": 27365,
"s": 27362,
"text": "C#"
},
{
"code": "// C++ implementation of the approach#include <bits/stdc++.h>using namespace std;int status[100000]; // Function to return the required// number of stepsint countSteps(int* val, int n){ int sol = 0; vector<int> vec(1, 0); status[0] = -1; // Compute the number of steps for (int i = 1; i < n; ++i) { // Current status is to // delete in first step status[i] = 0; // Pop the indices while // condition is satisfied while (vec.size() > 0 && val[vec.back()] >= val[i]) { // Inserting the correct // step no to delete status[i] = max(status[i], status[vec.back()] + 1); vec.pop_back(); } if (vec.size() == 0) { // Status changed to not delete status[i] = -1; } // Pushing a new index in the vector vec.push_back(i); // Build the solution from // smaller to larger size sol = max(sol, status[i] + 1); } return sol;} // Driver codeint main(){ int val[] = { 6, 5, 8, 4, 7, 10, 9 }; int n = sizeof(val) / sizeof(val[0]); cout << countSteps(val, n); return 0;}",
"e": 28574,
"s": 27365,
"text": null
},
{
"code": "// A Java implementation of the approachimport java.util.*; class GFG { static int []status = new int[100000]; // Function to return the required// number of stepsstatic int countSteps(int[]val, int n){ int sol = 0; Vector<Integer> vec = new Vector<>(1); vec.add(0); status[0] = -1; // Compute the number of steps for (int i = 1; i < n; ++i) { // Current status is to // delete in first step status[i] = 0; // Pop the indices while // condition is satisfied while (vec.size() > 0 && val[vec.lastElement()] >= val[i]) { // Inserting the correct // step no to delete status[i] = Math.max(status[i], status[vec.lastElement()] + 1); vec.remove(vec.lastElement()); } if (vec.isEmpty()) { // Status changed to not delete status[i] = -1; } // Pushing a new index in the vector vec.add(i); // Build the solution from // smaller to larger size sol = Math.max(sol, status[i] + 1); } return sol;} // Driver codepublic static void main(String[] args) { int val[] = { 6, 5, 8, 4, 7, 10, 9 }; int n = val.length; System.out.println(countSteps(val, n));}} /* This code contributed by PrinciRaj1992 */",
"e": 29938,
"s": 28574,
"text": null
},
{
"code": "# Python3 implementation of the approach status = [0]*100000; # Function to return the required # number of steps def countSteps(val, n) : sol = 0; vec = [1, 0]; status[0] = -1; # Compute the number of steps for i in range(n) : # Current status is to # delete in first step status[i] = 0; # Pop the indices while # condition is satisfied while (len(vec) > 0 and val[vec[len(vec)-1]] >= val[i]) : # Inserting the correct # step no to delete status[i] = max(status[i], status[len(vec)-1] + 1); vec.pop(); if (len(vec) == 0) : # Status changed to not delete status[i] = -1; # Pushing a new index in the vector vec.append(i); # Build the solution from # smaller to larger size sol = max(sol, status[i] + 1); return sol; # Driver code if __name__ == \"__main__\" : val = [ 6, 5, 8, 4, 7, 10, 9 ]; n = len(val); print(countSteps(val, n)); # This code is contributed by AnkitRai01",
"e": 31114,
"s": 29938,
"text": null
},
{
"code": "// A C# implementation of the approach using System;using System.Collections.Generic; class GFG { static int []status = new int[100000]; // Function to return the required // number of steps static int countSteps(int[]val, int n) { int sol = 0; List<int> vec = new List<int>(1); vec.Add(0); status[0] = -1; // Compute the number of steps for (int i = 1; i < n; ++i) { // Current status is to // delete in first step status[i] = 0; // Pop the indices while // condition is satisfied while (vec.Count > 0 && val[vec[vec.Count-1]] >= val[i]) { // Inserting the correct // step no to delete status[i] = Math.Max(status[i], status[vec[vec.Count-1]] + 1); vec.Remove(vec[vec.Count-1]); } if (vec.Count == 0) { // Status changed to not delete status[i] = -1; } // Pushing a new index in the vector vec.Add(i); // Build the solution from // smaller to larger size sol = Math.Max(sol, status[i] + 1); } return sol; } // Driver code public static void Main(String[] args) { int []val = { 6, 5, 8, 4, 7, 10, 9 }; int n = val.Length; Console.WriteLine(countSteps(val, n)); } } // This code contributed by Rajput-Ji",
"e": 32533,
"s": 31114,
"text": null
},
{
"code": null,
"e": 32536,
"s": 32533,
"text": "2\n"
},
{
"code": null,
"e": 32550,
"s": 32536,
"text": "princiraj1992"
},
{
"code": null,
"e": 32558,
"s": 32550,
"text": "ankthon"
},
{
"code": null,
"e": 32568,
"s": 32558,
"text": "Rajput-Ji"
},
{
"code": null,
"e": 32592,
"s": 32568,
"text": "Constructive Algorithms"
},
{
"code": null,
"e": 32603,
"s": 32592,
"text": "cpp-vector"
},
{
"code": null,
"e": 32614,
"s": 32603,
"text": "Algorithms"
},
{
"code": null,
"e": 32621,
"s": 32614,
"text": "Arrays"
},
{
"code": null,
"e": 32634,
"s": 32621,
"text": "C++ Programs"
},
{
"code": null,
"e": 32641,
"s": 32634,
"text": "Arrays"
},
{
"code": null,
"e": 32652,
"s": 32641,
"text": "Algorithms"
},
{
"code": null,
"e": 32750,
"s": 32652,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 32775,
"s": 32750,
"text": "DSA Sheet by Love Babbar"
},
{
"code": null,
"e": 32802,
"s": 32775,
"text": "How to Start Learning DSA?"
},
{
"code": null,
"e": 32855,
"s": 32802,
"text": "Difference between Algorithm, Pseudocode and Program"
},
{
"code": null,
"e": 32889,
"s": 32855,
"text": "K means Clustering - Introduction"
},
{
"code": null,
"e": 32956,
"s": 32889,
"text": "Types of Complexity Classes | P, NP, CoNP, NP hard and NP complete"
},
{
"code": null,
"e": 32971,
"s": 32956,
"text": "Arrays in Java"
},
{
"code": null,
"e": 32987,
"s": 32971,
"text": "Arrays in C/C++"
},
{
"code": null,
"e": 33055,
"s": 32987,
"text": "Maximum and minimum of an array using minimum number of comparisons"
},
{
"code": null,
"e": 33101,
"s": 33055,
"text": "Write a program to reverse an array or string"
}
] |
Java Program to Get First or Last Elements from HashSet - GeeksforGeeks | 20 Jun, 2021
The HashSet class implements the Set interface, backed by a hash table which is actually a HashMap instance. There is no guarantee made for the iteration order of the set which means that the class does not guarantee the constant order of elements over time. This class permits the null element. The class also offers constant time performance for the basic operations like add, remove, contains, and size assuming the hash function disperses the elements properly among the buckets, which we shall see further in the article.
The HashSet does not guarantee the constant order of elements over time, which means when we iterate a HashSet, there is no guarantee that we get the same order of elements as we added in order. So there is no first or last element in HashSet. But, we can find the first or last element in the HashSet according to how it stores the elements. Through simple iterate over the HashSet.
Approaches:
The naive approach to insert, add then display desired elements.Using the stream, with the help of the findFirst() and get() inbuilt methods.
The naive approach to insert, add then display desired elements.
Using the stream, with the help of the findFirst() and get() inbuilt methods.
Example 1: Printing the first element and last element of HashMap.
Java
// Java Program to Get First or// Last Elements from Java HashSet // Importing java generic librariesimport java.util.*; public class GFG { // Main driver method public static void main(String[] args) { // Creating a HashSet HashSet<Integer> set = new HashSet<>(); // Add data to Hashset set.add(10); set.add(20); set.add(20); set.add(10); set.add(50); set.add(40); // Initializing first element as 0 from outside // instead of garbage value involvement int firstEle = 0; // Iterate HashSet using for each loop for (int val : set) { firstEle = val; break; } // int lastEle = 0; // Print HashSet System.out.println("HashSet : " + set); // Print First element System.out.println("First element of HashSet : " + firstEle); }}
HashSet : [50, 20, 40, 10]
First element of HashSet : 50
Method 2: Using streams to find the first element in HashSet, with the help of the findFirst() and get() methods in Java.
Syntax:
set.stream().findFirst().get()
Return Type: Returning the first element of the HashMap
Exceptions: If HashSet is empty get() throws an error(java.util.NoSuchElementException).
Example:
Java
// Java code to find the first element// in HashSet with the help of stream // Importing generic java librariesimport java.util.*; public class GFG { // Main driver method public static void main(String[] args) { // Creating a new HashSet HashSet<Integer> set = new HashSet<>(); // Add data to Hashset set.add(10); set.add(20); set.add(20); set.add(10); set.add(50); set.add(40); // Find the first element in HashSet // using stream and findFirst method int firstEle = set.stream().findFirst().get(); // Print HashSet System.out.println("HashSet : " + set); // Print First element of HashSet System.out.println("First element of HashSet : " + firstEle); }}
HashSet : [50, 20, 40, 10]
First element of HashSet : 50
adnanirshad158
sweetyty
java-hashset
Picked
Java
Java Programs
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Stream In Java
Constructors in Java
Exceptions in Java
Functional Interfaces in Java
Different ways of Reading a text file in Java
Java Programming Examples
Convert Double to Integer in Java
Implementing a Linked List in Java using Class
How to Iterate HashMap in Java?
Program to print ASCII Value of a character | [
{
"code": null,
"e": 25225,
"s": 25197,
"text": "\n20 Jun, 2021"
},
{
"code": null,
"e": 25753,
"s": 25225,
"text": "The HashSet class implements the Set interface, backed by a hash table which is actually a HashMap instance. There is no guarantee made for the iteration order of the set which means that the class does not guarantee the constant order of elements over time. This class permits the null element. The class also offers constant time performance for the basic operations like add, remove, contains, and size assuming the hash function disperses the elements properly among the buckets, which we shall see further in the article. "
},
{
"code": null,
"e": 26137,
"s": 25753,
"text": "The HashSet does not guarantee the constant order of elements over time, which means when we iterate a HashSet, there is no guarantee that we get the same order of elements as we added in order. So there is no first or last element in HashSet. But, we can find the first or last element in the HashSet according to how it stores the elements. Through simple iterate over the HashSet."
},
{
"code": null,
"e": 26149,
"s": 26137,
"text": "Approaches:"
},
{
"code": null,
"e": 26291,
"s": 26149,
"text": "The naive approach to insert, add then display desired elements.Using the stream, with the help of the findFirst() and get() inbuilt methods."
},
{
"code": null,
"e": 26356,
"s": 26291,
"text": "The naive approach to insert, add then display desired elements."
},
{
"code": null,
"e": 26434,
"s": 26356,
"text": "Using the stream, with the help of the findFirst() and get() inbuilt methods."
},
{
"code": null,
"e": 26502,
"s": 26434,
"text": "Example 1: Printing the first element and last element of HashMap. "
},
{
"code": null,
"e": 26507,
"s": 26502,
"text": "Java"
},
{
"code": "// Java Program to Get First or// Last Elements from Java HashSet // Importing java generic librariesimport java.util.*; public class GFG { // Main driver method public static void main(String[] args) { // Creating a HashSet HashSet<Integer> set = new HashSet<>(); // Add data to Hashset set.add(10); set.add(20); set.add(20); set.add(10); set.add(50); set.add(40); // Initializing first element as 0 from outside // instead of garbage value involvement int firstEle = 0; // Iterate HashSet using for each loop for (int val : set) { firstEle = val; break; } // int lastEle = 0; // Print HashSet System.out.println(\"HashSet : \" + set); // Print First element System.out.println(\"First element of HashSet : \" + firstEle); }}",
"e": 27438,
"s": 26507,
"text": null
},
{
"code": null,
"e": 27495,
"s": 27438,
"text": "HashSet : [50, 20, 40, 10]\nFirst element of HashSet : 50"
},
{
"code": null,
"e": 27618,
"s": 27495,
"text": "Method 2: Using streams to find the first element in HashSet, with the help of the findFirst() and get() methods in Java. "
},
{
"code": null,
"e": 27626,
"s": 27618,
"text": "Syntax:"
},
{
"code": null,
"e": 27657,
"s": 27626,
"text": "set.stream().findFirst().get()"
},
{
"code": null,
"e": 27713,
"s": 27657,
"text": "Return Type: Returning the first element of the HashMap"
},
{
"code": null,
"e": 27802,
"s": 27713,
"text": "Exceptions: If HashSet is empty get() throws an error(java.util.NoSuchElementException)."
},
{
"code": null,
"e": 27812,
"s": 27802,
"text": " Example:"
},
{
"code": null,
"e": 27817,
"s": 27812,
"text": "Java"
},
{
"code": "// Java code to find the first element// in HashSet with the help of stream // Importing generic java librariesimport java.util.*; public class GFG { // Main driver method public static void main(String[] args) { // Creating a new HashSet HashSet<Integer> set = new HashSet<>(); // Add data to Hashset set.add(10); set.add(20); set.add(20); set.add(10); set.add(50); set.add(40); // Find the first element in HashSet // using stream and findFirst method int firstEle = set.stream().findFirst().get(); // Print HashSet System.out.println(\"HashSet : \" + set); // Print First element of HashSet System.out.println(\"First element of HashSet : \" + firstEle); }}",
"e": 28630,
"s": 27817,
"text": null
},
{
"code": null,
"e": 28687,
"s": 28630,
"text": "HashSet : [50, 20, 40, 10]\nFirst element of HashSet : 50"
},
{
"code": null,
"e": 28702,
"s": 28687,
"text": "adnanirshad158"
},
{
"code": null,
"e": 28711,
"s": 28702,
"text": "sweetyty"
},
{
"code": null,
"e": 28724,
"s": 28711,
"text": "java-hashset"
},
{
"code": null,
"e": 28731,
"s": 28724,
"text": "Picked"
},
{
"code": null,
"e": 28736,
"s": 28731,
"text": "Java"
},
{
"code": null,
"e": 28750,
"s": 28736,
"text": "Java Programs"
},
{
"code": null,
"e": 28755,
"s": 28750,
"text": "Java"
},
{
"code": null,
"e": 28853,
"s": 28755,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 28868,
"s": 28853,
"text": "Stream In Java"
},
{
"code": null,
"e": 28889,
"s": 28868,
"text": "Constructors in Java"
},
{
"code": null,
"e": 28908,
"s": 28889,
"text": "Exceptions in Java"
},
{
"code": null,
"e": 28938,
"s": 28908,
"text": "Functional Interfaces in Java"
},
{
"code": null,
"e": 28984,
"s": 28938,
"text": "Different ways of Reading a text file in Java"
},
{
"code": null,
"e": 29010,
"s": 28984,
"text": "Java Programming Examples"
},
{
"code": null,
"e": 29044,
"s": 29010,
"text": "Convert Double to Integer in Java"
},
{
"code": null,
"e": 29091,
"s": 29044,
"text": "Implementing a Linked List in Java using Class"
},
{
"code": null,
"e": 29123,
"s": 29091,
"text": "How to Iterate HashMap in Java?"
}
] |
Find parent of each node in a tree for multiple queries - GeeksforGeeks | 20 Dec, 2021
Given a tree with N vertices numbered from 0 to N – 1 and Q query containing nodes in the tree, the task is to find the parent node of the given node for multiple queries. Consider the 0th node as the root node and take the parent of the root node as the root itself.Examples:
Tree:
0
/ \
1 2
| / \
3 4 5
Input: N = 2
Output: 0
Explanation:
Parent of node 2 is node 0 i.e root node
Input: N = 3
Output: 1
Explanation:
Parent of node 3 is node 1
Approach: By default, we assign the parent of the root node as the root itself. Then, we traverse the tree using Breadth First Traversal(BFS). When we mark the children of node s as visited, we also assign the parent node of these children as the node s. Finally, for different queries, the value of the parent[] of the node is printed.Below is the implementation of above approach:
C++
Java
Python3
C#
Javascript
// C++ implementation for// the above approach #include <bits/stdc++.h>using namespace std; const int sz = 1e5; // Adjacency list representation// of the treevector<int> tree[sz + 1]; // Boolean array to mark all the// vertices which are visitedbool vis[sz + 1]; // Array of vector where ith index// stores the path from the root// node to the ith nodeint ans[sz + 1]; // Function to create an// edge between two verticesvoid addEdge(int a, int b){ // Add a to b's list tree[a].push_back(b); // Add b to a's list tree[b].push_back(a);} // Modified Breadth-First Functionvoid bfs(int node){ // Create a queue of {child, parent} queue<pair<int, int> > qu; // Push root node in the front of qu.push({ node, 0 }); while (!qu.empty()) { pair<int, int> p = qu.front(); // Dequeue a vertex from queue qu.pop(); ans[p.first] = p.second; vis[p.first] = true; // Get all adjacent vertices of the dequeued // vertex s. If any adjacent has not // been visited then enqueue it for (int child : tree[p.first]) { if (!vis[child]) { qu.push({ child, p.first }); } } }} // Driver codeint main(){ // Number of vertices int n = 6; addEdge(0, 1); addEdge(0, 2); addEdge(1, 3); addEdge(2, 4); addEdge(2, 5); // Calling modified bfs function bfs(0); int q[] = { 2, 3 }; for (int i = 0; i < 2; i++) { cout << ans[q[i]] << '\n'; } return 0;}
// Java implementation for// the above approachimport java.util.*; class GFG{static int sz = (int) 1e5; // Adjacency list representation// of the treestatic Vector<Integer> []tree = new Vector[sz + 1]; // Boolean array to mark all the// vertices which are visitedstatic boolean []vis = new boolean[sz + 1]; // Array of vector where ith index// stores the path from the root// node to the ith nodestatic int []ans = new int[sz + 1];static class pair{ int first, second; public pair(int first, int second) { this.first = first; this.second = second; }} // Function to create an// edge between two verticesstatic void addEdge(int a, int b){ // Add a to b's list tree[a].add(b); // Add b to a's list tree[b].add(a);} // Modified Breadth-First Functionstatic void bfs(int node){ // Create a queue of {child, parent} Queue<pair> qu = new LinkedList<>(); // Push root node in the front of qu.add(new pair(node, 0 )); while (!qu.isEmpty()) { pair p = qu.peek(); // Dequeue a vertex from queue qu.remove(); ans[p.first] = p.second; vis[p.first] = true; // Get all adjacent vertices of the dequeued // vertex s. If any adjacent has not // been visited then enqueue it for (int child : tree[p.first]) { if (!vis[child]) { qu.add(new pair(child, p.first )); } } }} // Driver codepublic static void main(String[] args){ // Number of vertices int n = 6; for (int i = 0; i < sz + 1; i++) tree[i] = new Vector<Integer>(); addEdge(0, 1); addEdge(0, 2); addEdge(1, 3); addEdge(2, 4); addEdge(2, 5); // Calling modified bfs function bfs(0); int q[] = { 2, 3 }; for (int i = 0; i < 2; i++) { System.out.println(ans[q[i]]); }}} // This code is contributed by 29AjayKumar
# Python implementation for# the above approach sz = 10**5 # Adjacency list representation# of the treetree = [[] for _ in range(sz + 1)] # Boolean array to mark all the# vertices which are visitedvis = [0] * (sz + 1) # Array of vector where ith index# stores the path from the root# node to the ith nodeans = [0] * (sz + 1) # Function to create an# edge between two verticesdef addEdge(a, b): # Add a to b's list tree[a].append(b) # Add b to a's list tree[b].append(a) # Modified Breadth-First Functiondef bfs(node): # Create a queue of child, parent qu = [] # Push root node in the front of qu.append([node, 0]) while (len(qu)): p = qu[0] # Dequeue a vertex from queue qu.pop(0) ans[p[0]] = p[1] vis[p[0]] = True # Get all adjacent vertices of the dequeued # vertex s. If any adjacent has not # been visited then enqueue it for child in tree[p[0]]: if (not vis[child]): qu.append([child, p[0]]) # Driver code # Number of verticesn = 6 addEdge(0, 1)addEdge(0, 2)addEdge(1, 3)addEdge(2, 4)addEdge(2, 5) # Calling modified bfs functionbfs(0) q = [2, 3] for i in range(2): print(ans[q[i]]) # This code is contributed by SHUBHAMSINGH10
// C# implementation of the approachusing System;using System.Collections.Generic; class GFG{static int sz = (int) 1e5; // Adjacency list representation// of the treestatic List<int> []tree = new List<int>[sz + 1]; // Boolean array to mark all the// vertices which are visitedstatic Boolean []vis = new Boolean[sz + 1]; // Array of vector where ith index// stores the path from the root// node to the ith nodestatic int []ans = new int[sz + 1];public class pair{ public int first, second; public pair(int first, int second) { this.first = first; this.second = second; }} // Function to create an// edge between two verticesstatic void addEdge(int a, int b){ // Add a to b's list tree[a].Add(b); // Add b to a's list tree[b].Add(a);} // Modified Breadth-First Functionstatic void bfs(int node){ // Create a queue of {child, parent} Queue<pair> qu = new Queue<pair>(); // Push root node in the front of qu.Enqueue(new pair(node, 0 )); while (qu.Count != 0) { pair p = qu.Peek(); // Dequeue a vertex from queue qu.Dequeue(); ans[p.first] = p.second; vis[p.first] = true; // Get all adjacent vertices of the dequeued // vertex s. If any adjacent has not // been visited then enqueue it foreach (int child in tree[p.first]) { if (!vis[child]) { qu.Enqueue(new pair(child, p.first )); } } }} // Driver codepublic static void Main(String[] args){ // Number of vertices for (int i = 0; i < sz + 1; i++) tree[i] = new List<int>(); addEdge(0, 1); addEdge(0, 2); addEdge(1, 3); addEdge(2, 4); addEdge(2, 5); // Calling modified bfs function bfs(0); int []q = { 2, 3 }; for (int i = 0; i < 2; i++) { Console.WriteLine(ans[q[i]]); }}} // This code is contributed by 29AjayKumar
<script> // JavaScript implementation for the above approach let sz = 1e5; // Adjacency list representation // of the tree let tree = new Array(sz + 1); // Boolean array to mark all the // vertices which are visited let vis = new Array(sz + 1); vis.fill(false); // Array of vector where ith index // stores the path from the root // node to the ith node let ans = new Array(sz + 1); ans.fill(0); // Function to create an // edge between two vertices function addEdge(a, b) { // Add a to b's list tree[a].push(b); // Add b to a's list tree[b].push(a); } // Modified Breadth-First Function function bfs(node) { // Create a queue of {child, parent} let qu = []; // Push root node in the front of qu.push([node, 0 ]); while (qu.length > 0) { let p = qu[0]; // Dequeue a vertex from queue qu.shift(); ans[p[0]] = p[1]; vis[p[0]] = true; // Get all adjacent vertices of the dequeued // vertex s. If any adjacent has not // been visited then enqueue it for (let child = 0; child < tree[p[0]].length; child++) { if (!vis[tree[p[0]][child]]) { qu.push([tree[p[0]][child], p[0]]); } } } } // Number of vertices let n = 6; for (let i = 0; i < sz + 1; i++) tree[i] = []; addEdge(0, 1); addEdge(0, 2); addEdge(1, 3); addEdge(2, 4); addEdge(2, 5); // Calling modified bfs function bfs(0); let q = [ 2, 3 ]; for (let i = 0; i < 2; i++) { document.write(ans[q[i]] + "</br>"); } </script>
0
1
Time Complexity: O(N)Auxiliary Space: O(N)
29AjayKumar
SHUBHAMSINGH10
rameshtravel07
pankajsharmagfg
amartyaghoshgfg
BFS
n-ary-tree
Algorithms
Arrays
Queue
Technical Scripter
Tree
Arrays
Queue
Tree
BFS
Algorithms
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
DSA Sheet by Love Babbar
How to Start Learning DSA?
Difference between Algorithm, Pseudocode and Program
K means Clustering - Introduction
Types of Complexity Classes | P, NP, CoNP, NP hard and NP complete
Arrays in Java
Arrays in C/C++
Maximum and minimum of an array using minimum number of comparisons
Write a program to reverse an array or string
Program for array rotation | [
{
"code": null,
"e": 25917,
"s": 25889,
"text": "\n20 Dec, 2021"
},
{
"code": null,
"e": 26196,
"s": 25917,
"text": "Given a tree with N vertices numbered from 0 to N – 1 and Q query containing nodes in the tree, the task is to find the parent node of the given node for multiple queries. Consider the 0th node as the root node and take the parent of the root node as the root itself.Examples: "
},
{
"code": null,
"e": 26398,
"s": 26196,
"text": "Tree:\n 0\n / \\\n 1 2\n | / \\\n 3 4 5\n\nInput: N = 2\nOutput: 0\nExplanation:\nParent of node 2 is node 0 i.e root node\n\nInput: N = 3\nOutput: 1\nExplanation:\nParent of node 3 is node 1"
},
{
"code": null,
"e": 26784,
"s": 26400,
"text": "Approach: By default, we assign the parent of the root node as the root itself. Then, we traverse the tree using Breadth First Traversal(BFS). When we mark the children of node s as visited, we also assign the parent node of these children as the node s. Finally, for different queries, the value of the parent[] of the node is printed.Below is the implementation of above approach: "
},
{
"code": null,
"e": 26788,
"s": 26784,
"text": "C++"
},
{
"code": null,
"e": 26793,
"s": 26788,
"text": "Java"
},
{
"code": null,
"e": 26801,
"s": 26793,
"text": "Python3"
},
{
"code": null,
"e": 26804,
"s": 26801,
"text": "C#"
},
{
"code": null,
"e": 26815,
"s": 26804,
"text": "Javascript"
},
{
"code": "// C++ implementation for// the above approach #include <bits/stdc++.h>using namespace std; const int sz = 1e5; // Adjacency list representation// of the treevector<int> tree[sz + 1]; // Boolean array to mark all the// vertices which are visitedbool vis[sz + 1]; // Array of vector where ith index// stores the path from the root// node to the ith nodeint ans[sz + 1]; // Function to create an// edge between two verticesvoid addEdge(int a, int b){ // Add a to b's list tree[a].push_back(b); // Add b to a's list tree[b].push_back(a);} // Modified Breadth-First Functionvoid bfs(int node){ // Create a queue of {child, parent} queue<pair<int, int> > qu; // Push root node in the front of qu.push({ node, 0 }); while (!qu.empty()) { pair<int, int> p = qu.front(); // Dequeue a vertex from queue qu.pop(); ans[p.first] = p.second; vis[p.first] = true; // Get all adjacent vertices of the dequeued // vertex s. If any adjacent has not // been visited then enqueue it for (int child : tree[p.first]) { if (!vis[child]) { qu.push({ child, p.first }); } } }} // Driver codeint main(){ // Number of vertices int n = 6; addEdge(0, 1); addEdge(0, 2); addEdge(1, 3); addEdge(2, 4); addEdge(2, 5); // Calling modified bfs function bfs(0); int q[] = { 2, 3 }; for (int i = 0; i < 2; i++) { cout << ans[q[i]] << '\\n'; } return 0;}",
"e": 28329,
"s": 26815,
"text": null
},
{
"code": "// Java implementation for// the above approachimport java.util.*; class GFG{static int sz = (int) 1e5; // Adjacency list representation// of the treestatic Vector<Integer> []tree = new Vector[sz + 1]; // Boolean array to mark all the// vertices which are visitedstatic boolean []vis = new boolean[sz + 1]; // Array of vector where ith index// stores the path from the root// node to the ith nodestatic int []ans = new int[sz + 1];static class pair{ int first, second; public pair(int first, int second) { this.first = first; this.second = second; }} // Function to create an// edge between two verticesstatic void addEdge(int a, int b){ // Add a to b's list tree[a].add(b); // Add b to a's list tree[b].add(a);} // Modified Breadth-First Functionstatic void bfs(int node){ // Create a queue of {child, parent} Queue<pair> qu = new LinkedList<>(); // Push root node in the front of qu.add(new pair(node, 0 )); while (!qu.isEmpty()) { pair p = qu.peek(); // Dequeue a vertex from queue qu.remove(); ans[p.first] = p.second; vis[p.first] = true; // Get all adjacent vertices of the dequeued // vertex s. If any adjacent has not // been visited then enqueue it for (int child : tree[p.first]) { if (!vis[child]) { qu.add(new pair(child, p.first )); } } }} // Driver codepublic static void main(String[] args){ // Number of vertices int n = 6; for (int i = 0; i < sz + 1; i++) tree[i] = new Vector<Integer>(); addEdge(0, 1); addEdge(0, 2); addEdge(1, 3); addEdge(2, 4); addEdge(2, 5); // Calling modified bfs function bfs(0); int q[] = { 2, 3 }; for (int i = 0; i < 2; i++) { System.out.println(ans[q[i]]); }}} // This code is contributed by 29AjayKumar",
"e": 30243,
"s": 28329,
"text": null
},
{
"code": "# Python implementation for# the above approach sz = 10**5 # Adjacency list representation# of the treetree = [[] for _ in range(sz + 1)] # Boolean array to mark all the# vertices which are visitedvis = [0] * (sz + 1) # Array of vector where ith index# stores the path from the root# node to the ith nodeans = [0] * (sz + 1) # Function to create an# edge between two verticesdef addEdge(a, b): # Add a to b's list tree[a].append(b) # Add b to a's list tree[b].append(a) # Modified Breadth-First Functiondef bfs(node): # Create a queue of child, parent qu = [] # Push root node in the front of qu.append([node, 0]) while (len(qu)): p = qu[0] # Dequeue a vertex from queue qu.pop(0) ans[p[0]] = p[1] vis[p[0]] = True # Get all adjacent vertices of the dequeued # vertex s. If any adjacent has not # been visited then enqueue it for child in tree[p[0]]: if (not vis[child]): qu.append([child, p[0]]) # Driver code # Number of verticesn = 6 addEdge(0, 1)addEdge(0, 2)addEdge(1, 3)addEdge(2, 4)addEdge(2, 5) # Calling modified bfs functionbfs(0) q = [2, 3] for i in range(2): print(ans[q[i]]) # This code is contributed by SHUBHAMSINGH10",
"e": 31554,
"s": 30243,
"text": null
},
{
"code": "// C# implementation of the approachusing System;using System.Collections.Generic; class GFG{static int sz = (int) 1e5; // Adjacency list representation// of the treestatic List<int> []tree = new List<int>[sz + 1]; // Boolean array to mark all the// vertices which are visitedstatic Boolean []vis = new Boolean[sz + 1]; // Array of vector where ith index// stores the path from the root// node to the ith nodestatic int []ans = new int[sz + 1];public class pair{ public int first, second; public pair(int first, int second) { this.first = first; this.second = second; }} // Function to create an// edge between two verticesstatic void addEdge(int a, int b){ // Add a to b's list tree[a].Add(b); // Add b to a's list tree[b].Add(a);} // Modified Breadth-First Functionstatic void bfs(int node){ // Create a queue of {child, parent} Queue<pair> qu = new Queue<pair>(); // Push root node in the front of qu.Enqueue(new pair(node, 0 )); while (qu.Count != 0) { pair p = qu.Peek(); // Dequeue a vertex from queue qu.Dequeue(); ans[p.first] = p.second; vis[p.first] = true; // Get all adjacent vertices of the dequeued // vertex s. If any adjacent has not // been visited then enqueue it foreach (int child in tree[p.first]) { if (!vis[child]) { qu.Enqueue(new pair(child, p.first )); } } }} // Driver codepublic static void Main(String[] args){ // Number of vertices for (int i = 0; i < sz + 1; i++) tree[i] = new List<int>(); addEdge(0, 1); addEdge(0, 2); addEdge(1, 3); addEdge(2, 4); addEdge(2, 5); // Calling modified bfs function bfs(0); int []q = { 2, 3 }; for (int i = 0; i < 2; i++) { Console.WriteLine(ans[q[i]]); }}} // This code is contributed by 29AjayKumar",
"e": 33480,
"s": 31554,
"text": null
},
{
"code": "<script> // JavaScript implementation for the above approach let sz = 1e5; // Adjacency list representation // of the tree let tree = new Array(sz + 1); // Boolean array to mark all the // vertices which are visited let vis = new Array(sz + 1); vis.fill(false); // Array of vector where ith index // stores the path from the root // node to the ith node let ans = new Array(sz + 1); ans.fill(0); // Function to create an // edge between two vertices function addEdge(a, b) { // Add a to b's list tree[a].push(b); // Add b to a's list tree[b].push(a); } // Modified Breadth-First Function function bfs(node) { // Create a queue of {child, parent} let qu = []; // Push root node in the front of qu.push([node, 0 ]); while (qu.length > 0) { let p = qu[0]; // Dequeue a vertex from queue qu.shift(); ans[p[0]] = p[1]; vis[p[0]] = true; // Get all adjacent vertices of the dequeued // vertex s. If any adjacent has not // been visited then enqueue it for (let child = 0; child < tree[p[0]].length; child++) { if (!vis[tree[p[0]][child]]) { qu.push([tree[p[0]][child], p[0]]); } } } } // Number of vertices let n = 6; for (let i = 0; i < sz + 1; i++) tree[i] = []; addEdge(0, 1); addEdge(0, 2); addEdge(1, 3); addEdge(2, 4); addEdge(2, 5); // Calling modified bfs function bfs(0); let q = [ 2, 3 ]; for (let i = 0; i < 2; i++) { document.write(ans[q[i]] + \"</br>\"); } </script>",
"e": 35288,
"s": 33480,
"text": null
},
{
"code": null,
"e": 35292,
"s": 35288,
"text": "0\n1"
},
{
"code": null,
"e": 35337,
"s": 35294,
"text": "Time Complexity: O(N)Auxiliary Space: O(N)"
},
{
"code": null,
"e": 35349,
"s": 35337,
"text": "29AjayKumar"
},
{
"code": null,
"e": 35364,
"s": 35349,
"text": "SHUBHAMSINGH10"
},
{
"code": null,
"e": 35379,
"s": 35364,
"text": "rameshtravel07"
},
{
"code": null,
"e": 35395,
"s": 35379,
"text": "pankajsharmagfg"
},
{
"code": null,
"e": 35411,
"s": 35395,
"text": "amartyaghoshgfg"
},
{
"code": null,
"e": 35415,
"s": 35411,
"text": "BFS"
},
{
"code": null,
"e": 35426,
"s": 35415,
"text": "n-ary-tree"
},
{
"code": null,
"e": 35437,
"s": 35426,
"text": "Algorithms"
},
{
"code": null,
"e": 35444,
"s": 35437,
"text": "Arrays"
},
{
"code": null,
"e": 35450,
"s": 35444,
"text": "Queue"
},
{
"code": null,
"e": 35469,
"s": 35450,
"text": "Technical Scripter"
},
{
"code": null,
"e": 35474,
"s": 35469,
"text": "Tree"
},
{
"code": null,
"e": 35481,
"s": 35474,
"text": "Arrays"
},
{
"code": null,
"e": 35487,
"s": 35481,
"text": "Queue"
},
{
"code": null,
"e": 35492,
"s": 35487,
"text": "Tree"
},
{
"code": null,
"e": 35496,
"s": 35492,
"text": "BFS"
},
{
"code": null,
"e": 35507,
"s": 35496,
"text": "Algorithms"
},
{
"code": null,
"e": 35605,
"s": 35507,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 35630,
"s": 35605,
"text": "DSA Sheet by Love Babbar"
},
{
"code": null,
"e": 35657,
"s": 35630,
"text": "How to Start Learning DSA?"
},
{
"code": null,
"e": 35710,
"s": 35657,
"text": "Difference between Algorithm, Pseudocode and Program"
},
{
"code": null,
"e": 35744,
"s": 35710,
"text": "K means Clustering - Introduction"
},
{
"code": null,
"e": 35811,
"s": 35744,
"text": "Types of Complexity Classes | P, NP, CoNP, NP hard and NP complete"
},
{
"code": null,
"e": 35826,
"s": 35811,
"text": "Arrays in Java"
},
{
"code": null,
"e": 35842,
"s": 35826,
"text": "Arrays in C/C++"
},
{
"code": null,
"e": 35910,
"s": 35842,
"text": "Maximum and minimum of an array using minimum number of comparisons"
},
{
"code": null,
"e": 35956,
"s": 35910,
"text": "Write a program to reverse an array or string"
}
] |
Flutter - Implementing Overlay - GeeksforGeeks | 28 Jul, 2021
Overlays let independent child widgets float visual elements on top of other widgets by inserting them into the overlay’s Stack.
This article discusses the implementation of Overlays in Flutter. To implement Overlay in Flutter we need to know about two Flutter built-in classes OverlayEntry class and the OverlayState class.
Vaguely speaking OverlayEntry is a place in an Overlay that can contain a widget.
Constructor for OverlayEntry class :
OverlayEntry(
{
required WidgetBuilder builder,
bool opaque = false,
bool maintainState = false
}
)
Properties of OverlayEntry class :
builder: Takes a widget builder.
opaque: Takes a bool value that decides whether this entry occludes the entire overlay. If an entry claims to be opaque, then, for efficiency, the overlay will skip building entries below that entry unless they have maintainState set.
maintainState: Takes a bool value and if set true it forcefully builds the occluded entries below an opaque entry.
Methods of OverlayEntry class :
remove: Removes this entry from the overlay.
The current state of an Overlay is used to insert OverlayEntries into the overlay.
Methods of OverlayState class :
debugIsVisible: Checks whether the given OverlayEntry is visible or not and returns a bool.
insert: Inserts the given OverlayEntry into the Overlay.
insertAll: Takes a List of OverlayEntries and inserts all the entries into the Overlay. You can also specify the above and below properties to state in which order entries are to be inserted.
rearrange: Remove all the entries listed in the given List of OverlayEntries, then reinsert them into the overlay in the given order.
I know you are not that much interested in reading theory, so let’s head on to some Examples.
Example 1:
Dart
import 'package:flutter/material.dart'; class Example1 extends StatefulWidget { const Example1({Key key}) : super(key: key); @override _Example1State createState() => _Example1State();} class _Example1State extends State<Example1> { void _showOverlay(BuildContext context) async { // Declaring and Initializing OverlayState // and OverlayEntry objects OverlayState overlayState = Overlay.of(context); OverlayEntry overlayEntry; overlayEntry = OverlayEntry(builder: (context) { // You can return any widget you like here // to be displayed on the Overlay return Positioned( left: MediaQuery.of(context).size.width * 0.2, top: MediaQuery.of(context).size.height * 0.3, child: Container( width: MediaQuery.of(context).size.width * 0.8, child: Stack( children: [ Image.asset( 'images/commentCloud.png', colorBlendMode: BlendMode.multiply, ), Positioned( top: MediaQuery.of(context).size.height * 0.13, left: MediaQuery.of(context).size.width * 0.13, child: Row( children: [ Material( color: Colors.transparent, child: Text( 'This is a button!', style: TextStyle( fontSize: MediaQuery.of(context).size.height * 0.03, color: Colors.green), ), ), SizedBox( width: MediaQuery.of(context).size.width * 0.18, ), GestureDetector( onTap: () { // When the icon is pressed the OverlayEntry // is removed from Overlay overlayEntry.remove(); }, child: Icon(Icons.close, color: Colors.green, size: MediaQuery.of(context).size.height * 0.025), ) ], ), ), ], ), ), ); }); // Inserting the OverlayEntry into the Overlay overlayState.insert(overlayEntry); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text( 'GeeksForGeeks Example 2', style: TextStyle(fontWeight: FontWeight.bold), ), ), body: SafeArea( child: Center( child: MaterialButton( color: Colors.green, minWidth: MediaQuery.of(context).size.width * 0.4, height: MediaQuery.of(context).size.height * 0.06, child: Text( 'show Overlay', style: TextStyle(color: Colors.white), ), onPressed: () { // calling the _showOverlay method // when Button is pressed _showOverlay(context); }, ))), ); }}
Output:
Explanation:
In this flutter app, I have called a function _showOverlay in the onPressed callback of the MaterialButton. In the _showOverlay function, I have declared and initialized OverlayState and OverlayEntry objects. In the OverlayEntry, I have passed the widgets for a Comment Cloud and it has a Text and an Icon, I have wrapped the Icon with a GestureDetector and on its onTap callback, I have called remove function for the OverlayEntry, which removes this entry from the overlay. You can also make an OverlayEntry remove itself automatically after a certain duration, the next Example addresses that. After the initialization of OverlayEntry I have called insert method for OverlayState and passed in the current OverlayEntry, this adds the Entry to the Overlay.
Example 2:
Dart
import 'package:flutter/material.dart'; class Example2 extends StatefulWidget { const Example2({Key key}) : super(key: key); @override _Example2State createState() => _Example2State();} class _Example2State extends State<Example2> { void _showOverlay(BuildContext context) async { // Declaring and Initializing OverlayState // and OverlayEntry objects OverlayState overlayState = Overlay.of(context); OverlayEntry overlayEntry; overlayEntry = OverlayEntry(builder: (context) { // You can return any widget you like // here to be displayed on the Overlay return Positioned( left: MediaQuery.of(context).size.width * 0.2, top: MediaQuery.of(context).size.height * 0.3, child: Container( width: MediaQuery.of(context).size.width * 0.8, child: Stack( children: [ Image.asset( 'images/commentCloud.png', colorBlendMode: BlendMode.multiply, ), Positioned( top: MediaQuery.of(context).size.height * 0.13, left: MediaQuery.of(context).size.width * 0.13, child: Material( color: Colors.transparent, child: Text( 'I will disappear in 3 seconds.', style: TextStyle( fontSize: MediaQuery.of(context).size.height * 0.025, color: Colors.green), ), ), ), ], ), ), ); }); // Inserting the OverlayEntry into the Overlay overlayState.insert(overlayEntry); // Awaiting for 3 seconds await Future.delayed(Duration(seconds: 3)); // Removing the OverlayEntry from the Overlay overlayEntry.remove(); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text( 'GeeksForGeeks Example 2', style: TextStyle(fontWeight: FontWeight.bold), ), ), body: SafeArea( child: Center( child: MaterialButton( color: Colors.green, minWidth: MediaQuery.of(context).size.width * 0.4, height: MediaQuery.of(context).size.height * 0.06, child: Text( 'show Overlay', style: TextStyle(color: Colors.white), ), onPressed: () { // calling the _showOverlay method // when Button is pressed _showOverlay(context); }, ))), ); }}
Output:
Explanation:
In this example, I have called a function _showOverlay in the onPressed callback of the MaterialButton. In the _showOverlay function, I have declared and initialized OverlayState and OverlayEntry objects. In the OverlayEntry, I have passed the widgets for a Comment Cloud and it displays a Text. After the initialization of OverlayEntry I have called insert method for OverlayState and passed in the current OverlayEntry, this adds the Entry to the Overlay. After that I havehttps://github.com/curiousyuvi/overlay_implementation awaited on Future.delayed to make a delay of 3 seconds and then called remove method to remove the current OverlayEntry from the Overlay. This makes the entry appear for 3 seconds and then it disappears.
Example 3:
Dart
import 'package:flutter/material.dart'; class Example3 extends StatefulWidget { const Example3({Key key}) : super(key: key); @override _Example3State createState() => _Example3State();} class _Example3State extends State<Example3> { void _showOverlay(BuildContext context) async { // Declaring and Initializing OverlayState and // OverlayEntry objects OverlayState overlayState = Overlay.of(context); OverlayEntry overlayEntry1; OverlayEntry overlayEntry2; OverlayEntry overlayEntry3; overlayEntry1 = OverlayEntry(builder: (context) { // You can return any widget you like here // to be displayed on the Overlay return Positioned( left: MediaQuery.of(context).size.width * 0.1, top: MediaQuery.of(context).size.height * 0.3, child: ClipRRect( borderRadius: BorderRadius.circular(20), child: Container( padding: EdgeInsets.all(MediaQuery.of(context).size.height * 0.02), width: MediaQuery.of(context).size.width * 0.8, height: MediaQuery.of(context).size.height * 0.1, color: Colors.pink.withOpacity(0.3), child: Material( color: Colors.transparent, child: Text('I will disappear in 3 seconds', style: TextStyle( fontSize: MediaQuery.of(context).size.height * 0.03, fontWeight: FontWeight.bold, color: Colors.white)), ), ), ), ); }); overlayEntry2 = OverlayEntry(builder: (context) { // You can return any widget you like here // to be displayed on the Overlay return Positioned( left: MediaQuery.of(context).size.width * 0.1, top: MediaQuery.of(context).size.height * 0.5, child: ClipRRect( borderRadius: BorderRadius.circular(20), child: Container( padding: EdgeInsets.all(MediaQuery.of(context).size.height * 0.02), width: MediaQuery.of(context).size.width * 0.8, height: MediaQuery.of(context).size.height * 0.1, color: Colors.blue.withOpacity(0.3), child: Material( color: Colors.transparent, child: Text('I will disappear in 5 seconds', style: TextStyle( fontSize: MediaQuery.of(context).size.height * 0.03, fontWeight: FontWeight.bold, color: Colors.white)), ), ), ), ); }); overlayEntry3 = OverlayEntry(builder: (context) { // You can return any widget you like // here to be displayed on the Overlay return Positioned( left: MediaQuery.of(context).size.width * 0.1, top: MediaQuery.of(context).size.height * 0.7, child: ClipRRect( borderRadius: BorderRadius.circular(20), child: Container( padding: EdgeInsets.all(MediaQuery.of(context).size.height * 0.02), width: MediaQuery.of(context).size.width * 0.8, height: MediaQuery.of(context).size.height * 0.1, color: Colors.green.withOpacity(0.3), child: Material( color: Colors.transparent, child: Text('I will disappear in 7 seconds', style: TextStyle( fontSize: MediaQuery.of(context).size.height * 0.03, fontWeight: FontWeight.bold, color: Colors.white)), ), ), ), ); }); // Inserting the OverlayEntry into the Overlay overlayState.insertAll([overlayEntry1, overlayEntry2, overlayEntry3]); // Awaiting for 3 seconds await Future.delayed(Duration(seconds: 3)); // Removing the first OverlayEntry from the Overlay overlayEntry1.remove(); // Awaiting for 2 seconds more await Future.delayed(Duration(seconds: 2)); // Removing the second OverlayEntry from the Overlay overlayEntry2.remove(); // Awaiting for 2 seconds more await Future.delayed(Duration(seconds: 2)); // Removing the third OverlayEntry from the Overlay overlayEntry3.remove(); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text( 'GeeksForGeeks Example 3', style: TextStyle(fontWeight: FontWeight.bold), ), ), body: SafeArea( child: Center( child: MaterialButton( color: Colors.green, minWidth: MediaQuery.of(context).size.width * 0.4, height: MediaQuery.of(context).size.height * 0.06, child: Text( 'show Overlay', style: TextStyle(color: Colors.white), ), onPressed: () { //calling the _showOverlay method // when Button is pressed _showOverlay(context); }, ))), ); }}
Output:
Explanation:
In this example, I have called a function _showOverlay in the onPressed callback of the MaterialButton. In the _showOverlay function, I have declared and initialized OverlayState and three OverlayEntry objects. In these OverlayEntries, I have different colored Containers and they all display a Text. After the initialization of OverlayEntries I have called insertAll method for OverlayState and passed in the List of OverlayEntries, this adds all the Entries to the Overlay. After that I have awaited on Future.delayed to make a delay of 3 seconds and then called remove method to remove the first OverlayEntry from the Overlay and then similarly I have delayed for two seconds then called remove for the second OverlayEntry and then again delayed for 2 seconds and called remove for the third and last OverlayEntry, this makes the OverlayEntries disappear one after another.
android
Flutter UI-components
Dart
Flutter
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Flutter - Custom Bottom Navigation Bar
ListView Class in Flutter
Flutter - Flexible Widget
Flutter - Stack Widget
Android Studio Setup for Flutter Development
Flutter - Custom Bottom Navigation Bar
Flutter Tutorial
Flutter - Flexible Widget
Flutter - Stack Widget
Flutter - Dialogs | [
{
"code": null,
"e": 25287,
"s": 25259,
"text": "\n28 Jul, 2021"
},
{
"code": null,
"e": 25416,
"s": 25287,
"text": "Overlays let independent child widgets float visual elements on top of other widgets by inserting them into the overlay’s Stack."
},
{
"code": null,
"e": 25612,
"s": 25416,
"text": "This article discusses the implementation of Overlays in Flutter. To implement Overlay in Flutter we need to know about two Flutter built-in classes OverlayEntry class and the OverlayState class."
},
{
"code": null,
"e": 25694,
"s": 25612,
"text": "Vaguely speaking OverlayEntry is a place in an Overlay that can contain a widget."
},
{
"code": null,
"e": 25731,
"s": 25694,
"text": "Constructor for OverlayEntry class :"
},
{
"code": null,
"e": 25839,
"s": 25731,
"text": "OverlayEntry(\n {\n required WidgetBuilder builder,\n bool opaque = false,\n bool maintainState = false\n }\n)"
},
{
"code": null,
"e": 25874,
"s": 25839,
"text": "Properties of OverlayEntry class :"
},
{
"code": null,
"e": 25909,
"s": 25874,
"text": "builder: Takes a widget builder."
},
{
"code": null,
"e": 26145,
"s": 25909,
"text": "opaque: Takes a bool value that decides whether this entry occludes the entire overlay. If an entry claims to be opaque, then, for efficiency, the overlay will skip building entries below that entry unless they have maintainState set."
},
{
"code": null,
"e": 26261,
"s": 26145,
"text": "maintainState: Takes a bool value and if set true it forcefully builds the occluded entries below an opaque entry."
},
{
"code": null,
"e": 26293,
"s": 26261,
"text": "Methods of OverlayEntry class :"
},
{
"code": null,
"e": 26340,
"s": 26293,
"text": "remove: Removes this entry from the overlay."
},
{
"code": null,
"e": 26423,
"s": 26340,
"text": "The current state of an Overlay is used to insert OverlayEntries into the overlay."
},
{
"code": null,
"e": 26455,
"s": 26423,
"text": "Methods of OverlayState class :"
},
{
"code": null,
"e": 26549,
"s": 26455,
"text": "debugIsVisible: Checks whether the given OverlayEntry is visible or not and returns a bool."
},
{
"code": null,
"e": 26607,
"s": 26549,
"text": "insert: Inserts the given OverlayEntry into the Overlay."
},
{
"code": null,
"e": 26800,
"s": 26607,
"text": "insertAll: Takes a List of OverlayEntries and inserts all the entries into the Overlay. You can also specify the above and below properties to state in which order entries are to be inserted."
},
{
"code": null,
"e": 26937,
"s": 26800,
"text": "rearrange: Remove all the entries listed in the given List of OverlayEntries, then reinsert them into the overlay in the given order. "
},
{
"code": null,
"e": 27031,
"s": 26937,
"text": "I know you are not that much interested in reading theory, so let’s head on to some Examples."
},
{
"code": null,
"e": 27042,
"s": 27031,
"text": "Example 1:"
},
{
"code": null,
"e": 27047,
"s": 27042,
"text": "Dart"
},
{
"code": "import 'package:flutter/material.dart'; class Example1 extends StatefulWidget { const Example1({Key key}) : super(key: key); @override _Example1State createState() => _Example1State();} class _Example1State extends State<Example1> { void _showOverlay(BuildContext context) async { // Declaring and Initializing OverlayState // and OverlayEntry objects OverlayState overlayState = Overlay.of(context); OverlayEntry overlayEntry; overlayEntry = OverlayEntry(builder: (context) { // You can return any widget you like here // to be displayed on the Overlay return Positioned( left: MediaQuery.of(context).size.width * 0.2, top: MediaQuery.of(context).size.height * 0.3, child: Container( width: MediaQuery.of(context).size.width * 0.8, child: Stack( children: [ Image.asset( 'images/commentCloud.png', colorBlendMode: BlendMode.multiply, ), Positioned( top: MediaQuery.of(context).size.height * 0.13, left: MediaQuery.of(context).size.width * 0.13, child: Row( children: [ Material( color: Colors.transparent, child: Text( 'This is a button!', style: TextStyle( fontSize: MediaQuery.of(context).size.height * 0.03, color: Colors.green), ), ), SizedBox( width: MediaQuery.of(context).size.width * 0.18, ), GestureDetector( onTap: () { // When the icon is pressed the OverlayEntry // is removed from Overlay overlayEntry.remove(); }, child: Icon(Icons.close, color: Colors.green, size: MediaQuery.of(context).size.height * 0.025), ) ], ), ), ], ), ), ); }); // Inserting the OverlayEntry into the Overlay overlayState.insert(overlayEntry); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text( 'GeeksForGeeks Example 2', style: TextStyle(fontWeight: FontWeight.bold), ), ), body: SafeArea( child: Center( child: MaterialButton( color: Colors.green, minWidth: MediaQuery.of(context).size.width * 0.4, height: MediaQuery.of(context).size.height * 0.06, child: Text( 'show Overlay', style: TextStyle(color: Colors.white), ), onPressed: () { // calling the _showOverlay method // when Button is pressed _showOverlay(context); }, ))), ); }}",
"e": 30127,
"s": 27047,
"text": null
},
{
"code": null,
"e": 30135,
"s": 30127,
"text": "Output:"
},
{
"code": null,
"e": 30148,
"s": 30135,
"text": "Explanation:"
},
{
"code": null,
"e": 30907,
"s": 30148,
"text": "In this flutter app, I have called a function _showOverlay in the onPressed callback of the MaterialButton. In the _showOverlay function, I have declared and initialized OverlayState and OverlayEntry objects. In the OverlayEntry, I have passed the widgets for a Comment Cloud and it has a Text and an Icon, I have wrapped the Icon with a GestureDetector and on its onTap callback, I have called remove function for the OverlayEntry, which removes this entry from the overlay. You can also make an OverlayEntry remove itself automatically after a certain duration, the next Example addresses that. After the initialization of OverlayEntry I have called insert method for OverlayState and passed in the current OverlayEntry, this adds the Entry to the Overlay."
},
{
"code": null,
"e": 30918,
"s": 30907,
"text": "Example 2:"
},
{
"code": null,
"e": 30923,
"s": 30918,
"text": "Dart"
},
{
"code": "import 'package:flutter/material.dart'; class Example2 extends StatefulWidget { const Example2({Key key}) : super(key: key); @override _Example2State createState() => _Example2State();} class _Example2State extends State<Example2> { void _showOverlay(BuildContext context) async { // Declaring and Initializing OverlayState // and OverlayEntry objects OverlayState overlayState = Overlay.of(context); OverlayEntry overlayEntry; overlayEntry = OverlayEntry(builder: (context) { // You can return any widget you like // here to be displayed on the Overlay return Positioned( left: MediaQuery.of(context).size.width * 0.2, top: MediaQuery.of(context).size.height * 0.3, child: Container( width: MediaQuery.of(context).size.width * 0.8, child: Stack( children: [ Image.asset( 'images/commentCloud.png', colorBlendMode: BlendMode.multiply, ), Positioned( top: MediaQuery.of(context).size.height * 0.13, left: MediaQuery.of(context).size.width * 0.13, child: Material( color: Colors.transparent, child: Text( 'I will disappear in 3 seconds.', style: TextStyle( fontSize: MediaQuery.of(context).size.height * 0.025, color: Colors.green), ), ), ), ], ), ), ); }); // Inserting the OverlayEntry into the Overlay overlayState.insert(overlayEntry); // Awaiting for 3 seconds await Future.delayed(Duration(seconds: 3)); // Removing the OverlayEntry from the Overlay overlayEntry.remove(); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text( 'GeeksForGeeks Example 2', style: TextStyle(fontWeight: FontWeight.bold), ), ), body: SafeArea( child: Center( child: MaterialButton( color: Colors.green, minWidth: MediaQuery.of(context).size.width * 0.4, height: MediaQuery.of(context).size.height * 0.06, child: Text( 'show Overlay', style: TextStyle(color: Colors.white), ), onPressed: () { // calling the _showOverlay method // when Button is pressed _showOverlay(context); }, ))), ); }}",
"e": 33467,
"s": 30923,
"text": null
},
{
"code": null,
"e": 33475,
"s": 33467,
"text": "Output:"
},
{
"code": null,
"e": 33488,
"s": 33475,
"text": "Explanation:"
},
{
"code": null,
"e": 34221,
"s": 33488,
"text": "In this example, I have called a function _showOverlay in the onPressed callback of the MaterialButton. In the _showOverlay function, I have declared and initialized OverlayState and OverlayEntry objects. In the OverlayEntry, I have passed the widgets for a Comment Cloud and it displays a Text. After the initialization of OverlayEntry I have called insert method for OverlayState and passed in the current OverlayEntry, this adds the Entry to the Overlay. After that I havehttps://github.com/curiousyuvi/overlay_implementation awaited on Future.delayed to make a delay of 3 seconds and then called remove method to remove the current OverlayEntry from the Overlay. This makes the entry appear for 3 seconds and then it disappears."
},
{
"code": null,
"e": 34232,
"s": 34221,
"text": "Example 3:"
},
{
"code": null,
"e": 34237,
"s": 34232,
"text": "Dart"
},
{
"code": "import 'package:flutter/material.dart'; class Example3 extends StatefulWidget { const Example3({Key key}) : super(key: key); @override _Example3State createState() => _Example3State();} class _Example3State extends State<Example3> { void _showOverlay(BuildContext context) async { // Declaring and Initializing OverlayState and // OverlayEntry objects OverlayState overlayState = Overlay.of(context); OverlayEntry overlayEntry1; OverlayEntry overlayEntry2; OverlayEntry overlayEntry3; overlayEntry1 = OverlayEntry(builder: (context) { // You can return any widget you like here // to be displayed on the Overlay return Positioned( left: MediaQuery.of(context).size.width * 0.1, top: MediaQuery.of(context).size.height * 0.3, child: ClipRRect( borderRadius: BorderRadius.circular(20), child: Container( padding: EdgeInsets.all(MediaQuery.of(context).size.height * 0.02), width: MediaQuery.of(context).size.width * 0.8, height: MediaQuery.of(context).size.height * 0.1, color: Colors.pink.withOpacity(0.3), child: Material( color: Colors.transparent, child: Text('I will disappear in 3 seconds', style: TextStyle( fontSize: MediaQuery.of(context).size.height * 0.03, fontWeight: FontWeight.bold, color: Colors.white)), ), ), ), ); }); overlayEntry2 = OverlayEntry(builder: (context) { // You can return any widget you like here // to be displayed on the Overlay return Positioned( left: MediaQuery.of(context).size.width * 0.1, top: MediaQuery.of(context).size.height * 0.5, child: ClipRRect( borderRadius: BorderRadius.circular(20), child: Container( padding: EdgeInsets.all(MediaQuery.of(context).size.height * 0.02), width: MediaQuery.of(context).size.width * 0.8, height: MediaQuery.of(context).size.height * 0.1, color: Colors.blue.withOpacity(0.3), child: Material( color: Colors.transparent, child: Text('I will disappear in 5 seconds', style: TextStyle( fontSize: MediaQuery.of(context).size.height * 0.03, fontWeight: FontWeight.bold, color: Colors.white)), ), ), ), ); }); overlayEntry3 = OverlayEntry(builder: (context) { // You can return any widget you like // here to be displayed on the Overlay return Positioned( left: MediaQuery.of(context).size.width * 0.1, top: MediaQuery.of(context).size.height * 0.7, child: ClipRRect( borderRadius: BorderRadius.circular(20), child: Container( padding: EdgeInsets.all(MediaQuery.of(context).size.height * 0.02), width: MediaQuery.of(context).size.width * 0.8, height: MediaQuery.of(context).size.height * 0.1, color: Colors.green.withOpacity(0.3), child: Material( color: Colors.transparent, child: Text('I will disappear in 7 seconds', style: TextStyle( fontSize: MediaQuery.of(context).size.height * 0.03, fontWeight: FontWeight.bold, color: Colors.white)), ), ), ), ); }); // Inserting the OverlayEntry into the Overlay overlayState.insertAll([overlayEntry1, overlayEntry2, overlayEntry3]); // Awaiting for 3 seconds await Future.delayed(Duration(seconds: 3)); // Removing the first OverlayEntry from the Overlay overlayEntry1.remove(); // Awaiting for 2 seconds more await Future.delayed(Duration(seconds: 2)); // Removing the second OverlayEntry from the Overlay overlayEntry2.remove(); // Awaiting for 2 seconds more await Future.delayed(Duration(seconds: 2)); // Removing the third OverlayEntry from the Overlay overlayEntry3.remove(); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text( 'GeeksForGeeks Example 3', style: TextStyle(fontWeight: FontWeight.bold), ), ), body: SafeArea( child: Center( child: MaterialButton( color: Colors.green, minWidth: MediaQuery.of(context).size.width * 0.4, height: MediaQuery.of(context).size.height * 0.06, child: Text( 'show Overlay', style: TextStyle(color: Colors.white), ), onPressed: () { //calling the _showOverlay method // when Button is pressed _showOverlay(context); }, ))), ); }}",
"e": 39134,
"s": 34237,
"text": null
},
{
"code": null,
"e": 39142,
"s": 39134,
"text": "Output:"
},
{
"code": null,
"e": 39155,
"s": 39142,
"text": "Explanation:"
},
{
"code": null,
"e": 40032,
"s": 39155,
"text": "In this example, I have called a function _showOverlay in the onPressed callback of the MaterialButton. In the _showOverlay function, I have declared and initialized OverlayState and three OverlayEntry objects. In these OverlayEntries, I have different colored Containers and they all display a Text. After the initialization of OverlayEntries I have called insertAll method for OverlayState and passed in the List of OverlayEntries, this adds all the Entries to the Overlay. After that I have awaited on Future.delayed to make a delay of 3 seconds and then called remove method to remove the first OverlayEntry from the Overlay and then similarly I have delayed for two seconds then called remove for the second OverlayEntry and then again delayed for 2 seconds and called remove for the third and last OverlayEntry, this makes the OverlayEntries disappear one after another."
},
{
"code": null,
"e": 40040,
"s": 40032,
"text": "android"
},
{
"code": null,
"e": 40062,
"s": 40040,
"text": "Flutter UI-components"
},
{
"code": null,
"e": 40067,
"s": 40062,
"text": "Dart"
},
{
"code": null,
"e": 40075,
"s": 40067,
"text": "Flutter"
},
{
"code": null,
"e": 40173,
"s": 40075,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 40212,
"s": 40173,
"text": "Flutter - Custom Bottom Navigation Bar"
},
{
"code": null,
"e": 40238,
"s": 40212,
"text": "ListView Class in Flutter"
},
{
"code": null,
"e": 40264,
"s": 40238,
"text": "Flutter - Flexible Widget"
},
{
"code": null,
"e": 40287,
"s": 40264,
"text": "Flutter - Stack Widget"
},
{
"code": null,
"e": 40332,
"s": 40287,
"text": "Android Studio Setup for Flutter Development"
},
{
"code": null,
"e": 40371,
"s": 40332,
"text": "Flutter - Custom Bottom Navigation Bar"
},
{
"code": null,
"e": 40388,
"s": 40371,
"text": "Flutter Tutorial"
},
{
"code": null,
"e": 40414,
"s": 40388,
"text": "Flutter - Flexible Widget"
},
{
"code": null,
"e": 40437,
"s": 40414,
"text": "Flutter - Stack Widget"
}
] |
Grouped barplot in R with error bars - GeeksforGeeks | 22 Nov, 2021
In this article, we are going to see how to create grouped barplot in the R programming language with error bars.
A data frame can be created in R working space using the data.frame() method. The tidyverse package is installed and loaded into the working space in order to perform data mutations and manipulations.
The package can be incorporated in the working space using the following command:
install.packages("tidyverse")
The declared data frame is subjected to a large number of operations using the pipe operator. Initially, the group_by method is applied to segregate data in different groups. It takes as argument the column to group data by.
Syntax: group_by (col-name)
Arguments :
col-name – The column to group data by
A temporary column can then be added by performing the mathematical computation of dividing the values of standard deviation of the required column with its length. The standard deviation is calculated using the sd() method. The length can be computed by the length() method. Both these methods take as an argument the column names. The column can be appended to the data frame using the mutate() method.
mutate (new-col-name = func())
The ggplot method in R is used to do graph visualizations using the specified data frame. It is used to instantiate a ggplot object. Aesthetic mappings can be created to the plot object to determine the relationship between the x and y-axis respectively. Additional components can be added to the created ggplot object.
Syntax: ggplot(data = NULL, mapping = aes(), fill = )
Arguments :
data – Default dataset to use for plot.
mapping – List of aesthetic mappings to use for plot.
Geoms can be added to the plot using various methods. The geom_line() method in R can be used to add graphical lines in the plots made. It is added as a component to the existing plot. Aesthetic mappings can also contain color attributes which is assigned differently based on different data frames.
The geom_bar() method is used to construct the height of the bar proportional to the number of cases in each group.
Syntax: geom_bar ( width, stat)
Arguments :
width – Bar width
The geom_errorbar() method is used to add error bars to the plot.
Syntax: geom_errorbar(mapping = NULL, data = NULL, stat = “identity”, position = “identity”, ...)
Arguments :
mapping – The aesthetic mapping, usually constructed with aes or aes_string.
stat – The statistical transformation to use on the data for this layer.
position – The position adjustment to use for overlapping points on this layer
R
# importing the required librarylibrary(tidyverse)data_frame <- data.frame(stringsAsFactors=FALSE, col1 = c(rep(LETTERS[1:3],each=4)), col2 = c(rep(1:4,each=3)), col3 = c(1:12))print("original dataframe")print(data_frame) # computing the length of col3 len <- length(col3) # plotting the datadata_frame %>% # grouping by col2 group_by(col2) %>% # adding a temporary column mutate(temp_col = sd(col3)/sqrt(len)) %>% ggplot(aes(x = col2, y = col3, fill = col1)) + geom_bar(stat="identity", alpha=0.5, position=position_dodge()) + # adding error bar geom_errorbar(aes(ymin=col3-temp_col, ymax=col3+temp_col), width=.2, colour="red", position=position_dodge(.9))
Output
[1] "original dataframe"
> print(data_frame)
col1 col2 col3
1 A 1 1
2 A 1 2
3 A 1 3
4 A 2 4
5 B 2 5
6 B 2 6
7 B 3 7
8 B 3 8
9 C 3 9
10 C 4 10
11 C 4 11
12 C 4 12
Picked
R Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Change Color of Bars in Barchart using ggplot2 in R
Group by function in R using Dplyr
How to Change Axis Scales in R Plots?
How to Split Column Into Multiple Columns in R DataFrame?
Replace Specific Characters in String in R
How to filter R DataFrame by values in a column?
R - if statement
How to filter R dataframe by multiple conditions?
Plot mean and standard deviation using ggplot2 in R
How to import an Excel File into R ? | [
{
"code": null,
"e": 26487,
"s": 26459,
"text": "\n22 Nov, 2021"
},
{
"code": null,
"e": 26601,
"s": 26487,
"text": "In this article, we are going to see how to create grouped barplot in the R programming language with error bars."
},
{
"code": null,
"e": 26803,
"s": 26601,
"text": "A data frame can be created in R working space using the data.frame() method. The tidyverse package is installed and loaded into the working space in order to perform data mutations and manipulations. "
},
{
"code": null,
"e": 26886,
"s": 26803,
"text": "The package can be incorporated in the working space using the following command: "
},
{
"code": null,
"e": 26916,
"s": 26886,
"text": "install.packages(\"tidyverse\")"
},
{
"code": null,
"e": 27142,
"s": 26916,
"text": "The declared data frame is subjected to a large number of operations using the pipe operator. Initially, the group_by method is applied to segregate data in different groups. It takes as argument the column to group data by. "
},
{
"code": null,
"e": 27170,
"s": 27142,
"text": "Syntax: group_by (col-name)"
},
{
"code": null,
"e": 27183,
"s": 27170,
"text": "Arguments : "
},
{
"code": null,
"e": 27222,
"s": 27183,
"text": "col-name – The column to group data by"
},
{
"code": null,
"e": 27628,
"s": 27222,
"text": "A temporary column can then be added by performing the mathematical computation of dividing the values of standard deviation of the required column with its length. The standard deviation is calculated using the sd() method. The length can be computed by the length() method. Both these methods take as an argument the column names. The column can be appended to the data frame using the mutate() method. "
},
{
"code": null,
"e": 27659,
"s": 27628,
"text": "mutate (new-col-name = func())"
},
{
"code": null,
"e": 27979,
"s": 27659,
"text": "The ggplot method in R is used to do graph visualizations using the specified data frame. It is used to instantiate a ggplot object. Aesthetic mappings can be created to the plot object to determine the relationship between the x and y-axis respectively. Additional components can be added to the created ggplot object."
},
{
"code": null,
"e": 28033,
"s": 27979,
"text": "Syntax: ggplot(data = NULL, mapping = aes(), fill = )"
},
{
"code": null,
"e": 28045,
"s": 28033,
"text": "Arguments :"
},
{
"code": null,
"e": 28085,
"s": 28045,
"text": "data – Default dataset to use for plot."
},
{
"code": null,
"e": 28139,
"s": 28085,
"text": "mapping – List of aesthetic mappings to use for plot."
},
{
"code": null,
"e": 28439,
"s": 28139,
"text": "Geoms can be added to the plot using various methods. The geom_line() method in R can be used to add graphical lines in the plots made. It is added as a component to the existing plot. Aesthetic mappings can also contain color attributes which is assigned differently based on different data frames."
},
{
"code": null,
"e": 28555,
"s": 28439,
"text": "The geom_bar() method is used to construct the height of the bar proportional to the number of cases in each group."
},
{
"code": null,
"e": 28587,
"s": 28555,
"text": "Syntax: geom_bar ( width, stat)"
},
{
"code": null,
"e": 28599,
"s": 28587,
"text": "Arguments :"
},
{
"code": null,
"e": 28617,
"s": 28599,
"text": "width – Bar width"
},
{
"code": null,
"e": 28684,
"s": 28617,
"text": "The geom_errorbar() method is used to add error bars to the plot. "
},
{
"code": null,
"e": 28782,
"s": 28684,
"text": "Syntax: geom_errorbar(mapping = NULL, data = NULL, stat = “identity”, position = “identity”, ...)"
},
{
"code": null,
"e": 28795,
"s": 28782,
"text": "Arguments : "
},
{
"code": null,
"e": 28872,
"s": 28795,
"text": "mapping – The aesthetic mapping, usually constructed with aes or aes_string."
},
{
"code": null,
"e": 28945,
"s": 28872,
"text": "stat – The statistical transformation to use on the data for this layer."
},
{
"code": null,
"e": 29024,
"s": 28945,
"text": "position – The position adjustment to use for overlapping points on this layer"
},
{
"code": null,
"e": 29026,
"s": 29024,
"text": "R"
},
{
"code": "# importing the required librarylibrary(tidyverse)data_frame <- data.frame(stringsAsFactors=FALSE, col1 = c(rep(LETTERS[1:3],each=4)), col2 = c(rep(1:4,each=3)), col3 = c(1:12))print(\"original dataframe\")print(data_frame) # computing the length of col3 len <- length(col3) # plotting the datadata_frame %>% # grouping by col2 group_by(col2) %>% # adding a temporary column mutate(temp_col = sd(col3)/sqrt(len)) %>% ggplot(aes(x = col2, y = col3, fill = col1)) + geom_bar(stat=\"identity\", alpha=0.5, position=position_dodge()) + # adding error bar geom_errorbar(aes(ymin=col3-temp_col, ymax=col3+temp_col), width=.2, colour=\"red\", position=position_dodge(.9))",
"e": 29823,
"s": 29026,
"text": null
},
{
"code": null,
"e": 29830,
"s": 29823,
"text": "Output"
},
{
"code": null,
"e": 30108,
"s": 29830,
"text": "[1] \"original dataframe\"\n> print(data_frame)\n col1 col2 col3\n1 A 1 1\n2 A 1 2\n3 A 1 3\n4 A 2 4\n5 B 2 5\n6 B 2 6\n7 B 3 7\n8 B 3 8\n9 C 3 9\n10 C 4 10\n11 C 4 11\n12 C 4 12"
},
{
"code": null,
"e": 30115,
"s": 30108,
"text": "Picked"
},
{
"code": null,
"e": 30126,
"s": 30115,
"text": "R Language"
},
{
"code": null,
"e": 30224,
"s": 30126,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 30276,
"s": 30224,
"text": "Change Color of Bars in Barchart using ggplot2 in R"
},
{
"code": null,
"e": 30311,
"s": 30276,
"text": "Group by function in R using Dplyr"
},
{
"code": null,
"e": 30349,
"s": 30311,
"text": "How to Change Axis Scales in R Plots?"
},
{
"code": null,
"e": 30407,
"s": 30349,
"text": "How to Split Column Into Multiple Columns in R DataFrame?"
},
{
"code": null,
"e": 30450,
"s": 30407,
"text": "Replace Specific Characters in String in R"
},
{
"code": null,
"e": 30499,
"s": 30450,
"text": "How to filter R DataFrame by values in a column?"
},
{
"code": null,
"e": 30516,
"s": 30499,
"text": "R - if statement"
},
{
"code": null,
"e": 30566,
"s": 30516,
"text": "How to filter R dataframe by multiple conditions?"
},
{
"code": null,
"e": 30618,
"s": 30566,
"text": "Plot mean and standard deviation using ggplot2 in R"
}
] |
strol() function in C++ - GeeksforGeeks | 21 Nov, 2021
The strtol() function in C++ interprets the contents of a string as an integral number of the specified base and return its value as a long int.This function also sets an end pointer that points to the first character after the last valid numeric character of the string, if there is no such character then the pointer is set to null. This function is defined in cstdlib header file.Syntax:
long int strtol(const char* str, char** end, int base)
Parameter :The function accepts three mandatory parameters which are described below.
str: A string consist of an integral number.
end: This is reference to object of type char*. The value of end is set by the function to the next character in str after the last valid numeric character. This parameter can also be a null pointer, in case if it is not used.
base: It represent the numerical base (radix) that determines the valid characters and their interpretation in the string
Return type :The function returns two types of values which are described below:
If valid conversion occur then the function returns the converted integral number as long int value.
If no valid conversion could be performed, a zero value is returned.
Below programs illustrate the above function. Program 1:
CPP
// C++ program to illustrate the// strtol() function#include <bits/stdc++.h>using namespace std; // Driver codeint main(){ int base = 10; char str[] = "123abc"; char* end; long int num; // Function used to convert string num = strtol(str, &end, base); cout << "Given String = " << str << endl; cout << "Number with base 10 in string " << num << endl; cout << "End String points to " << end << endl << endl; // in this case the end pointer points to null strcpy(str, "12345"); // prints the current string cout << "Given String = " << str << endl; // function used num = strtol(str, &end, base); // prints the converted integer cout << "Number with base 10 in string " << num << endl; if (*end) { cout << end; } else { cout << "Null pointer"; } return 0;}
Given String = 123abc
Number with base 10 in string 123
End String points to abc
Given String = 12345
Number with base 10 in string 12345
Null pointer
Program 2:
CPP
// C++ program to illustrate the// strtol() function Program to// convert multiple values at different base#include <bits/stdc++.h>using namespace std; // Driver codeint main(){ char str[] = "100 ab 123 1010"; char* end; long int a, b, c, d; // base 10 a = strtol(str, &end, 10); // base 16 b = strtol(end, &end, 16); // base 8 c = strtol(end, &end, 8); // base 2 d = strtol(end, &end, 2); cout << "The decimal equivalents of all numbers are \n"; cout << a << endl << b << endl << c << endl << d; return 0;}
The decimal equivalents of all numbers are
100
171
83
10
akshaysingh98088
adnanirshad158
simmytarika5
CPP-Functions
STL
C++
STL
CPP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Inheritance in C++
Map in C++ Standard Template Library (STL)
C++ Classes and Objects
Bitwise Operators in C/C++
Virtual Function in C++
Templates in C++ with Examples
Constructors in C++
Operator Overloading in C++
Socket Programming in C/C++
vector erase() and clear() in C++ | [
{
"code": null,
"e": 25847,
"s": 25819,
"text": "\n21 Nov, 2021"
},
{
"code": null,
"e": 26239,
"s": 25847,
"text": "The strtol() function in C++ interprets the contents of a string as an integral number of the specified base and return its value as a long int.This function also sets an end pointer that points to the first character after the last valid numeric character of the string, if there is no such character then the pointer is set to null. This function is defined in cstdlib header file.Syntax: "
},
{
"code": null,
"e": 26294,
"s": 26239,
"text": "long int strtol(const char* str, char** end, int base)"
},
{
"code": null,
"e": 26382,
"s": 26294,
"text": "Parameter :The function accepts three mandatory parameters which are described below. "
},
{
"code": null,
"e": 26427,
"s": 26382,
"text": "str: A string consist of an integral number."
},
{
"code": null,
"e": 26654,
"s": 26427,
"text": "end: This is reference to object of type char*. The value of end is set by the function to the next character in str after the last valid numeric character. This parameter can also be a null pointer, in case if it is not used."
},
{
"code": null,
"e": 26776,
"s": 26654,
"text": "base: It represent the numerical base (radix) that determines the valid characters and their interpretation in the string"
},
{
"code": null,
"e": 26859,
"s": 26776,
"text": "Return type :The function returns two types of values which are described below: "
},
{
"code": null,
"e": 26960,
"s": 26859,
"text": "If valid conversion occur then the function returns the converted integral number as long int value."
},
{
"code": null,
"e": 27029,
"s": 26960,
"text": "If no valid conversion could be performed, a zero value is returned."
},
{
"code": null,
"e": 27088,
"s": 27029,
"text": "Below programs illustrate the above function. Program 1: "
},
{
"code": null,
"e": 27092,
"s": 27088,
"text": "CPP"
},
{
"code": "// C++ program to illustrate the// strtol() function#include <bits/stdc++.h>using namespace std; // Driver codeint main(){ int base = 10; char str[] = \"123abc\"; char* end; long int num; // Function used to convert string num = strtol(str, &end, base); cout << \"Given String = \" << str << endl; cout << \"Number with base 10 in string \" << num << endl; cout << \"End String points to \" << end << endl << endl; // in this case the end pointer points to null strcpy(str, \"12345\"); // prints the current string cout << \"Given String = \" << str << endl; // function used num = strtol(str, &end, base); // prints the converted integer cout << \"Number with base 10 in string \" << num << endl; if (*end) { cout << end; } else { cout << \"Null pointer\"; } return 0;}",
"e": 27942,
"s": 27092,
"text": null
},
{
"code": null,
"e": 28095,
"s": 27942,
"text": "Given String = 123abc\nNumber with base 10 in string 123\nEnd String points to abc\n\nGiven String = 12345\nNumber with base 10 in string 12345\nNull pointer"
},
{
"code": null,
"e": 28109,
"s": 28097,
"text": "Program 2: "
},
{
"code": null,
"e": 28113,
"s": 28109,
"text": "CPP"
},
{
"code": "// C++ program to illustrate the// strtol() function Program to// convert multiple values at different base#include <bits/stdc++.h>using namespace std; // Driver codeint main(){ char str[] = \"100 ab 123 1010\"; char* end; long int a, b, c, d; // base 10 a = strtol(str, &end, 10); // base 16 b = strtol(end, &end, 16); // base 8 c = strtol(end, &end, 8); // base 2 d = strtol(end, &end, 2); cout << \"The decimal equivalents of all numbers are \\n\"; cout << a << endl << b << endl << c << endl << d; return 0;}",
"e": 28693,
"s": 28113,
"text": null
},
{
"code": null,
"e": 28751,
"s": 28693,
"text": "The decimal equivalents of all numbers are \n100\n171\n83\n10"
},
{
"code": null,
"e": 28770,
"s": 28753,
"text": "akshaysingh98088"
},
{
"code": null,
"e": 28785,
"s": 28770,
"text": "adnanirshad158"
},
{
"code": null,
"e": 28798,
"s": 28785,
"text": "simmytarika5"
},
{
"code": null,
"e": 28812,
"s": 28798,
"text": "CPP-Functions"
},
{
"code": null,
"e": 28816,
"s": 28812,
"text": "STL"
},
{
"code": null,
"e": 28820,
"s": 28816,
"text": "C++"
},
{
"code": null,
"e": 28824,
"s": 28820,
"text": "STL"
},
{
"code": null,
"e": 28828,
"s": 28824,
"text": "CPP"
},
{
"code": null,
"e": 28926,
"s": 28828,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 28945,
"s": 28926,
"text": "Inheritance in C++"
},
{
"code": null,
"e": 28988,
"s": 28945,
"text": "Map in C++ Standard Template Library (STL)"
},
{
"code": null,
"e": 29012,
"s": 28988,
"text": "C++ Classes and Objects"
},
{
"code": null,
"e": 29039,
"s": 29012,
"text": "Bitwise Operators in C/C++"
},
{
"code": null,
"e": 29063,
"s": 29039,
"text": "Virtual Function in C++"
},
{
"code": null,
"e": 29094,
"s": 29063,
"text": "Templates in C++ with Examples"
},
{
"code": null,
"e": 29114,
"s": 29094,
"text": "Constructors in C++"
},
{
"code": null,
"e": 29142,
"s": 29114,
"text": "Operator Overloading in C++"
},
{
"code": null,
"e": 29170,
"s": 29142,
"text": "Socket Programming in C/C++"
}
] |
How to get beginning of the first day of this week from timestamp in Android sqlite? | Before getting into an example, we should know what SQLite database in android is. SQLite is an open source SQL database that stores data to a text file on a device. Android comes in with built in SQLite database implementation. SQLite supports all the relational database features. In order to access this database, you don't need to establish any kind of connections for it like JDBC, ODBC etc.
This example demonstrates How to get the beginning of the first day of this week from the timestamp in Android SQLite.
Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.
Step 2 − Add the following code to res/layout/activity_main.xml.
<?xml version = "1.0" encoding = "utf-8"?>
<LinearLayout xmlns:android = "http://schemas.android.com/apk/res/android"
xmlns:tools = "http://schemas.android.com/tools"
android:layout_width = "match_parent"
android:layout_height = "match_parent"
tools:context = ".MainActivity"
android:orientation = "vertical">
<EditText
android:id = "@+id/name"
android:layout_width = "match_parent"
android:hint = "Enter Name"
android:layout_height = "wrap_content" />
<EditText
android:id = "@+id/salary"
android:layout_width = "match_parent"
android:inputType = "numberDecimal"
android:hint = "Enter Salary"
android:layout_height = "wrap_content" />
<LinearLayout
android:layout_width = "wrap_content"
android:layout_height = "wrap_content">
<Button
android:id = "@+id/save"
android:text = "Save"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content" />
<Button
android:id = "@+id/refresh"
android:text = "Refresh"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content" />
<Button
android:id = "@+id/udate"
android:text = "Update"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content" />
<Button
android:id = "@+id/Delete"
android:text = "DeleteALL"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content" />
</LinearLayout>
<ListView
android:id = "@+id/listView"
android:layout_width = "match_parent"
android:layout_height = "wrap_content">
</ListView>
</LinearLayout>
In the above code, we have taken name and salary as Edit text, when user click on save button it will store the data into sqlite data base. Click on refresh button after insert values to update listview from cursor WITH THIS WEEK DATA. If User click on update button it will update the data.
Step 3 − Add the following code to src/MainActivity.java
package com.example.andy.myapplication;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.Toast;
import java.util.ArrayList;
public class MainActivity extends AppCompatActivity {
Button save, refresh;
EditText name, salary;
private ListView listView;
@Override
protected void onCreate(Bundle readdInstanceState) {
super.onCreate(readdInstanceState);
setContentView(R.layout.activity_main);
final DatabaseHelper helper = new DatabaseHelper(this);
final ArrayList array_list = helper.getAllCotacts();
name = findViewById(R.id.name);
salary = findViewById(R.id.salary);
listView = findViewById(R.id.listView);
final ArrayAdapter arrayAdapter = new ArrayAdapter(MainActivity.this,
android.R.layout.simple_list_item_1, array_list);
listView.setAdapter(arrayAdapter);
findViewById(R.id.Delete).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (helper.delete()) {
Toast.makeText(MainActivity.this, "Deleted", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(MainActivity.this, "NOT Deleted", Toast.LENGTH_LONG).show();
}
}
});
findViewById(R.id.udate).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!name.getText().toString().isEmpty() && !salary.getText().toString().isEmpty()) {
if (helper.update(name.getText().toString(), salary.getText().toString())) {
Toast.makeText(MainActivity.this, "Updated", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(MainActivity.this, "NOT Updated", Toast.LENGTH_LONG).show();
}
} else {
name.setError("Enter NAME");
salary.setError("Enter Salary");
}
}
});
findViewById(R.id.refresh).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
array_list.clear();
array_list.addAll(helper.getAllCotacts());
arrayAdapter.notifyDataSetChanged();
listView.invalidateViews();
listView.refreshDrawableState();
}
});
findViewById(R.id.save).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!name.getText().toString().isEmpty() && !salary.getText().toString().isEmpty()) {
if (helper.insert(name.getText().toString(), salary.getText().toString())) {
Toast.makeText(MainActivity.this, "Inserted", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(MainActivity.this, "NOT Inserted", Toast.LENGTH_LONG).show();
}
} else {
name.setError("Enter NAME");
salary.setError("Enter Salary");
}
}
});
}
}
Step 4 − Add the following code to src/ DatabaseHelper.java
package com.example.andy.myapplication;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;
import android.database.sqlite.SQLiteOpenHelper;
import java.io.IOException;
import java.util.ArrayList;
class DatabaseHelper extends SQLiteOpenHelper {
public static final String DATABASE_NAME = "salaryDatabase5";
public static final String CONTACTS_TABLE_NAME = "SalaryDetails";
public DatabaseHelper(Context context) {
super(context,DATABASE_NAME,null,1);
}
@Override
public void onCreate(SQLiteDatabase db) {
try {
db.execSQL(
"create table "+ CONTACTS_TABLE_NAME +"(id INTEGER PRIMARY KEY, name text,salary text,datetime default current_timestamp )"
);
} catch (SQLiteException e) {
try {
throw new IOException(e);
} catch (IOException e1) {
e1.printStackTrace();
}
}
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXISTS "+CONTACTS_TABLE_NAME);
onCreate(db);
}
public boolean insert(String s, String s1) {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put("name", s);
contentValues.put("salary", s1);
db.replace(CONTACTS_TABLE_NAME, null, contentValues);
return true;
}
public ArrayList getAllCotacts() {
SQLiteDatabase db = this.getReadableDatabase();
ArrayList<String> array_list = new ArrayList<String>();
Cursor res = db.rawQuery( "select (id ||' : '||name || ' : ' || salary || ' : '|| datetime) AS fullname from "+CONTACTS_TABLE_NAME+" WHERE datetime > = DATE('now', 'weekday 0', '-7 days') ", null );
res.moveToFirst();
while(res.isAfterLast() = = false) {
array_list.add(res.getString(res.getColumnIndex("fullname")));
res.moveToNext();
}
return array_list;
}
public boolean update(String s, String s1) {
SQLiteDatabase db = this.getWritableDatabase();
db.execSQL("UPDATE "+CONTACTS_TABLE_NAME+" SET name = "+"'"+s+"', "+ "salary = "+"'"+s1+"'");
return true;
}
public boolean delete() {
SQLiteDatabase db = this.getWritableDatabase();
db.execSQL("DELETE from "+CONTACTS_TABLE_NAME);
return true;
}
}
Let's try to run your application. I assume you have connected your actual Android Mobile device with your computer. To run the app from the android studio, open one of your project's activity files and click Run icon from the toolbar. Select your mobile device as an option and then check your mobile device which will display your default screen –
In the above result, we are showing one-week data of this week and as per our database records we have only two days records so it is showing only two dates data.
Click here to download the project code | [
{
"code": null,
"e": 1459,
"s": 1062,
"text": "Before getting into an example, we should know what SQLite database in android is. SQLite is an open source SQL database that stores data to a text file on a device. Android comes in with built in SQLite database implementation. SQLite supports all the relational database features. In order to access this database, you don't need to establish any kind of connections for it like JDBC, ODBC etc."
},
{
"code": null,
"e": 1578,
"s": 1459,
"text": "This example demonstrates How to get the beginning of the first day of this week from the timestamp in Android SQLite."
},
{
"code": null,
"e": 1707,
"s": 1578,
"text": "Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project."
},
{
"code": null,
"e": 1772,
"s": 1707,
"text": "Step 2 − Add the following code to res/layout/activity_main.xml."
},
{
"code": null,
"e": 3502,
"s": 1772,
"text": "<?xml version = \"1.0\" encoding = \"utf-8\"?>\n<LinearLayout xmlns:android = \"http://schemas.android.com/apk/res/android\"\n xmlns:tools = \"http://schemas.android.com/tools\"\n android:layout_width = \"match_parent\"\n android:layout_height = \"match_parent\"\n tools:context = \".MainActivity\"\n android:orientation = \"vertical\">\n <EditText\n android:id = \"@+id/name\"\n android:layout_width = \"match_parent\"\n android:hint = \"Enter Name\"\n android:layout_height = \"wrap_content\" />\n <EditText\n android:id = \"@+id/salary\"\n android:layout_width = \"match_parent\"\n android:inputType = \"numberDecimal\"\n android:hint = \"Enter Salary\"\n android:layout_height = \"wrap_content\" />\n <LinearLayout\n android:layout_width = \"wrap_content\"\n android:layout_height = \"wrap_content\">\n <Button\n android:id = \"@+id/save\"\n android:text = \"Save\"\n android:layout_width = \"wrap_content\"\n android:layout_height = \"wrap_content\" />\n <Button\n android:id = \"@+id/refresh\"\n android:text = \"Refresh\"\n android:layout_width = \"wrap_content\"\n android:layout_height = \"wrap_content\" />\n <Button\n android:id = \"@+id/udate\"\n android:text = \"Update\"\n android:layout_width = \"wrap_content\"\n android:layout_height = \"wrap_content\" />\n <Button\n android:id = \"@+id/Delete\"\n android:text = \"DeleteALL\"\n android:layout_width = \"wrap_content\"\n android:layout_height = \"wrap_content\" />\n </LinearLayout>\n <ListView\n android:id = \"@+id/listView\"\n android:layout_width = \"match_parent\"\n android:layout_height = \"wrap_content\">\n </ListView>\n</LinearLayout>"
},
{
"code": null,
"e": 3794,
"s": 3502,
"text": "In the above code, we have taken name and salary as Edit text, when user click on save button it will store the data into sqlite data base. Click on refresh button after insert values to update listview from cursor WITH THIS WEEK DATA. If User click on update button it will update the data."
},
{
"code": null,
"e": 3851,
"s": 3794,
"text": "Step 3 − Add the following code to src/MainActivity.java"
},
{
"code": null,
"e": 7087,
"s": 3851,
"text": "package com.example.andy.myapplication;\nimport android.os.Bundle;\nimport android.support.v7.app.AppCompatActivity;\nimport android.view.View;\nimport android.widget.ArrayAdapter;\nimport android.widget.Button;\nimport android.widget.EditText;\nimport android.widget.ListView;\nimport android.widget.Toast;\nimport java.util.ArrayList;\npublic class MainActivity extends AppCompatActivity {\n Button save, refresh;\n EditText name, salary;\n private ListView listView;\n @Override\n protected void onCreate(Bundle readdInstanceState) {\n super.onCreate(readdInstanceState);\n setContentView(R.layout.activity_main);\n final DatabaseHelper helper = new DatabaseHelper(this);\n final ArrayList array_list = helper.getAllCotacts();\n name = findViewById(R.id.name);\n salary = findViewById(R.id.salary);\n listView = findViewById(R.id.listView);\n final ArrayAdapter arrayAdapter = new ArrayAdapter(MainActivity.this,\n android.R.layout.simple_list_item_1, array_list);\n listView.setAdapter(arrayAdapter);\n findViewById(R.id.Delete).setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n if (helper.delete()) {\n Toast.makeText(MainActivity.this, \"Deleted\", Toast.LENGTH_LONG).show();\n } else {\n Toast.makeText(MainActivity.this, \"NOT Deleted\", Toast.LENGTH_LONG).show();\n }\n }\n });\n findViewById(R.id.udate).setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n if (!name.getText().toString().isEmpty() && !salary.getText().toString().isEmpty()) {\n if (helper.update(name.getText().toString(), salary.getText().toString())) {\n Toast.makeText(MainActivity.this, \"Updated\", Toast.LENGTH_LONG).show();\n } else {\n Toast.makeText(MainActivity.this, \"NOT Updated\", Toast.LENGTH_LONG).show();\n }\n } else {\n name.setError(\"Enter NAME\");\n salary.setError(\"Enter Salary\");\n }\n }\n });\n findViewById(R.id.refresh).setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n array_list.clear();\n array_list.addAll(helper.getAllCotacts());\n arrayAdapter.notifyDataSetChanged();\n listView.invalidateViews();\n listView.refreshDrawableState();\n }\n });\n findViewById(R.id.save).setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n if (!name.getText().toString().isEmpty() && !salary.getText().toString().isEmpty()) {\n if (helper.insert(name.getText().toString(), salary.getText().toString())) {\n Toast.makeText(MainActivity.this, \"Inserted\", Toast.LENGTH_LONG).show();\n } else {\n Toast.makeText(MainActivity.this, \"NOT Inserted\", Toast.LENGTH_LONG).show();\n }\n } else {\n name.setError(\"Enter NAME\");\n salary.setError(\"Enter Salary\");\n }\n }\n });\n }\n}"
},
{
"code": null,
"e": 7147,
"s": 7087,
"text": "Step 4 − Add the following code to src/ DatabaseHelper.java"
},
{
"code": null,
"e": 9664,
"s": 7147,
"text": "package com.example.andy.myapplication;\nimport android.content.ContentValues;\nimport android.content.Context;\nimport android.database.Cursor;\nimport android.database.sqlite.SQLiteDatabase;\nimport android.database.sqlite.SQLiteException;\nimport android.database.sqlite.SQLiteOpenHelper;\nimport java.io.IOException;\nimport java.util.ArrayList;\nclass DatabaseHelper extends SQLiteOpenHelper {\n public static final String DATABASE_NAME = \"salaryDatabase5\";\n public static final String CONTACTS_TABLE_NAME = \"SalaryDetails\";\n public DatabaseHelper(Context context) {\n super(context,DATABASE_NAME,null,1);\n }\n @Override\n public void onCreate(SQLiteDatabase db) {\n try {\n db.execSQL(\n \"create table \"+ CONTACTS_TABLE_NAME +\"(id INTEGER PRIMARY KEY, name text,salary text,datetime default current_timestamp )\"\n );\n } catch (SQLiteException e) {\n try {\n throw new IOException(e);\n } catch (IOException e1) {\n e1.printStackTrace();\n }\n }\n }\n @Override\n public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {\n db.execSQL(\"DROP TABLE IF EXISTS \"+CONTACTS_TABLE_NAME);\n onCreate(db);\n }\n public boolean insert(String s, String s1) {\n SQLiteDatabase db = this.getWritableDatabase();\n ContentValues contentValues = new ContentValues();\n contentValues.put(\"name\", s);\n contentValues.put(\"salary\", s1);\n db.replace(CONTACTS_TABLE_NAME, null, contentValues);\n return true;\n }\n public ArrayList getAllCotacts() {\n SQLiteDatabase db = this.getReadableDatabase();\n ArrayList<String> array_list = new ArrayList<String>();\n Cursor res = db.rawQuery( \"select (id ||' : '||name || ' : ' || salary || ' : '|| datetime) AS fullname from \"+CONTACTS_TABLE_NAME+\" WHERE datetime > = DATE('now', 'weekday 0', '-7 days') \", null );\n res.moveToFirst();\n while(res.isAfterLast() = = false) {\n array_list.add(res.getString(res.getColumnIndex(\"fullname\")));\n res.moveToNext();\n }\n return array_list;\n }\n public boolean update(String s, String s1) {\n SQLiteDatabase db = this.getWritableDatabase();\n db.execSQL(\"UPDATE \"+CONTACTS_TABLE_NAME+\" SET name = \"+\"'\"+s+\"', \"+ \"salary = \"+\"'\"+s1+\"'\");\n return true;\n }\n public boolean delete() {\n SQLiteDatabase db = this.getWritableDatabase();\n db.execSQL(\"DELETE from \"+CONTACTS_TABLE_NAME);\n return true;\n }\n}"
},
{
"code": null,
"e": 10015,
"s": 9664,
"text": "Let's try to run your application. I assume you have connected your actual Android Mobile device with your computer. To run the app from the android studio, open one of your project's activity files and click Run icon from the toolbar. Select your mobile device as an option and then check your mobile device which will display your default screen –"
},
{
"code": null,
"e": 10178,
"s": 10015,
"text": "In the above result, we are showing one-week data of this week and as per our database records we have only two days records so it is showing only two dates data."
},
{
"code": null,
"e": 10218,
"s": 10178,
"text": "Click here to download the project code"
}
] |
CSS 2D Transforms - GeeksforGeeks | 08 Nov, 2021
A transformation in CSS is used to modify an element by its shape, size and position. It transforms the elements along the X-axis and Y-axis. There are 6 main types of transformation which are listed below:
translate()
rotate()
scale()
skewX()
skewY()
matrix()
We will implement all these functions & will understand their concepts through the examples.
translate() Method: The translate() method is used to move the element from its actual position along the X-axis and Y-axis.
Example: This example describes the CSS translate() method to modify the position of an element from its actual position.
HTML
<!DOCTYPE html><html> <head> <title>2D Transform</title> <style> .geeks { font-size: 25px; margin: 20px 0; margin-left: 100px; } img { border: 1px solid black; transition-duration: 2s; -webkit-transition-duration: 2s; } img:hover { transform: translate(100px, 100px); /* prefix for IE 9 */ -ms-transform: translate(100px, 100px); /* prefix for Safari and Chrome */ -webkit-transform: translate(100px, 100px); } </style></head> <body> <div class="geeks">Translate() Method</div> <img src="https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-9.png" alt="GFG" /></body> </html>
Output:
rotate() Method: The rotate() method rotates an element clockwise or counter-clockwise according to a given degree. The degree is given in the parenthesis.
Example: This example describes the CSS rotate() method to rotate an element clockwise or counterclockwise.
HTML
<!DOCTYPE html><html> <head> <title>2D Transform</title> <style> img { border: 1px solid black; } img:hover { /* IE 9 */ -ms-transform: rotate(20deg); /* Safari */ -webkit-transform: rotate(20deg); /* Standard syntax */ transform: rotate(20deg); } .geeks { font-size: 25px; text-align: center; margin-top: 100px; } </style></head> <body> <div class="geeks">Rotation() Method</div> <img src="https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-9.png" alt="GFG" /></body> </html>
Output:
Counter-clockwise rotation: Use negative values to rotate the element counter clockwise.
Example: This example describes the CSS Counter-clock rotate() method to rotate an element clockwise using the negative values.
HTML
<!DOCTYPE html><html> <head> <title>2D Transform</title> <style> img { border: 1px solid black; } img:hover { /* IE 9 */ -ms-transform: rotate(-20deg); /* Safari */ -webkit-transform: rotate(-20deg); /* Standard syntax */ transform: rotate(-20deg); } .geeks { font-size: 25px; text-align: center; margin-top: 100px; } </style></head> <body> <div class="geeks">Counter-clock Rotate() Method</div> <img src="https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-9.png" alt="GFG" /></body> </html>
Output:
scale() Method: It is used to increase or decrease the size of an element according to the parameter given for the width and height.
Example: This example describes the CSS scale() method to resize the element according to their width & height.
HTML
<!DOCTYPE html><html> <head> <title>2D Transform</title> <style> img { border: 1px solid black; } img:hover { /* IE 9 */ -ms-transform: scale(1, 2); /* Safari */ -webkit-transform: scale(1, 1); /* Standard syntax */ transform: scale(1, 2); } .geeks { font-size: 25px; text-align: center; margin-top: 100px; } </style></head> <body> <div class="geeks">Scale() Method</div> <img src="https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-9.png" alt="GFG" /></body> </html>
Output:
Note: The size of elements can be decreased using half of their width and height.
skewX() Method: This method is used to skew an element in the given angle along the X-axis.
Example: This example describes the CSS skewX() method to skew the element in X-axis.
HTML
<!DOCTYPE html><html> <head> <title>2D Transform</title> <style> img { border: 1px solid black; } img:hover { /* IE 9 */ -ms-transform: skewX(20deg); /* Safari */ -webkit-transform: skewX(20deg); /* Standard syntax */ transform: skewX(20deg); } .geeks { font-size: 25px; text-align: center; margin-top: 100px; } </style></head> <body> <div class="geeks">skewX() Method</div> <img src="https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-9.png" alt="GFG" /></body> </html>
Output:
skewY() Method: This method is used to skew an element in the given angle along the Y-axis.
Example: This example describes the CSS skewY() method to skew the element in Y-axis.
HTML
<!DOCTYPE html><html> <head> <title>2D Transform</title> <style> img { border: 1px solid black; } img:hover { /* IE 9 */ -ms-transform: skewY(20deg); /* Safari */ -webkit-transform: skewY(20deg); /* Standard syntax */ transform: skewY(20deg); } .geeks { font-size: 25px; text-align: center; margin-top: 100px; } </style></head> <body> <div class="geeks">skewY() Method</div> <img src="https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-9.png" alt="GFG" /></body> </html>
Output:
skew() Method: This method skews an element in the given angle along the X-axis and the Y-axis. The following example skews the element 20 degrees along the X-axis and 10 degrees along the Y-axis.
Example: This example describes the CSS skew() method to skew an element in the given angle along the X-axis and the Y-axis.
HTML
<!DOCTYPE html><html> <head> <title>2D Transform</title> <style> img { border: 1px solid black; } img:hover { /* IE 9 */ -ms-transform: skew(20deg, 10deg); /* Safari */ -webkit-transform: skew(20deg, 10deg); /* Standard syntax */ transform: skew(20deg, 10deg); } .geeks { font-size: 25px; text-align: center; margin-top: 100px; } </style></head> <body> <div class="geeks">skew() Method</div> <img src="https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-9.png" alt="GFG" /></body> </html>
Output:
matrix() Method: This method combines all the 2D transform property into a single property. The matrix transform property accepts six parameters as matrix( scaleX(), skewY(), skewX(), scaleY(), translateX(), translateY() ).
Example: This example describes the CSS matrix() method to combine all the 2D transform properties into a single property.
HTML
<!DOCTYPE html><html> <head> <title>2D Transform</title> <style> img { border: 1px solid black; } img:hover { /* IE 9 */ -ms-transform: matrix(1, -0.3, 0, 1, 0, 0); /* Safari */ -webkit-transform: matrix(1, -0.3, 0, 1, 0, 0); /* Standard syntax */ transform: matrix(1, -0.3, 0, 1, 0, 0); } .geeks { font-size: 25px; text-align: center; margin-top: 100px; } </style></head> <body> <div class="geeks">matrix() Method</div> <img src="https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-9.png" alt="GFG" /></body> </html>
Output:
Supported Browsers:
Google Chrome 36.0
Microsoft Edge 12.0
Internet Explorer 10.0
Firefox 16.0
Opera 23.0
Safari 9.0
Note: Internet Explorer does not support the global values initial and unset.
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML course.
bhaskargeeksforgeeks
CSS-Advanced
CSS
HTML
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
How to insert spaces/tabs in text using HTML/CSS?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
Build a Survey Form using HTML and CSS
Primer CSS Flexbox Flex Direction
How to Upload Image into Database and Display it using PHP ?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to insert spaces/tabs in text using HTML/CSS?
How to set the default value for an HTML <select> element ?
How to update Node.js and NPM to next version ?
How to set input type date in dd-mm-yyyy format using HTML ? | [
{
"code": null,
"e": 27655,
"s": 27627,
"text": "\n08 Nov, 2021"
},
{
"code": null,
"e": 27862,
"s": 27655,
"text": "A transformation in CSS is used to modify an element by its shape, size and position. It transforms the elements along the X-axis and Y-axis. There are 6 main types of transformation which are listed below:"
},
{
"code": null,
"e": 27874,
"s": 27862,
"text": "translate()"
},
{
"code": null,
"e": 27883,
"s": 27874,
"text": "rotate()"
},
{
"code": null,
"e": 27891,
"s": 27883,
"text": "scale()"
},
{
"code": null,
"e": 27899,
"s": 27891,
"text": "skewX()"
},
{
"code": null,
"e": 27907,
"s": 27899,
"text": "skewY()"
},
{
"code": null,
"e": 27916,
"s": 27907,
"text": "matrix()"
},
{
"code": null,
"e": 28009,
"s": 27916,
"text": "We will implement all these functions & will understand their concepts through the examples."
},
{
"code": null,
"e": 28134,
"s": 28009,
"text": "translate() Method: The translate() method is used to move the element from its actual position along the X-axis and Y-axis."
},
{
"code": null,
"e": 28256,
"s": 28134,
"text": "Example: This example describes the CSS translate() method to modify the position of an element from its actual position."
},
{
"code": null,
"e": 28261,
"s": 28256,
"text": "HTML"
},
{
"code": "<!DOCTYPE html><html> <head> <title>2D Transform</title> <style> .geeks { font-size: 25px; margin: 20px 0; margin-left: 100px; } img { border: 1px solid black; transition-duration: 2s; -webkit-transition-duration: 2s; } img:hover { transform: translate(100px, 100px); /* prefix for IE 9 */ -ms-transform: translate(100px, 100px); /* prefix for Safari and Chrome */ -webkit-transform: translate(100px, 100px); } </style></head> <body> <div class=\"geeks\">Translate() Method</div> <img src=\"https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-9.png\" alt=\"GFG\" /></body> </html>",
"e": 29003,
"s": 28261,
"text": null
},
{
"code": null,
"e": 29011,
"s": 29003,
"text": "Output:"
},
{
"code": null,
"e": 29167,
"s": 29011,
"text": "rotate() Method: The rotate() method rotates an element clockwise or counter-clockwise according to a given degree. The degree is given in the parenthesis."
},
{
"code": null,
"e": 29275,
"s": 29167,
"text": "Example: This example describes the CSS rotate() method to rotate an element clockwise or counterclockwise."
},
{
"code": null,
"e": 29280,
"s": 29275,
"text": "HTML"
},
{
"code": "<!DOCTYPE html><html> <head> <title>2D Transform</title> <style> img { border: 1px solid black; } img:hover { /* IE 9 */ -ms-transform: rotate(20deg); /* Safari */ -webkit-transform: rotate(20deg); /* Standard syntax */ transform: rotate(20deg); } .geeks { font-size: 25px; text-align: center; margin-top: 100px; } </style></head> <body> <div class=\"geeks\">Rotation() Method</div> <img src=\"https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-9.png\" alt=\"GFG\" /></body> </html>",
"e": 29927,
"s": 29280,
"text": null
},
{
"code": null,
"e": 29935,
"s": 29927,
"text": "Output:"
},
{
"code": null,
"e": 30024,
"s": 29935,
"text": "Counter-clockwise rotation: Use negative values to rotate the element counter clockwise."
},
{
"code": null,
"e": 30152,
"s": 30024,
"text": "Example: This example describes the CSS Counter-clock rotate() method to rotate an element clockwise using the negative values."
},
{
"code": null,
"e": 30157,
"s": 30152,
"text": "HTML"
},
{
"code": "<!DOCTYPE html><html> <head> <title>2D Transform</title> <style> img { border: 1px solid black; } img:hover { /* IE 9 */ -ms-transform: rotate(-20deg); /* Safari */ -webkit-transform: rotate(-20deg); /* Standard syntax */ transform: rotate(-20deg); } .geeks { font-size: 25px; text-align: center; margin-top: 100px; } </style></head> <body> <div class=\"geeks\">Counter-clock Rotate() Method</div> <img src=\"https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-9.png\" alt=\"GFG\" /></body> </html>",
"e": 30810,
"s": 30157,
"text": null
},
{
"code": null,
"e": 30818,
"s": 30810,
"text": "Output:"
},
{
"code": null,
"e": 30951,
"s": 30818,
"text": "scale() Method: It is used to increase or decrease the size of an element according to the parameter given for the width and height."
},
{
"code": null,
"e": 31063,
"s": 30951,
"text": "Example: This example describes the CSS scale() method to resize the element according to their width & height."
},
{
"code": null,
"e": 31068,
"s": 31063,
"text": "HTML"
},
{
"code": "<!DOCTYPE html><html> <head> <title>2D Transform</title> <style> img { border: 1px solid black; } img:hover { /* IE 9 */ -ms-transform: scale(1, 2); /* Safari */ -webkit-transform: scale(1, 1); /* Standard syntax */ transform: scale(1, 2); } .geeks { font-size: 25px; text-align: center; margin-top: 100px; } </style></head> <body> <div class=\"geeks\">Scale() Method</div> <img src=\"https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-9.png\" alt=\"GFG\" /></body> </html>",
"e": 31679,
"s": 31068,
"text": null
},
{
"code": null,
"e": 31688,
"s": 31679,
"text": "Output: "
},
{
"code": null,
"e": 31770,
"s": 31688,
"text": "Note: The size of elements can be decreased using half of their width and height."
},
{
"code": null,
"e": 31862,
"s": 31770,
"text": "skewX() Method: This method is used to skew an element in the given angle along the X-axis."
},
{
"code": null,
"e": 31948,
"s": 31862,
"text": "Example: This example describes the CSS skewX() method to skew the element in X-axis."
},
{
"code": null,
"e": 31953,
"s": 31948,
"text": "HTML"
},
{
"code": "<!DOCTYPE html><html> <head> <title>2D Transform</title> <style> img { border: 1px solid black; } img:hover { /* IE 9 */ -ms-transform: skewX(20deg); /* Safari */ -webkit-transform: skewX(20deg); /* Standard syntax */ transform: skewX(20deg); } .geeks { font-size: 25px; text-align: center; margin-top: 100px; } </style></head> <body> <div class=\"geeks\">skewX() Method</div> <img src=\"https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-9.png\" alt=\"GFG\" /></body> </html>",
"e": 32594,
"s": 31953,
"text": null
},
{
"code": null,
"e": 32602,
"s": 32594,
"text": "Output:"
},
{
"code": null,
"e": 32694,
"s": 32602,
"text": "skewY() Method: This method is used to skew an element in the given angle along the Y-axis."
},
{
"code": null,
"e": 32780,
"s": 32694,
"text": "Example: This example describes the CSS skewY() method to skew the element in Y-axis."
},
{
"code": null,
"e": 32785,
"s": 32780,
"text": "HTML"
},
{
"code": "<!DOCTYPE html><html> <head> <title>2D Transform</title> <style> img { border: 1px solid black; } img:hover { /* IE 9 */ -ms-transform: skewY(20deg); /* Safari */ -webkit-transform: skewY(20deg); /* Standard syntax */ transform: skewY(20deg); } .geeks { font-size: 25px; text-align: center; margin-top: 100px; } </style></head> <body> <div class=\"geeks\">skewY() Method</div> <img src=\"https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-9.png\" alt=\"GFG\" /></body> </html>",
"e": 33426,
"s": 32785,
"text": null
},
{
"code": null,
"e": 33435,
"s": 33426,
"text": "Output: "
},
{
"code": null,
"e": 33632,
"s": 33435,
"text": "skew() Method: This method skews an element in the given angle along the X-axis and the Y-axis. The following example skews the element 20 degrees along the X-axis and 10 degrees along the Y-axis."
},
{
"code": null,
"e": 33757,
"s": 33632,
"text": "Example: This example describes the CSS skew() method to skew an element in the given angle along the X-axis and the Y-axis."
},
{
"code": null,
"e": 33762,
"s": 33757,
"text": "HTML"
},
{
"code": "<!DOCTYPE html><html> <head> <title>2D Transform</title> <style> img { border: 1px solid black; } img:hover { /* IE 9 */ -ms-transform: skew(20deg, 10deg); /* Safari */ -webkit-transform: skew(20deg, 10deg); /* Standard syntax */ transform: skew(20deg, 10deg); } .geeks { font-size: 25px; text-align: center; margin-top: 100px; } </style></head> <body> <div class=\"geeks\">skew() Method</div> <img src=\"https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-9.png\" alt=\"GFG\" /></body> </html>",
"e": 34420,
"s": 33762,
"text": null
},
{
"code": null,
"e": 34429,
"s": 34420,
"text": "Output: "
},
{
"code": null,
"e": 34653,
"s": 34429,
"text": "matrix() Method: This method combines all the 2D transform property into a single property. The matrix transform property accepts six parameters as matrix( scaleX(), skewY(), skewX(), scaleY(), translateX(), translateY() )."
},
{
"code": null,
"e": 34776,
"s": 34653,
"text": "Example: This example describes the CSS matrix() method to combine all the 2D transform properties into a single property."
},
{
"code": null,
"e": 34781,
"s": 34776,
"text": "HTML"
},
{
"code": "<!DOCTYPE html><html> <head> <title>2D Transform</title> <style> img { border: 1px solid black; } img:hover { /* IE 9 */ -ms-transform: matrix(1, -0.3, 0, 1, 0, 0); /* Safari */ -webkit-transform: matrix(1, -0.3, 0, 1, 0, 0); /* Standard syntax */ transform: matrix(1, -0.3, 0, 1, 0, 0); } .geeks { font-size: 25px; text-align: center; margin-top: 100px; } </style></head> <body> <div class=\"geeks\">matrix() Method</div> <img src=\"https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-9.png\" alt=\"GFG\" /></body> </html>",
"e": 35468,
"s": 34781,
"text": null
},
{
"code": null,
"e": 35477,
"s": 35468,
"text": "Output: "
},
{
"code": null,
"e": 35497,
"s": 35477,
"text": "Supported Browsers:"
},
{
"code": null,
"e": 35516,
"s": 35497,
"text": "Google Chrome 36.0"
},
{
"code": null,
"e": 35536,
"s": 35516,
"text": "Microsoft Edge 12.0"
},
{
"code": null,
"e": 35559,
"s": 35536,
"text": "Internet Explorer 10.0"
},
{
"code": null,
"e": 35572,
"s": 35559,
"text": "Firefox 16.0"
},
{
"code": null,
"e": 35583,
"s": 35572,
"text": "Opera 23.0"
},
{
"code": null,
"e": 35594,
"s": 35583,
"text": "Safari 9.0"
},
{
"code": null,
"e": 35672,
"s": 35594,
"text": "Note: Internet Explorer does not support the global values initial and unset."
},
{
"code": null,
"e": 35809,
"s": 35672,
"text": "Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML course."
},
{
"code": null,
"e": 35830,
"s": 35809,
"text": "bhaskargeeksforgeeks"
},
{
"code": null,
"e": 35843,
"s": 35830,
"text": "CSS-Advanced"
},
{
"code": null,
"e": 35847,
"s": 35843,
"text": "CSS"
},
{
"code": null,
"e": 35852,
"s": 35847,
"text": "HTML"
},
{
"code": null,
"e": 35869,
"s": 35852,
"text": "Web Technologies"
},
{
"code": null,
"e": 35874,
"s": 35869,
"text": "HTML"
},
{
"code": null,
"e": 35972,
"s": 35874,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 35981,
"s": 35972,
"text": "Comments"
},
{
"code": null,
"e": 35994,
"s": 35981,
"text": "Old Comments"
},
{
"code": null,
"e": 36044,
"s": 35994,
"text": "How to insert spaces/tabs in text using HTML/CSS?"
},
{
"code": null,
"e": 36106,
"s": 36044,
"text": "Top 10 Projects For Beginners To Practice HTML and CSS Skills"
},
{
"code": null,
"e": 36145,
"s": 36106,
"text": "Build a Survey Form using HTML and CSS"
},
{
"code": null,
"e": 36179,
"s": 36145,
"text": "Primer CSS Flexbox Flex Direction"
},
{
"code": null,
"e": 36240,
"s": 36179,
"text": "How to Upload Image into Database and Display it using PHP ?"
},
{
"code": null,
"e": 36302,
"s": 36240,
"text": "Top 10 Projects For Beginners To Practice HTML and CSS Skills"
},
{
"code": null,
"e": 36352,
"s": 36302,
"text": "How to insert spaces/tabs in text using HTML/CSS?"
},
{
"code": null,
"e": 36412,
"s": 36352,
"text": "How to set the default value for an HTML <select> element ?"
},
{
"code": null,
"e": 36460,
"s": 36412,
"text": "How to update Node.js and NPM to next version ?"
}
] |
Polygon.io Review — Retrieving Historical Tick Data | by Mario Emmanuel | Towards Data Science | During last months one of my main objectives and one of the most time-consuming tasks has been to extract edges from tick data for Intraday operations.
Within this context, a quality data feed becomes extremely important. I have started to use Polygon.io to get tick data from SPY as I want to test a set of discretionary strategies I have been learning during the last months. The strategies are intended to be operated on Futures but I want to evaluate if they work with other assets/instruments such as the SPY ETF and Forex instruments.
This article covers the retrieval of historical data via their REST API. I will also briefly cover the size of the data involved.
The first thing you need to understand is that tick data usually involves two separate data feeds. One covers the top of book, including best bid and best ask values and the other one covers the actual trades. In equities (SPY is an ETF, but ETFs are traded as equities), there are different exchanges where trade can take place. That means that there is not a central point where the trades take place. The US has currently 13 listed exchanges. Not all assets are traded in every exchange, but they are neither traded in just one. There are also dark pools and private exchanges, where Institutional players can cross orders and large brokers can also cross orders among customers.
That means that the simplified view of a single, unified, continuous and unique stream of quotes and trades does not exist in the real world.
All market information is consolidated by SIPs (Securities Information Processors), which are regulated entities that consolidate and provide a unified data feed on equities. They define a clear and deterministic set of rules on how trades are consolidated. The two operating SIPs in the US are The Consolidated Tape Association (CTA) and the Unlisted Trading Privileges (UTP). Those SIPs consolidate NYSE and NASDAQ listed symbols respectively. Pretty good information on how they work can be found in this Blog entry.
While this information is not important for a retail trader (very few people understands how all this mumbo jumbo works), there is a couple of important takeaways to know:
Stocks are traded in different places, so they are not fully centralised. What you see with a quality real-time data feed is just a decent proxy on what it is actually happening in the market.Different timestamps relates information at the SIP and at the exchange. They are not relevant for the retail but are relevant to relate Bid/Ask prices with Trades (such as required by OrderFlow and Delta analysis).
Stocks are traded in different places, so they are not fully centralised. What you see with a quality real-time data feed is just a decent proxy on what it is actually happening in the market.
Different timestamps relates information at the SIP and at the exchange. They are not relevant for the retail but are relevant to relate Bid/Ask prices with Trades (such as required by OrderFlow and Delta analysis).
The situation is the same for the Depth of Book, but I will not cover that because at this moment I am not analysing Depth of book in any of my strategies.
In order to get historic quotes, use /v2/ticks/stocks/nbbo/{ticker}/{date} request
Historical data can be retrieved from Polygon via their REST API interface. The server will submit a maximum of 50,000 records for each request. While 50,000 records for OHLC daily data represents more than 200 years of stock market history, it is just a small fraction of the daily data volume for tick data.
Basic date and ticker parameters are included as part of the URL:
ticker:string, ticker name (i.e. SPY for SPDR S&P500 ETF)date:string, date in YYYY-MM-DD format. Notice that the API assumes Eastern Time by default, so 2020-06-15 means 2020-06-15 00:00 New York time.
After a long (and often painful) work with timezones, I have concluded that an easy and consistent way is to store and process all your market data in ET. It is widely used as reference timezone for market data (sometimes even for European assets/instruments) and it is also the iconic time reference for financial markets (NYSE RTH opening is an observed daily event for everyone). This does not apply to crypto data, because it operates 24x7 and you will face issues when switching from daylight saving to non-daylight saving. In that case, it is recommended to use GMT.
The API is fully documented here, but I highlight/comment on the following parameters. Notice that these are specified as HTTP GET parameters and not as part of the URL.
timestamp:long value, represents the first epoch timestamp (with nanoseconds resolution) for which data is requested. timestampLimit:long value, represents the last epoch timestamp (with nanoseconds resolution) for which data is requested, provided that the hard limit of 50,000 (or the custom limit) is not reached first. Note that this timestamp is returned, so the value is included.limit:integer value, maximum number of records to be retrieved, 50,000 if not specified.apiKey:string, your API key, required in every request.
As we have the limit of the 50,000 items, it is needed to perform pagination. To perform pagination we will simply use the timestamp parameter. The algorithm is pretty simple: if we are receiving 50,000 items we assume that an additional request is required, we specify the latest received timestamp as a parameter in the next request. We do that until the last request receives less than 50,000 items. That means that there are no more requests to be done.
Three specific details must be taken into consideration:
It is a good idea to set up timestampLimit as the next day’s 00:00 time. As API includes timesetampLimit as a valid returned item, we need to exclude later that value from the returned results.
The timestamp used for the successive request is included twice, as it is the boundary between the n and the n+1 requests. Hence it is important to remove it from the n request when an n+1 request is planned.
It might be the case that we receive 50,000 items and those are exactly all the data available. In that case, our algorithm will request a new batch which shall return only one result. This is not an issue and it is part of how the algorithm does pagination.
An alternative would be to add a 1 nanoseconds to the timestamp request for successive requests; this would theoretically avoid the need for duplicates in subsequent requests. As I am not 100% sure that two records can be received for the same nanosecond epoch timestamp, I have decided not to follow that path, as the previous one can handle that scenario of multiple records for the same timestamp.
The very same algorithm is used both for Quotes and Trades (and could be coded in a separate shared method/routine).
In order to get historic trades, use /v2/ticks/stocks/trades/{ticker}/{date} request
As already mentioned, historical trades can be retrieved similarly. The same conditions and parameters apply.
Historical trades shall be almost always stored and processed locally to avoid overhead. Higher timeframes can be requested on-demand, but requesting months of historical tick data on-demand on every backtesting iteration is simply not practical.
I always try to store an easy to read and easy to parse file with raw data, using ASCII text files if possible. In this example, we create two files (quotes and trades).
user@almaz:~/NetBeansProjects/SealionPolygonAdapter % java -jar dist/SealionPolygonAdapter.jar159238734271500798615923935052033437761592398291430866793...1592419244447798705159242198141006489615924234856001943781592423485600194378user@almaz:~/NetBeansProjects/SealionPolygonAdapter % ls -lh data/*-rw-r--r-- 1 user user 399M Jun 21 19:04 data/SPY.2020-06-17.quote.json-rw-r--r-- 1 user user 54M Jun 21 19:05 data/SPY.2020-06-17.trade.jsonuser@almaz:~/NetBeansProjects/SealionPolygonAdapter % head data/SPY.2020-06-17.quote.json {"p":313.9,"P":315,"q":9801,"c":[1,81],"s":2,"S":1,"t":1592380800048084434,"x":12,"X":11,"y":1592380800047963904,"z":1}{"p":313.9,"P":315,"q":9901,"c":[1,81],"s":2,"S":5,"t":1592380800048834673,"x":12,"X":11,"y":1592380800048768512,"z":1}{"p":313.9,"P":315,"q":10001,"c":[1,81],"s":2,"S":6,"t":1592380800048839409,"x":12,"X":11,"y":1592380800048774400,"z":1}...
The data is stored as one JSON object per line which can be easily parsed (notice that it is also inefficient in terms of storage and performance). It uses around 450Mb per day, which is around 100Gb of data per year. If you are storing many assets, one key factor would be to pay attention to integer compression algorithms. Using proprietary and optimised databases will save space, although as a trade-off it has a cost in terms of development and debugging effort and an increase in operational complexity. I still like to have a plain backup of readable data, even if I further transform the data to a more performance-friendly format.
We can also notice the amount of data that every trading day involves:
user@almaz:~/NetBeansProjects/SealionPolygonAdapter % wc data/SPY.2020-06-17.quote.json 3060489 3060489 418579482 data/SPY.2020-06-17.quote.jsonuser@almaz:~/NetBeansProjects/SealionPolygonAdapter % wc data/SPY.2020-06-17.trade.json 435989 435989 56996300 data/SPY.2020-06-17.trade.json
SPY has an outstanding figure of 3 millions of quote ticks and more than 400K trade ticks in a single day.
In order to use the data in any backtesting or custom tool, further processing is likely required, but as mentioned at the beginning of the article, storing data in simple ASCII readable data is useful as a permanent backup. This will simplify development and conversion time and will decouple data historical provider from our analysis toolchain.
A simple but efficient way of improving this would be to compress both archives. In such case we get:
user@almaz:~/NetBeansProjects/SealionPolygonAdapter % gzip data/SPY.2020-06-17.quote.jsonuser@almaz:~/NetBeansProjects/SealionPolygonAdapter % gzip data/SPY.2020-06-17.trade.jsonuser@almaz:~/NetBeansProjects/SealionPolygonAdapter % ls -lh data/*-rw-r--r-- 1 user user 54M Jun 21 19:04 data/SPY.2020-06-17.quote.json.gz-rw-r--r-- 1 user user 9.2M Jun 21 19:05 data/SPY.2020-06-17.trade.json.gz
By just using the standard gzip tool we get just 64Mb/day, which requires around 16Gb per year. A much more friendly storage size that can be easily fulfilled without special resources.
Compression and decompression take time, so this shall be used only as a permanent data backup.
A basic version of the source code to retrieve historical quotes (both quotes & trades) is included as reference below. Notice that the code is beta and not optimised, it is intended to show a use case in Java that clarifies how to access historical tick data. It can be easily ported to other languages.
The data is retrieved in JSON format, which is a format that makes debugging easy. The tradeoff is that that JSON is far from being an efficient format. For a historical data retrieval API, this is in my opinion not relevant, especially if data is retrieved in batch mode for backtesting purposes. In that scenario, the simplicity and maintainability provided by JSON are clear advantages.
For this particular implementation, I have used simple-json v1.1.1 as a companion library to parse JSON. This library is no longer maintained in its version 1, but it is a fully working library, extremely simple to use and lightweight. | [
{
"code": null,
"e": 324,
"s": 172,
"text": "During last months one of my main objectives and one of the most time-consuming tasks has been to extract edges from tick data for Intraday operations."
},
{
"code": null,
"e": 713,
"s": 324,
"text": "Within this context, a quality data feed becomes extremely important. I have started to use Polygon.io to get tick data from SPY as I want to test a set of discretionary strategies I have been learning during the last months. The strategies are intended to be operated on Futures but I want to evaluate if they work with other assets/instruments such as the SPY ETF and Forex instruments."
},
{
"code": null,
"e": 843,
"s": 713,
"text": "This article covers the retrieval of historical data via their REST API. I will also briefly cover the size of the data involved."
},
{
"code": null,
"e": 1526,
"s": 843,
"text": "The first thing you need to understand is that tick data usually involves two separate data feeds. One covers the top of book, including best bid and best ask values and the other one covers the actual trades. In equities (SPY is an ETF, but ETFs are traded as equities), there are different exchanges where trade can take place. That means that there is not a central point where the trades take place. The US has currently 13 listed exchanges. Not all assets are traded in every exchange, but they are neither traded in just one. There are also dark pools and private exchanges, where Institutional players can cross orders and large brokers can also cross orders among customers."
},
{
"code": null,
"e": 1668,
"s": 1526,
"text": "That means that the simplified view of a single, unified, continuous and unique stream of quotes and trades does not exist in the real world."
},
{
"code": null,
"e": 2188,
"s": 1668,
"text": "All market information is consolidated by SIPs (Securities Information Processors), which are regulated entities that consolidate and provide a unified data feed on equities. They define a clear and deterministic set of rules on how trades are consolidated. The two operating SIPs in the US are The Consolidated Tape Association (CTA) and the Unlisted Trading Privileges (UTP). Those SIPs consolidate NYSE and NASDAQ listed symbols respectively. Pretty good information on how they work can be found in this Blog entry."
},
{
"code": null,
"e": 2360,
"s": 2188,
"text": "While this information is not important for a retail trader (very few people understands how all this mumbo jumbo works), there is a couple of important takeaways to know:"
},
{
"code": null,
"e": 2768,
"s": 2360,
"text": "Stocks are traded in different places, so they are not fully centralised. What you see with a quality real-time data feed is just a decent proxy on what it is actually happening in the market.Different timestamps relates information at the SIP and at the exchange. They are not relevant for the retail but are relevant to relate Bid/Ask prices with Trades (such as required by OrderFlow and Delta analysis)."
},
{
"code": null,
"e": 2961,
"s": 2768,
"text": "Stocks are traded in different places, so they are not fully centralised. What you see with a quality real-time data feed is just a decent proxy on what it is actually happening in the market."
},
{
"code": null,
"e": 3177,
"s": 2961,
"text": "Different timestamps relates information at the SIP and at the exchange. They are not relevant for the retail but are relevant to relate Bid/Ask prices with Trades (such as required by OrderFlow and Delta analysis)."
},
{
"code": null,
"e": 3333,
"s": 3177,
"text": "The situation is the same for the Depth of Book, but I will not cover that because at this moment I am not analysing Depth of book in any of my strategies."
},
{
"code": null,
"e": 3416,
"s": 3333,
"text": "In order to get historic quotes, use /v2/ticks/stocks/nbbo/{ticker}/{date} request"
},
{
"code": null,
"e": 3726,
"s": 3416,
"text": "Historical data can be retrieved from Polygon via their REST API interface. The server will submit a maximum of 50,000 records for each request. While 50,000 records for OHLC daily data represents more than 200 years of stock market history, it is just a small fraction of the daily data volume for tick data."
},
{
"code": null,
"e": 3792,
"s": 3726,
"text": "Basic date and ticker parameters are included as part of the URL:"
},
{
"code": null,
"e": 3994,
"s": 3792,
"text": "ticker:string, ticker name (i.e. SPY for SPDR S&P500 ETF)date:string, date in YYYY-MM-DD format. Notice that the API assumes Eastern Time by default, so 2020-06-15 means 2020-06-15 00:00 New York time."
},
{
"code": null,
"e": 4567,
"s": 3994,
"text": "After a long (and often painful) work with timezones, I have concluded that an easy and consistent way is to store and process all your market data in ET. It is widely used as reference timezone for market data (sometimes even for European assets/instruments) and it is also the iconic time reference for financial markets (NYSE RTH opening is an observed daily event for everyone). This does not apply to crypto data, because it operates 24x7 and you will face issues when switching from daylight saving to non-daylight saving. In that case, it is recommended to use GMT."
},
{
"code": null,
"e": 4737,
"s": 4567,
"text": "The API is fully documented here, but I highlight/comment on the following parameters. Notice that these are specified as HTTP GET parameters and not as part of the URL."
},
{
"code": null,
"e": 5267,
"s": 4737,
"text": "timestamp:long value, represents the first epoch timestamp (with nanoseconds resolution) for which data is requested. timestampLimit:long value, represents the last epoch timestamp (with nanoseconds resolution) for which data is requested, provided that the hard limit of 50,000 (or the custom limit) is not reached first. Note that this timestamp is returned, so the value is included.limit:integer value, maximum number of records to be retrieved, 50,000 if not specified.apiKey:string, your API key, required in every request."
},
{
"code": null,
"e": 5725,
"s": 5267,
"text": "As we have the limit of the 50,000 items, it is needed to perform pagination. To perform pagination we will simply use the timestamp parameter. The algorithm is pretty simple: if we are receiving 50,000 items we assume that an additional request is required, we specify the latest received timestamp as a parameter in the next request. We do that until the last request receives less than 50,000 items. That means that there are no more requests to be done."
},
{
"code": null,
"e": 5782,
"s": 5725,
"text": "Three specific details must be taken into consideration:"
},
{
"code": null,
"e": 5976,
"s": 5782,
"text": "It is a good idea to set up timestampLimit as the next day’s 00:00 time. As API includes timesetampLimit as a valid returned item, we need to exclude later that value from the returned results."
},
{
"code": null,
"e": 6185,
"s": 5976,
"text": "The timestamp used for the successive request is included twice, as it is the boundary between the n and the n+1 requests. Hence it is important to remove it from the n request when an n+1 request is planned."
},
{
"code": null,
"e": 6444,
"s": 6185,
"text": "It might be the case that we receive 50,000 items and those are exactly all the data available. In that case, our algorithm will request a new batch which shall return only one result. This is not an issue and it is part of how the algorithm does pagination."
},
{
"code": null,
"e": 6845,
"s": 6444,
"text": "An alternative would be to add a 1 nanoseconds to the timestamp request for successive requests; this would theoretically avoid the need for duplicates in subsequent requests. As I am not 100% sure that two records can be received for the same nanosecond epoch timestamp, I have decided not to follow that path, as the previous one can handle that scenario of multiple records for the same timestamp."
},
{
"code": null,
"e": 6962,
"s": 6845,
"text": "The very same algorithm is used both for Quotes and Trades (and could be coded in a separate shared method/routine)."
},
{
"code": null,
"e": 7047,
"s": 6962,
"text": "In order to get historic trades, use /v2/ticks/stocks/trades/{ticker}/{date} request"
},
{
"code": null,
"e": 7157,
"s": 7047,
"text": "As already mentioned, historical trades can be retrieved similarly. The same conditions and parameters apply."
},
{
"code": null,
"e": 7404,
"s": 7157,
"text": "Historical trades shall be almost always stored and processed locally to avoid overhead. Higher timeframes can be requested on-demand, but requesting months of historical tick data on-demand on every backtesting iteration is simply not practical."
},
{
"code": null,
"e": 7574,
"s": 7404,
"text": "I always try to store an easy to read and easy to parse file with raw data, using ASCII text files if possible. In this example, we create two files (quotes and trades)."
},
{
"code": null,
"e": 8473,
"s": 7574,
"text": "user@almaz:~/NetBeansProjects/SealionPolygonAdapter % java -jar dist/SealionPolygonAdapter.jar159238734271500798615923935052033437761592398291430866793...1592419244447798705159242198141006489615924234856001943781592423485600194378user@almaz:~/NetBeansProjects/SealionPolygonAdapter % ls -lh data/*-rw-r--r-- 1 user user 399M Jun 21 19:04 data/SPY.2020-06-17.quote.json-rw-r--r-- 1 user user 54M Jun 21 19:05 data/SPY.2020-06-17.trade.jsonuser@almaz:~/NetBeansProjects/SealionPolygonAdapter % head data/SPY.2020-06-17.quote.json {\"p\":313.9,\"P\":315,\"q\":9801,\"c\":[1,81],\"s\":2,\"S\":1,\"t\":1592380800048084434,\"x\":12,\"X\":11,\"y\":1592380800047963904,\"z\":1}{\"p\":313.9,\"P\":315,\"q\":9901,\"c\":[1,81],\"s\":2,\"S\":5,\"t\":1592380800048834673,\"x\":12,\"X\":11,\"y\":1592380800048768512,\"z\":1}{\"p\":313.9,\"P\":315,\"q\":10001,\"c\":[1,81],\"s\":2,\"S\":6,\"t\":1592380800048839409,\"x\":12,\"X\":11,\"y\":1592380800048774400,\"z\":1}..."
},
{
"code": null,
"e": 9114,
"s": 8473,
"text": "The data is stored as one JSON object per line which can be easily parsed (notice that it is also inefficient in terms of storage and performance). It uses around 450Mb per day, which is around 100Gb of data per year. If you are storing many assets, one key factor would be to pay attention to integer compression algorithms. Using proprietary and optimised databases will save space, although as a trade-off it has a cost in terms of development and debugging effort and an increase in operational complexity. I still like to have a plain backup of readable data, even if I further transform the data to a more performance-friendly format."
},
{
"code": null,
"e": 9185,
"s": 9114,
"text": "We can also notice the amount of data that every trading day involves:"
},
{
"code": null,
"e": 9474,
"s": 9185,
"text": "user@almaz:~/NetBeansProjects/SealionPolygonAdapter % wc data/SPY.2020-06-17.quote.json 3060489 3060489 418579482 data/SPY.2020-06-17.quote.jsonuser@almaz:~/NetBeansProjects/SealionPolygonAdapter % wc data/SPY.2020-06-17.trade.json 435989 435989 56996300 data/SPY.2020-06-17.trade.json"
},
{
"code": null,
"e": 9581,
"s": 9474,
"text": "SPY has an outstanding figure of 3 millions of quote ticks and more than 400K trade ticks in a single day."
},
{
"code": null,
"e": 9929,
"s": 9581,
"text": "In order to use the data in any backtesting or custom tool, further processing is likely required, but as mentioned at the beginning of the article, storing data in simple ASCII readable data is useful as a permanent backup. This will simplify development and conversion time and will decouple data historical provider from our analysis toolchain."
},
{
"code": null,
"e": 10031,
"s": 9929,
"text": "A simple but efficient way of improving this would be to compress both archives. In such case we get:"
},
{
"code": null,
"e": 10433,
"s": 10031,
"text": "user@almaz:~/NetBeansProjects/SealionPolygonAdapter % gzip data/SPY.2020-06-17.quote.jsonuser@almaz:~/NetBeansProjects/SealionPolygonAdapter % gzip data/SPY.2020-06-17.trade.jsonuser@almaz:~/NetBeansProjects/SealionPolygonAdapter % ls -lh data/*-rw-r--r-- 1 user user 54M Jun 21 19:04 data/SPY.2020-06-17.quote.json.gz-rw-r--r-- 1 user user 9.2M Jun 21 19:05 data/SPY.2020-06-17.trade.json.gz"
},
{
"code": null,
"e": 10619,
"s": 10433,
"text": "By just using the standard gzip tool we get just 64Mb/day, which requires around 16Gb per year. A much more friendly storage size that can be easily fulfilled without special resources."
},
{
"code": null,
"e": 10715,
"s": 10619,
"text": "Compression and decompression take time, so this shall be used only as a permanent data backup."
},
{
"code": null,
"e": 11020,
"s": 10715,
"text": "A basic version of the source code to retrieve historical quotes (both quotes & trades) is included as reference below. Notice that the code is beta and not optimised, it is intended to show a use case in Java that clarifies how to access historical tick data. It can be easily ported to other languages."
},
{
"code": null,
"e": 11410,
"s": 11020,
"text": "The data is retrieved in JSON format, which is a format that makes debugging easy. The tradeoff is that that JSON is far from being an efficient format. For a historical data retrieval API, this is in my opinion not relevant, especially if data is retrieved in batch mode for backtesting purposes. In that scenario, the simplicity and maintainability provided by JSON are clear advantages."
}
] |
C# | Random.NextBytes() Method - GeeksforGeeks | 01 May, 2019
The NextBytes(Byte[]) method of the System.Random class in C# is used to fill the elements of a specified array of bytes with random numbers. This method takes a byte array as a parameter and fills it with random numbers.
Syntax:
public virtual void NextBytes (byte[] buffer);
Here, buffer is the array of bytes to contain random numbers.
Exception: This method will give ArgumentNullException if the buffer is null.
Below programs illustrates the use of NextBytes() method:
Example 1:
// C# program to illustrate the// use of Random.NextBytes Methodusing System; class GFG { // Driver code public static void Main() { // Instantiate random number generator Random rand = new Random(); // Instantiate an array of byte Byte[] b = new Byte[10]; rand.NextBytes(b); // Print random numbers in the byte array Console.WriteLine("Printing random numbers"+ " in the byte array"); for (int i = 0; i < 10; i++) Console.WriteLine("{0} -> {1}", i, b[i]); }}
Printing random numbers in the byte array
0 -> 63
1 -> 166
2 -> 5
3 -> 212
4 -> 114
5 -> 94
6 -> 161
7 -> 4
8 -> 226
9 -> 46
Example 2:
// C# program to illustrate the// use of Random.NextBytes Methodusing System; class GFG { // Driver code public static void Main() { // Instantiate random number generator Random rand = new Random(); // Instantiate an array of byte Byte[] b = new Byte[10]; rand.NextBytes(b); // Print random numbers in the byte array Console.WriteLine("Printing random numbers"+ " in the byte array"); foreach(byte byteValue in b) Console.WriteLine("{0}", byteValue); }}
Printing random numbers in the byte array
98
68
221
160
179
78
172
129
121
179
Reference:
https://docs.microsoft.com/en-us/dotnet/api/system.random.nextbytes?view=netframework-4.7.2
CSharp-method
CSharp-Random-Class
C#
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Destructors in C#
Extension Method in C#
HashSet in C# with Examples
Top 50 C# Interview Questions & Answers
C# | How to insert an element in an Array?
Partial Classes in C#
C# | Inheritance
C# | List Class
Difference between Hashtable and Dictionary in C#
Lambda Expressions in C# | [
{
"code": null,
"e": 24302,
"s": 24274,
"text": "\n01 May, 2019"
},
{
"code": null,
"e": 24524,
"s": 24302,
"text": "The NextBytes(Byte[]) method of the System.Random class in C# is used to fill the elements of a specified array of bytes with random numbers. This method takes a byte array as a parameter and fills it with random numbers."
},
{
"code": null,
"e": 24532,
"s": 24524,
"text": "Syntax:"
},
{
"code": null,
"e": 24579,
"s": 24532,
"text": "public virtual void NextBytes (byte[] buffer);"
},
{
"code": null,
"e": 24641,
"s": 24579,
"text": "Here, buffer is the array of bytes to contain random numbers."
},
{
"code": null,
"e": 24719,
"s": 24641,
"text": "Exception: This method will give ArgumentNullException if the buffer is null."
},
{
"code": null,
"e": 24777,
"s": 24719,
"text": "Below programs illustrates the use of NextBytes() method:"
},
{
"code": null,
"e": 24788,
"s": 24777,
"text": "Example 1:"
},
{
"code": "// C# program to illustrate the// use of Random.NextBytes Methodusing System; class GFG { // Driver code public static void Main() { // Instantiate random number generator Random rand = new Random(); // Instantiate an array of byte Byte[] b = new Byte[10]; rand.NextBytes(b); // Print random numbers in the byte array Console.WriteLine(\"Printing random numbers\"+ \" in the byte array\"); for (int i = 0; i < 10; i++) Console.WriteLine(\"{0} -> {1}\", i, b[i]); }}",
"e": 25367,
"s": 24788,
"text": null
},
{
"code": null,
"e": 25493,
"s": 25367,
"text": "Printing random numbers in the byte array\n0 -> 63\n1 -> 166\n2 -> 5\n3 -> 212\n4 -> 114\n5 -> 94\n6 -> 161\n7 -> 4\n8 -> 226\n9 -> 46\n"
},
{
"code": null,
"e": 25504,
"s": 25493,
"text": "Example 2:"
},
{
"code": "// C# program to illustrate the// use of Random.NextBytes Methodusing System; class GFG { // Driver code public static void Main() { // Instantiate random number generator Random rand = new Random(); // Instantiate an array of byte Byte[] b = new Byte[10]; rand.NextBytes(b); // Print random numbers in the byte array Console.WriteLine(\"Printing random numbers\"+ \" in the byte array\"); foreach(byte byteValue in b) Console.WriteLine(\"{0}\", byteValue); }}",
"e": 26078,
"s": 25504,
"text": null
},
{
"code": null,
"e": 26158,
"s": 26078,
"text": "Printing random numbers in the byte array\n98\n68\n221\n160\n179\n78\n172\n129\n121\n179\n"
},
{
"code": null,
"e": 26169,
"s": 26158,
"text": "Reference:"
},
{
"code": null,
"e": 26261,
"s": 26169,
"text": "https://docs.microsoft.com/en-us/dotnet/api/system.random.nextbytes?view=netframework-4.7.2"
},
{
"code": null,
"e": 26275,
"s": 26261,
"text": "CSharp-method"
},
{
"code": null,
"e": 26295,
"s": 26275,
"text": "CSharp-Random-Class"
},
{
"code": null,
"e": 26298,
"s": 26295,
"text": "C#"
},
{
"code": null,
"e": 26396,
"s": 26298,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 26414,
"s": 26396,
"text": "Destructors in C#"
},
{
"code": null,
"e": 26437,
"s": 26414,
"text": "Extension Method in C#"
},
{
"code": null,
"e": 26465,
"s": 26437,
"text": "HashSet in C# with Examples"
},
{
"code": null,
"e": 26505,
"s": 26465,
"text": "Top 50 C# Interview Questions & Answers"
},
{
"code": null,
"e": 26548,
"s": 26505,
"text": "C# | How to insert an element in an Array?"
},
{
"code": null,
"e": 26570,
"s": 26548,
"text": "Partial Classes in C#"
},
{
"code": null,
"e": 26587,
"s": 26570,
"text": "C# | Inheritance"
},
{
"code": null,
"e": 26603,
"s": 26587,
"text": "C# | List Class"
},
{
"code": null,
"e": 26653,
"s": 26603,
"text": "Difference between Hashtable and Dictionary in C#"
}
] |
AngularJS | ng-bind Directive - GeeksforGeeks | 30 Mar, 2021
The ng-bind Directive in AngularJS is used to bind/replace the text content of any particular HTML element with the value that is entered in the given expression. The value of specified HTML content updates whenever the value of the expression changes in ng-bind directive.Syntax:
<element ng-bind="expression"> Contents... </element>
Where expression is used to specify the expression to be evaluated or the variable.Example 1: This example uses ng-bind Directive to bind the product of two number to the <span> element.
html
<!DOCTYPE html><html> <head> <title>ng-bind Directive</title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"> </script></head> <body ng-app="gfg" style="text-align:center"> <h1 style="color:green">GeeksforGeeks</h1> <h2>ng-bind Directive</h2> <div ng-controller="app"> num1: <input type="number" ng-model="num1" ng-change="product()" /> <br><br> num2: <input type="number" ng-model="num2" ng-change="product()" /> <br><br> <b>Product:</b> <span ng-bind="result"></span> </div> <script> var app = angular.module("gfg", []); app.controller('app', ['$scope', function ($app) { $app.num1 = 1; $app.num2 = 1; $app.product = function () { $app.result = ($app.num1 * $app.num2); } }]); </script></body> </html>
Output:
Example 2: This example uses ng-bind Directive to bind the innerHTML of the <span> element to the variable text.
html
<!DOCTYPE html><html> <head> <title>ng-bind Directive</title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"> </script></head> <body style = "text-align:center"> <h1 style = "color:green">GeeksforGeeks <h2 style = "">ng-bind directive</h2> <div ng-app="" ng-init="txt='GeeksforGeeks';col='green'"> <div> <span ng-bind="txt"></span> is the computer science portal for geeks. </div> </div></body> </html>
Output:
simranarora5sos
AngularJS-Directives
AngularJS
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Angular File Upload
Angular | keyup event
Auth Guards in Angular 9/10/11
What is AOT and JIT Compiler in Angular ?
Angular PrimeNG Dropdown Component
Top 10 Front End Developer Skills That You Need in 2022
Installation of Node.js on Linux
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to fetch data from an API in ReactJS ?
How to insert spaces/tabs in text using HTML/CSS? | [
{
"code": null,
"e": 27880,
"s": 27852,
"text": "\n30 Mar, 2021"
},
{
"code": null,
"e": 28163,
"s": 27880,
"text": "The ng-bind Directive in AngularJS is used to bind/replace the text content of any particular HTML element with the value that is entered in the given expression. The value of specified HTML content updates whenever the value of the expression changes in ng-bind directive.Syntax: "
},
{
"code": null,
"e": 28217,
"s": 28163,
"text": "<element ng-bind=\"expression\"> Contents... </element>"
},
{
"code": null,
"e": 28406,
"s": 28217,
"text": "Where expression is used to specify the expression to be evaluated or the variable.Example 1: This example uses ng-bind Directive to bind the product of two number to the <span> element. "
},
{
"code": null,
"e": 28411,
"s": 28406,
"text": "html"
},
{
"code": "<!DOCTYPE html><html> <head> <title>ng-bind Directive</title> <script src=\"https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js\"> </script></head> <body ng-app=\"gfg\" style=\"text-align:center\"> <h1 style=\"color:green\">GeeksforGeeks</h1> <h2>ng-bind Directive</h2> <div ng-controller=\"app\"> num1: <input type=\"number\" ng-model=\"num1\" ng-change=\"product()\" /> <br><br> num2: <input type=\"number\" ng-model=\"num2\" ng-change=\"product()\" /> <br><br> <b>Product:</b> <span ng-bind=\"result\"></span> </div> <script> var app = angular.module(\"gfg\", []); app.controller('app', ['$scope', function ($app) { $app.num1 = 1; $app.num2 = 1; $app.product = function () { $app.result = ($app.num1 * $app.num2); } }]); </script></body> </html>",
"e": 29368,
"s": 28411,
"text": null
},
{
"code": null,
"e": 29378,
"s": 29368,
"text": "Output: "
},
{
"code": null,
"e": 29493,
"s": 29378,
"text": "Example 2: This example uses ng-bind Directive to bind the innerHTML of the <span> element to the variable text. "
},
{
"code": null,
"e": 29498,
"s": 29493,
"text": "html"
},
{
"code": "<!DOCTYPE html><html> <head> <title>ng-bind Directive</title> <script src=\"https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js\"> </script></head> <body style = \"text-align:center\"> <h1 style = \"color:green\">GeeksforGeeks <h2 style = \"\">ng-bind directive</h2> <div ng-app=\"\" ng-init=\"txt='GeeksforGeeks';col='green'\"> <div> <span ng-bind=\"txt\"></span> is the computer science portal for geeks. </div> </div></body> </html>",
"e": 30010,
"s": 29498,
"text": null
},
{
"code": null,
"e": 30020,
"s": 30010,
"text": "Output: "
},
{
"code": null,
"e": 30038,
"s": 30022,
"text": "simranarora5sos"
},
{
"code": null,
"e": 30059,
"s": 30038,
"text": "AngularJS-Directives"
},
{
"code": null,
"e": 30069,
"s": 30059,
"text": "AngularJS"
},
{
"code": null,
"e": 30086,
"s": 30069,
"text": "Web Technologies"
},
{
"code": null,
"e": 30184,
"s": 30086,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 30193,
"s": 30184,
"text": "Comments"
},
{
"code": null,
"e": 30206,
"s": 30193,
"text": "Old Comments"
},
{
"code": null,
"e": 30226,
"s": 30206,
"text": "Angular File Upload"
},
{
"code": null,
"e": 30248,
"s": 30226,
"text": "Angular | keyup event"
},
{
"code": null,
"e": 30279,
"s": 30248,
"text": "Auth Guards in Angular 9/10/11"
},
{
"code": null,
"e": 30321,
"s": 30279,
"text": "What is AOT and JIT Compiler in Angular ?"
},
{
"code": null,
"e": 30356,
"s": 30321,
"text": "Angular PrimeNG Dropdown Component"
},
{
"code": null,
"e": 30412,
"s": 30356,
"text": "Top 10 Front End Developer Skills That You Need in 2022"
},
{
"code": null,
"e": 30445,
"s": 30412,
"text": "Installation of Node.js on Linux"
},
{
"code": null,
"e": 30507,
"s": 30445,
"text": "Top 10 Projects For Beginners To Practice HTML and CSS Skills"
},
{
"code": null,
"e": 30550,
"s": 30507,
"text": "How to fetch data from an API in ReactJS ?"
}
] |
Cisco Interview Experience for Internship (On-Campus 2020) - GeeksforGeeks | 29 Dec, 2020
Cisco visited our campus for hiring interns for 2020-21. Every process was done virtually due to the pandemic.
Round 1(Online Round – 60 min): The first round consisted of 2 coding questions and 15 MCQs. The time allotted was 1 hour. The MCQs consisted of aptitude, basic output questions, networking, and some other topics also. The test was conducted on Hackerrank and navigation among the questions was allowed. Only three languages were allowed for coding questions: C, JAVA, and Python.
Coding Questions:
Two players are playing ‘n*n’ scrabble game for some time. Cells with letters are marked as 1 and empty ones are marked as 0.The goal is to count the number of ways with exactly X characters solved on the board.Sample Input:
00100
11100
10111
10010
11111
X=3
Sample output:
4The exact same problem is given below with some different descriptions. https://www.codechef.com/problems/H1
Two players are playing ‘n*n’ scrabble game for some time. Cells with letters are marked as 1 and empty ones are marked as 0.The goal is to count the number of ways with exactly X characters solved on the board.Sample Input:
00100
11100
10111
10010
11111
X=3
Sample output:
4
Two players are playing ‘n*n’ scrabble game for some time. Cells with letters are marked as 1 and empty ones are marked as 0.
The goal is to count the number of ways with exactly X characters solved on the board.
Sample Input:
00100
11100
10111
10010
11111
X=3
Sample output:
4
The exact same problem is given below with some different descriptions. https://www.codechef.com/problems/H1
The exact same problem is given below with some different descriptions. https://www.codechef.com/problems/H1
I solved both the coding problems completely and solved more than half of the MCQs. The result came out after 3-4 days, and I was shortlisted for the interview. The interview was scheduled on Cisco WebEx.
Round 2 – Technical Interview (60 min): This round started with a brief introduction of myself and a quick walk through my resume. I had mentioned team collaborator as my soft skill, so he asked me to give a situation in which I had acted as a team collaborator.
He asked about the storage classes in C. I explained to him the various classes and their details. Then he asked about static keyword in C. Then he asked the difference between global static variables and global variables. I didn’t know its answer, so he moved on.
He asked me to write a code of a structure in C, and he gave me the variables for that structure. Then he asked me to tell the size of that structure. I asked him if I had to consider structure padding or not. He told me to simply tell him what will be the size of that code is run. Then I told him the size considering structure padding. He asked me to explain what is structure padding. Then he did some modifications in the given structure and again asked me to tell the size and how I calculated the size. Then he asked if there was any way to avoid structure padding. I told its answer and he seemed satisfied with it.
Then he basically gave me two character arrays and asked me to calculate the number of occurrences of one in another. I told him naive pattern searching will take O(m*n) time, and so I would use the KMP algorithm. He asked me to simply write down its code. I wrote the code, and he asked me to do a dry run on a given sample input. As I explained the code, there was a bug in it and I identified it during the dry run and I corrected it. He seemed satisfied with it.
He asked me if computer networking had been in my curriculum and I replied in negative. However, I had done my project in socket programming, so he asked me how I had done it and explain the concept of sockets and how they work. Then he asked me about the types of sockets. I told him about TCP and UDP. Then he asked me to explain those and tell the differences. I had studied them and I explained the details and working of those. Then he asked me if about other protocols at a lower level. I told him about Internet Protocol. Then he asked me if I had heard about IPv4 and IPv6. I told him, yes, then he asked me to explain them. I told everything in detail, including the key differences, and he seemed quite satisfied with it.
After that, he asked me if I had any questions. I asked me a couple of questions and it was over.
After 20 minutes, I got informed that I was selected for the Managerial interview.
Round 3-Managerial Round(45 min): The interview started with a brief introduction of me. The very first thing the interviewer asked me the projects mentioned in my resume. I had mentioned two projects, so I explained in brief about both the projects.
He didn’t ask any cross-questions about the projects.
Then he said to me that, since I had mentioned C++ in my resume, he asked me to tell anything that I had done especially in C++. I told him that I use C++ mainly for competitive programming. Again he asked me to tell him something I had done in C++. Initially, I didn’t understand his question well but then, I told him various competitive programming problems I had solved using C++.
Then he asked me about the various data structures I have studied. I told him arrays, stacks, linked lists, graphs, and trees. Then he asked me to write a code for a linked list. I asked if it was a singly linked list or doubly linked. He told me it was the singly linked list. Then I wrote code in NotePad and shared my screen. Then he asked me to write a function to traverse the linked list. I wrote the code, and he asked me to dry run it, which I did. Then he asked me if I had studied the graph, to which I replied positively. Then he asked me how graphs can be represented. I told him about the adjacency list and adjacency matrix. He asked me to represent it as a linked list node. Then I started writing code for it and asked him if the maximum number of nodes to which a graph node is fixed or not. If it is fixed, I would use a static array of GraphNode pointers to represent the connected nodes, whereas in another case, I would dynamically create the child nodes. He was impressed with my question. I again asked him a couple of questions, if the graph was directed or undirected, and if the graph was connected or disconnected. I discussed different structures of graph nodes with different cases. He seemed impressed with it and kept complimenting me about my thinking process.
Then he asked me to write a simple, undirected graph node, which I did. He then asked to write a function to traverse the graph. I started writing code, but he asked me to discuss the approach only which I did.
Then he asked me if the various subjects I was studying in the current semester. I told him, and he asked what was being taught in each subject. I told you about job scheduling in Operating Systems. He asked me about the various types of job scheduling algorithms. He then asked me the data structure used in preemptive job scheduling. I told him priority queue, but he was expecting the queue used in the Round Robin algorithm. I got it when he repeated the question, and he seemed satisfied with it.
Then he didn’t ask any other questions and asked me I had any questions. I asked the same questions I had asked in the previous round which he explained to me.
Round 4- HR Round(10 min): 2 hours approximately after the 2nd round, I was called for the HR round. It was a very chill round. It started with my introduction. Then the interviewer asked me about the project which was very close to me and why. She then asked about my job preference and relocation preference. She asked me if I had any questions and I asked how interns are assigned projects. She explained the whole process and after that, this round was over.
In the evening, the list of selected students, and I was quite happy to find my name in it.
Cisco
Marketing
On-Campus
Internship
Interview Experiences
Cisco
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Arista Networks Interview | Set 4 (On-Campus for Internship)
Arista Networks Interview | Set 7 (For Internship)
Josh Technology Interview Experience for Frontend Developer (On-Campus)
Amazon(Barcelona) Interview Experience for SDE | Off-Campus Internship
Amazon Interview Experience | Set 304 (On-Campus for Internship)
Difference between ANN, CNN and RNN
Amazon Interview Questions
Zoho Interview | Set 1 (On-Campus)
Commonly Asked Java Programming Interview Questions | Set 2
Amazon Interview Experience for SDE-1 (On-Campus) | [
{
"code": null,
"e": 25109,
"s": 25081,
"text": "\n29 Dec, 2020"
},
{
"code": null,
"e": 25220,
"s": 25109,
"text": "Cisco visited our campus for hiring interns for 2020-21. Every process was done virtually due to the pandemic."
},
{
"code": null,
"e": 25601,
"s": 25220,
"text": "Round 1(Online Round – 60 min): The first round consisted of 2 coding questions and 15 MCQs. The time allotted was 1 hour. The MCQs consisted of aptitude, basic output questions, networking, and some other topics also. The test was conducted on Hackerrank and navigation among the questions was allowed. Only three languages were allowed for coding questions: C, JAVA, and Python."
},
{
"code": null,
"e": 25619,
"s": 25601,
"text": "Coding Questions:"
},
{
"code": null,
"e": 26003,
"s": 25619,
"text": "Two players are playing ‘n*n’ scrabble game for some time. Cells with letters are marked as 1 and empty ones are marked as 0.The goal is to count the number of ways with exactly X characters solved on the board.Sample Input:\n00100\n11100\n10111\n10010\n11111\nX=3\nSample output:\n4The exact same problem is given below with some different descriptions. https://www.codechef.com/problems/H1"
},
{
"code": null,
"e": 26279,
"s": 26003,
"text": "Two players are playing ‘n*n’ scrabble game for some time. Cells with letters are marked as 1 and empty ones are marked as 0.The goal is to count the number of ways with exactly X characters solved on the board.Sample Input:\n00100\n11100\n10111\n10010\n11111\nX=3\nSample output:\n4"
},
{
"code": null,
"e": 26405,
"s": 26279,
"text": "Two players are playing ‘n*n’ scrabble game for some time. Cells with letters are marked as 1 and empty ones are marked as 0."
},
{
"code": null,
"e": 26492,
"s": 26405,
"text": "The goal is to count the number of ways with exactly X characters solved on the board."
},
{
"code": null,
"e": 26557,
"s": 26492,
"text": "Sample Input:\n00100\n11100\n10111\n10010\n11111\nX=3\nSample output:\n4"
},
{
"code": null,
"e": 26666,
"s": 26557,
"text": "The exact same problem is given below with some different descriptions. https://www.codechef.com/problems/H1"
},
{
"code": null,
"e": 26775,
"s": 26666,
"text": "The exact same problem is given below with some different descriptions. https://www.codechef.com/problems/H1"
},
{
"code": null,
"e": 26980,
"s": 26775,
"text": "I solved both the coding problems completely and solved more than half of the MCQs. The result came out after 3-4 days, and I was shortlisted for the interview. The interview was scheduled on Cisco WebEx."
},
{
"code": null,
"e": 27243,
"s": 26980,
"text": "Round 2 – Technical Interview (60 min): This round started with a brief introduction of myself and a quick walk through my resume. I had mentioned team collaborator as my soft skill, so he asked me to give a situation in which I had acted as a team collaborator."
},
{
"code": null,
"e": 27508,
"s": 27243,
"text": "He asked about the storage classes in C. I explained to him the various classes and their details. Then he asked about static keyword in C. Then he asked the difference between global static variables and global variables. I didn’t know its answer, so he moved on."
},
{
"code": null,
"e": 28132,
"s": 27508,
"text": "He asked me to write a code of a structure in C, and he gave me the variables for that structure. Then he asked me to tell the size of that structure. I asked him if I had to consider structure padding or not. He told me to simply tell him what will be the size of that code is run. Then I told him the size considering structure padding. He asked me to explain what is structure padding. Then he did some modifications in the given structure and again asked me to tell the size and how I calculated the size. Then he asked if there was any way to avoid structure padding. I told its answer and he seemed satisfied with it."
},
{
"code": null,
"e": 28599,
"s": 28132,
"text": "Then he basically gave me two character arrays and asked me to calculate the number of occurrences of one in another. I told him naive pattern searching will take O(m*n) time, and so I would use the KMP algorithm. He asked me to simply write down its code. I wrote the code, and he asked me to do a dry run on a given sample input. As I explained the code, there was a bug in it and I identified it during the dry run and I corrected it. He seemed satisfied with it."
},
{
"code": null,
"e": 29331,
"s": 28599,
"text": "He asked me if computer networking had been in my curriculum and I replied in negative. However, I had done my project in socket programming, so he asked me how I had done it and explain the concept of sockets and how they work. Then he asked me about the types of sockets. I told him about TCP and UDP. Then he asked me to explain those and tell the differences. I had studied them and I explained the details and working of those. Then he asked me if about other protocols at a lower level. I told him about Internet Protocol. Then he asked me if I had heard about IPv4 and IPv6. I told him, yes, then he asked me to explain them. I told everything in detail, including the key differences, and he seemed quite satisfied with it."
},
{
"code": null,
"e": 29429,
"s": 29331,
"text": "After that, he asked me if I had any questions. I asked me a couple of questions and it was over."
},
{
"code": null,
"e": 29512,
"s": 29429,
"text": "After 20 minutes, I got informed that I was selected for the Managerial interview."
},
{
"code": null,
"e": 29763,
"s": 29512,
"text": "Round 3-Managerial Round(45 min): The interview started with a brief introduction of me. The very first thing the interviewer asked me the projects mentioned in my resume. I had mentioned two projects, so I explained in brief about both the projects."
},
{
"code": null,
"e": 29817,
"s": 29763,
"text": "He didn’t ask any cross-questions about the projects."
},
{
"code": null,
"e": 30204,
"s": 29817,
"text": "Then he said to me that, since I had mentioned C++ in my resume, he asked me to tell anything that I had done especially in C++. I told him that I use C++ mainly for competitive programming. Again he asked me to tell him something I had done in C++. Initially, I didn’t understand his question well but then, I told him various competitive programming problems I had solved using C++. "
},
{
"code": null,
"e": 31497,
"s": 30204,
"text": "Then he asked me about the various data structures I have studied. I told him arrays, stacks, linked lists, graphs, and trees. Then he asked me to write a code for a linked list. I asked if it was a singly linked list or doubly linked. He told me it was the singly linked list. Then I wrote code in NotePad and shared my screen. Then he asked me to write a function to traverse the linked list. I wrote the code, and he asked me to dry run it, which I did. Then he asked me if I had studied the graph, to which I replied positively. Then he asked me how graphs can be represented. I told him about the adjacency list and adjacency matrix. He asked me to represent it as a linked list node. Then I started writing code for it and asked him if the maximum number of nodes to which a graph node is fixed or not. If it is fixed, I would use a static array of GraphNode pointers to represent the connected nodes, whereas in another case, I would dynamically create the child nodes. He was impressed with my question. I again asked him a couple of questions, if the graph was directed or undirected, and if the graph was connected or disconnected. I discussed different structures of graph nodes with different cases. He seemed impressed with it and kept complimenting me about my thinking process."
},
{
"code": null,
"e": 31708,
"s": 31497,
"text": "Then he asked me to write a simple, undirected graph node, which I did. He then asked to write a function to traverse the graph. I started writing code, but he asked me to discuss the approach only which I did."
},
{
"code": null,
"e": 32212,
"s": 31708,
"text": "Then he asked me if the various subjects I was studying in the current semester. I told him, and he asked what was being taught in each subject. I told you about job scheduling in Operating Systems. He asked me about the various types of job scheduling algorithms. He then asked me the data structure used in preemptive job scheduling. I told him priority queue, but he was expecting the queue used in the Round Robin algorithm. I got it when he repeated the question, and he seemed satisfied with it. "
},
{
"code": null,
"e": 32372,
"s": 32212,
"text": "Then he didn’t ask any other questions and asked me I had any questions. I asked the same questions I had asked in the previous round which he explained to me."
},
{
"code": null,
"e": 32835,
"s": 32372,
"text": "Round 4- HR Round(10 min): 2 hours approximately after the 2nd round, I was called for the HR round. It was a very chill round. It started with my introduction. Then the interviewer asked me about the project which was very close to me and why. She then asked about my job preference and relocation preference. She asked me if I had any questions and I asked how interns are assigned projects. She explained the whole process and after that, this round was over."
},
{
"code": null,
"e": 32927,
"s": 32835,
"text": "In the evening, the list of selected students, and I was quite happy to find my name in it."
},
{
"code": null,
"e": 32933,
"s": 32927,
"text": "Cisco"
},
{
"code": null,
"e": 32943,
"s": 32933,
"text": "Marketing"
},
{
"code": null,
"e": 32953,
"s": 32943,
"text": "On-Campus"
},
{
"code": null,
"e": 32964,
"s": 32953,
"text": "Internship"
},
{
"code": null,
"e": 32986,
"s": 32964,
"text": "Interview Experiences"
},
{
"code": null,
"e": 32992,
"s": 32986,
"text": "Cisco"
},
{
"code": null,
"e": 33090,
"s": 32992,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 33099,
"s": 33090,
"text": "Comments"
},
{
"code": null,
"e": 33112,
"s": 33099,
"text": "Old Comments"
},
{
"code": null,
"e": 33173,
"s": 33112,
"text": "Arista Networks Interview | Set 4 (On-Campus for Internship)"
},
{
"code": null,
"e": 33224,
"s": 33173,
"text": "Arista Networks Interview | Set 7 (For Internship)"
},
{
"code": null,
"e": 33296,
"s": 33224,
"text": "Josh Technology Interview Experience for Frontend Developer (On-Campus)"
},
{
"code": null,
"e": 33367,
"s": 33296,
"text": "Amazon(Barcelona) Interview Experience for SDE | Off-Campus Internship"
},
{
"code": null,
"e": 33432,
"s": 33367,
"text": "Amazon Interview Experience | Set 304 (On-Campus for Internship)"
},
{
"code": null,
"e": 33468,
"s": 33432,
"text": "Difference between ANN, CNN and RNN"
},
{
"code": null,
"e": 33495,
"s": 33468,
"text": "Amazon Interview Questions"
},
{
"code": null,
"e": 33530,
"s": 33495,
"text": "Zoho Interview | Set 1 (On-Campus)"
},
{
"code": null,
"e": 33590,
"s": 33530,
"text": "Commonly Asked Java Programming Interview Questions | Set 2"
}
] |
Javascript - How to listObjects from AWS S3 - onlinetutorialspoint | PROGRAMMINGJava ExamplesC Examples
Java Examples
C Examples
C Tutorials
aws
JAVAEXCEPTIONSCOLLECTIONSSWINGJDBC
EXCEPTIONS
COLLECTIONS
SWING
JDBC
JAVA 8
SPRING
SPRING BOOT
HIBERNATE
PYTHON
PHP
JQUERY
PROGRAMMINGJava ExamplesC Examples
Java Examples
C Examples
C Tutorials
aws
Listing objects from AWS s3 bucket using Javascript (NodeJs) is a simple/regular use case for AWS development. So here we are going to see how can we achieve this simple task more simply.
This example has been tested on the below versions, please make sure.
Node v12.18.4
Yarn 1.22.10
AWS-SDK 2.77.0
Install Nodejs
Setup AWS
Make sure to add aws-sdk into your package.json and run yarn install to install dependencies.
var AWS = require('aws-sdk');
AWS.config.update({ region: 'us-west-2' });
var s3 = new AWS.S3({ apiVersion: '2006-03-01' });
var bucketParams = {
Bucket: 'my-sample-reports',
};
export async function getReports(objects = []) {
const response = await s3.listObjectsV2(bucketParams).promise();
response.Contents.forEach(obj => objects.push(obj));
if (response.NextContinuationToken) {
bucketParams.ContinuationToken = response.NextContinuationToken;
await getReports(bucketParams, objects);
}
console.log("objects ",objects)
return objects;
}
Output:
objects
(7) [{...}, {...}, {...}, {...}, {...}, {...}, {...}]
0: {Key: "1623061746-report.xlsx", LastModified: Mon Jun 07 2021 15:59:12 GMT+0530 (India Standard Time), ETag: "\"aef77773de18e148938be7a98baac57d\"", Size: 42252, StorageClass: "STANDARD"}
1: {Key: "1623062754-report.xlsx", LastModified: Mon Jun 07 2021 16:15:59 GMT+0530 (India Standard Time), ETag: "\"feed92db051e7a4dd1faacde270a21f3\"", Size: 42342, StorageClass: "STANDARD"}
2: {Key: "1623064934-report.xlsx", LastModified: Mon Jun 07 2021 16:52:20 GMT+0530 (India Standard Time), ETag: "\"704d374fd1fbd0b4751d355d3f8e5ff5\"", Size: 42044, StorageClass: "STANDARD"}
3: {Key: "1623065997-report.xlsx", LastModified: Mon Jun 07 2021 17:10:02 GMT+0530 (India Standard Time), ETag: "\"8ab079ba5a816b198106cab41c6f33ad\"", Size: 42045, StorageClass: "STANDARD"}
4: {Key: "1623145510-report.xlsx", LastModified: Tue Jun 08 2021 15:15:16 GMT+0530 (India Standard Time), ETag: "\"039999bfe06551a2894a565bfb4bb571\"", Size: 44686, StorageClass: "STANDARD"}
5: {Key: "1623404329-report.xlsx", LastModified: Fri Jun 11 2021 15:08:55 GMT+0530 (India Standard Time), ETag: "\"85230b71f4b6aaa32d45845a9772086e\"", Size: 45357, StorageClass: "STANDARD"}
6: {Key: "1623419247-report.xlsx", LastModified: Fri Jun 11 2021 19:17:32 GMT+0530 (India Standard Time), ETag: "\"bee56b7101a8fe98b89fcfc59d850ebf\"", Size: 45357, StorageClass: "STANDARD"}
length: 7
__proto__: Array(0)
On the above output, we can see the list of objects from the s3 bucket. However, the output contains the raw response from S3.
This example shows how to customise the S3 raw response into our requirement.
var AWS = require('aws-sdk');
AWS.config.update({ region: 'us-west-2' });
var s3 = new AWS.S3({ apiVersion: '2006-03-01' });
var bucketParams = {
Bucket: 'my-sample-reports',
};
export async function getSample(objects = []) {
const response = await s3.listObjectsV2(bucketParams).promise();
response.Contents.forEach(obj => {
var date = new Date(obj.LastModified);
var actual = date.getDate() + '/' + Number(date.getMonth() + 1) + '/' + date.getFullYear();
const size = convertBytes(obj.Size)
objects.push({ file: obj.Key, date: actual, filesize: size });
});
if (response.NextContinuationToken) {
bucketParams.ContinuationToken = response.NextContinuationToken;
await getReports(bucketParams, objects);
}
console.log("objects ",objects)
return objects;
}
const units = ['bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
export function convertBytes(x) {
let l = 0, n = parseInt(x, 10) || 0;
while(n >= 1024 && ++l){
n = n/1024;
}
return(n.toFixed(n < 10 && l > 0 ? 1 : 0) + ' ' + units[l]);
}
Output:
objects
(7) [{...}, {...}, {...}, {...}, {...}, {...}, {...}]
0: {file: "1623061746-report.xlsx", date: "7/6/2021", filesize: "41 KB"}
1: {file: "1623062754-report.xlsx", date: "7/6/2021", filesize: "41 KB"}
2: {file: "1623064934-report.xlsx", date: "7/6/2021", filesize: "41 KB"}
3: {file: "1623065997-report.xlsx", date: "7/6/2021", filesize: "41 KB"}
4: {file: "1623145510-report.xlsx", date: "8/6/2021", filesize: "44 KB"}
5: {file: "1623404329-report.xlsx", date: "11/6/2021", filesize: "44 KB"}
6: {file: "1623419247-report.xlsx", date: "11/6/2021", filesize: "44 KB"}
length: 7
__proto__: Array(0)
Javascript Async-await
Export AWS keys
Happy Learning 🙂
How add files to S3 Bucket using Shell Script
Python – AWS SAM Lambda Example
How to connect AWS EC2 Instance using PuTTY
How to Copy Local Files to AWS EC2 instance Manually ?
How to install AWS CLI on Windows 10
How set AWS Access Keys in Windows or Mac Environment
[Fixed] – Error: No changes to deploy. Stack is up to date
Angularjs Custom Filter Example
PHP File Handling fopen fread and fclose Example
Angular http (AJAX) Example Tutorials
What are the different ways to Sort Objects in Python ?
How to get current date in Python
AngularJs Custom Directive Example
Pandas read_excel – Read Excel files in Pandas
Java 8 – Convert java.util.Date to java.time.LocalDate
How add files to S3 Bucket using Shell Script
Python – AWS SAM Lambda Example
How to connect AWS EC2 Instance using PuTTY
How to Copy Local Files to AWS EC2 instance Manually ?
How to install AWS CLI on Windows 10
How set AWS Access Keys in Windows or Mac Environment
[Fixed] – Error: No changes to deploy. Stack is up to date
Angularjs Custom Filter Example
PHP File Handling fopen fread and fclose Example
Angular http (AJAX) Example Tutorials
What are the different ways to Sort Objects in Python ?
How to get current date in Python
AngularJs Custom Directive Example
Pandas read_excel – Read Excel files in Pandas
Java 8 – Convert java.util.Date to java.time.LocalDate
Δ
Install Java on Mac OS
Install AWS CLI on Windows
Install Minikube on Windows
Install Docker Toolbox on Windows
Install SOAPUI on Windows
Install Gradle on Windows
Install RabbitMQ on Windows
Install PuTTY on windows
Install Mysql on Windows
Install Hibernate Tools in Eclipse
Install Elasticsearch on Windows
Install Maven on Windows
Install Maven on Ubuntu
Install Maven on Windows Command
Add OJDBC jar to Maven Repository
Install Ant on Windows
Install RabbitMQ on Windows
Install Apache Kafka on Ubuntu
Install Apache Kafka on Windows | [
{
"code": null,
"e": 158,
"s": 123,
"text": "PROGRAMMINGJava ExamplesC Examples"
},
{
"code": null,
"e": 172,
"s": 158,
"text": "Java Examples"
},
{
"code": null,
"e": 183,
"s": 172,
"text": "C Examples"
},
{
"code": null,
"e": 195,
"s": 183,
"text": "C Tutorials"
},
{
"code": null,
"e": 199,
"s": 195,
"text": "aws"
},
{
"code": null,
"e": 234,
"s": 199,
"text": "JAVAEXCEPTIONSCOLLECTIONSSWINGJDBC"
},
{
"code": null,
"e": 245,
"s": 234,
"text": "EXCEPTIONS"
},
{
"code": null,
"e": 257,
"s": 245,
"text": "COLLECTIONS"
},
{
"code": null,
"e": 263,
"s": 257,
"text": "SWING"
},
{
"code": null,
"e": 268,
"s": 263,
"text": "JDBC"
},
{
"code": null,
"e": 275,
"s": 268,
"text": "JAVA 8"
},
{
"code": null,
"e": 282,
"s": 275,
"text": "SPRING"
},
{
"code": null,
"e": 294,
"s": 282,
"text": "SPRING BOOT"
},
{
"code": null,
"e": 304,
"s": 294,
"text": "HIBERNATE"
},
{
"code": null,
"e": 311,
"s": 304,
"text": "PYTHON"
},
{
"code": null,
"e": 315,
"s": 311,
"text": "PHP"
},
{
"code": null,
"e": 322,
"s": 315,
"text": "JQUERY"
},
{
"code": null,
"e": 357,
"s": 322,
"text": "PROGRAMMINGJava ExamplesC Examples"
},
{
"code": null,
"e": 371,
"s": 357,
"text": "Java Examples"
},
{
"code": null,
"e": 382,
"s": 371,
"text": "C Examples"
},
{
"code": null,
"e": 394,
"s": 382,
"text": "C Tutorials"
},
{
"code": null,
"e": 398,
"s": 394,
"text": "aws"
},
{
"code": null,
"e": 586,
"s": 398,
"text": "Listing objects from AWS s3 bucket using Javascript (NodeJs) is a simple/regular use case for AWS development. So here we are going to see how can we achieve this simple task more simply."
},
{
"code": null,
"e": 656,
"s": 586,
"text": "This example has been tested on the below versions, please make sure."
},
{
"code": null,
"e": 670,
"s": 656,
"text": "Node v12.18.4"
},
{
"code": null,
"e": 683,
"s": 670,
"text": "Yarn 1.22.10"
},
{
"code": null,
"e": 698,
"s": 683,
"text": "AWS-SDK 2.77.0"
},
{
"code": null,
"e": 713,
"s": 698,
"text": "Install Nodejs"
},
{
"code": null,
"e": 723,
"s": 713,
"text": "Setup AWS"
},
{
"code": null,
"e": 817,
"s": 723,
"text": "Make sure to add aws-sdk into your package.json and run yarn install to install dependencies."
},
{
"code": null,
"e": 1384,
"s": 817,
"text": "var AWS = require('aws-sdk');\n\nAWS.config.update({ region: 'us-west-2' });\n\nvar s3 = new AWS.S3({ apiVersion: '2006-03-01' });\nvar bucketParams = {\n Bucket: 'my-sample-reports',\n};\nexport async function getReports(objects = []) {\n const response = await s3.listObjectsV2(bucketParams).promise();\n\n response.Contents.forEach(obj => objects.push(obj));\n\n if (response.NextContinuationToken) {\n bucketParams.ContinuationToken = response.NextContinuationToken;\n await getReports(bucketParams, objects);\n }\n console.log(\"objects \",objects)\n return objects;\n}"
},
{
"code": null,
"e": 1392,
"s": 1384,
"text": "Output:"
},
{
"code": null,
"e": 2823,
"s": 1392,
"text": "objects \n(7) [{...}, {...}, {...}, {...}, {...}, {...}, {...}]\n0: {Key: \"1623061746-report.xlsx\", LastModified: Mon Jun 07 2021 15:59:12 GMT+0530 (India Standard Time), ETag: \"\\\"aef77773de18e148938be7a98baac57d\\\"\", Size: 42252, StorageClass: \"STANDARD\"}\n1: {Key: \"1623062754-report.xlsx\", LastModified: Mon Jun 07 2021 16:15:59 GMT+0530 (India Standard Time), ETag: \"\\\"feed92db051e7a4dd1faacde270a21f3\\\"\", Size: 42342, StorageClass: \"STANDARD\"}\n2: {Key: \"1623064934-report.xlsx\", LastModified: Mon Jun 07 2021 16:52:20 GMT+0530 (India Standard Time), ETag: \"\\\"704d374fd1fbd0b4751d355d3f8e5ff5\\\"\", Size: 42044, StorageClass: \"STANDARD\"}\n3: {Key: \"1623065997-report.xlsx\", LastModified: Mon Jun 07 2021 17:10:02 GMT+0530 (India Standard Time), ETag: \"\\\"8ab079ba5a816b198106cab41c6f33ad\\\"\", Size: 42045, StorageClass: \"STANDARD\"}\n4: {Key: \"1623145510-report.xlsx\", LastModified: Tue Jun 08 2021 15:15:16 GMT+0530 (India Standard Time), ETag: \"\\\"039999bfe06551a2894a565bfb4bb571\\\"\", Size: 44686, StorageClass: \"STANDARD\"}\n5: {Key: \"1623404329-report.xlsx\", LastModified: Fri Jun 11 2021 15:08:55 GMT+0530 (India Standard Time), ETag: \"\\\"85230b71f4b6aaa32d45845a9772086e\\\"\", Size: 45357, StorageClass: \"STANDARD\"}\n6: {Key: \"1623419247-report.xlsx\", LastModified: Fri Jun 11 2021 19:17:32 GMT+0530 (India Standard Time), ETag: \"\\\"bee56b7101a8fe98b89fcfc59d850ebf\\\"\", Size: 45357, StorageClass: \"STANDARD\"}\nlength: 7\n__proto__: Array(0)"
},
{
"code": null,
"e": 2950,
"s": 2823,
"text": "On the above output, we can see the list of objects from the s3 bucket. However, the output contains the raw response from S3."
},
{
"code": null,
"e": 3028,
"s": 2950,
"text": "This example shows how to customise the S3 raw response into our requirement."
},
{
"code": null,
"e": 4090,
"s": 3028,
"text": "var AWS = require('aws-sdk');\nAWS.config.update({ region: 'us-west-2' });\n\nvar s3 = new AWS.S3({ apiVersion: '2006-03-01' });\nvar bucketParams = {\n Bucket: 'my-sample-reports',\n};\n\nexport async function getSample(objects = []) {\n const response = await s3.listObjectsV2(bucketParams).promise();\n\n response.Contents.forEach(obj => {\n var date = new Date(obj.LastModified);\n var actual = date.getDate() + '/' + Number(date.getMonth() + 1) + '/' + date.getFullYear();\n const size = convertBytes(obj.Size)\n objects.push({ file: obj.Key, date: actual, filesize: size });\n });\n\n if (response.NextContinuationToken) {\n bucketParams.ContinuationToken = response.NextContinuationToken;\n await getReports(bucketParams, objects);\n }\n console.log(\"objects \",objects)\n return objects;\n}\n\nconst units = ['bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];\n\nexport function convertBytes(x) {\n let l = 0, n = parseInt(x, 10) || 0;\n while(n >= 1024 && ++l){\n n = n/1024;\n }\n return(n.toFixed(n < 10 && l > 0 ? 1 : 0) + ' ' + units[l]);\n}"
},
{
"code": null,
"e": 4098,
"s": 4090,
"text": "Output:"
},
{
"code": null,
"e": 4705,
"s": 4098,
"text": "objects \n(7) [{...}, {...}, {...}, {...}, {...}, {...}, {...}]\n0: {file: \"1623061746-report.xlsx\", date: \"7/6/2021\", filesize: \"41 KB\"}\n1: {file: \"1623062754-report.xlsx\", date: \"7/6/2021\", filesize: \"41 KB\"}\n2: {file: \"1623064934-report.xlsx\", date: \"7/6/2021\", filesize: \"41 KB\"}\n3: {file: \"1623065997-report.xlsx\", date: \"7/6/2021\", filesize: \"41 KB\"}\n4: {file: \"1623145510-report.xlsx\", date: \"8/6/2021\", filesize: \"44 KB\"}\n5: {file: \"1623404329-report.xlsx\", date: \"11/6/2021\", filesize: \"44 KB\"}\n6: {file: \"1623419247-report.xlsx\", date: \"11/6/2021\", filesize: \"44 KB\"}\nlength: 7\n__proto__: Array(0)"
},
{
"code": null,
"e": 4728,
"s": 4705,
"text": "Javascript Async-await"
},
{
"code": null,
"e": 4744,
"s": 4728,
"text": "Export AWS keys"
},
{
"code": null,
"e": 4761,
"s": 4744,
"text": "Happy Learning 🙂"
},
{
"code": null,
"e": 5437,
"s": 4761,
"text": "\nHow add files to S3 Bucket using Shell Script\nPython – AWS SAM Lambda Example\nHow to connect AWS EC2 Instance using PuTTY\nHow to Copy Local Files to AWS EC2 instance Manually ?\nHow to install AWS CLI on Windows 10\nHow set AWS Access Keys in Windows or Mac Environment\n[Fixed] – Error: No changes to deploy. Stack is up to date\nAngularjs Custom Filter Example\nPHP File Handling fopen fread and fclose Example\nAngular http (AJAX) Example Tutorials\nWhat are the different ways to Sort Objects in Python ?\nHow to get current date in Python\nAngularJs Custom Directive Example\nPandas read_excel – Read Excel files in Pandas\nJava 8 – Convert java.util.Date to java.time.LocalDate\n"
},
{
"code": null,
"e": 5483,
"s": 5437,
"text": "How add files to S3 Bucket using Shell Script"
},
{
"code": null,
"e": 5515,
"s": 5483,
"text": "Python – AWS SAM Lambda Example"
},
{
"code": null,
"e": 5559,
"s": 5515,
"text": "How to connect AWS EC2 Instance using PuTTY"
},
{
"code": null,
"e": 5614,
"s": 5559,
"text": "How to Copy Local Files to AWS EC2 instance Manually ?"
},
{
"code": null,
"e": 5651,
"s": 5614,
"text": "How to install AWS CLI on Windows 10"
},
{
"code": null,
"e": 5705,
"s": 5651,
"text": "How set AWS Access Keys in Windows or Mac Environment"
},
{
"code": null,
"e": 5764,
"s": 5705,
"text": "[Fixed] – Error: No changes to deploy. Stack is up to date"
},
{
"code": null,
"e": 5796,
"s": 5764,
"text": "Angularjs Custom Filter Example"
},
{
"code": null,
"e": 5846,
"s": 5796,
"text": "PHP File Handling fopen fread and fclose Example"
},
{
"code": null,
"e": 5884,
"s": 5846,
"text": "Angular http (AJAX) Example Tutorials"
},
{
"code": null,
"e": 5940,
"s": 5884,
"text": "What are the different ways to Sort Objects in Python ?"
},
{
"code": null,
"e": 5974,
"s": 5940,
"text": "How to get current date in Python"
},
{
"code": null,
"e": 6009,
"s": 5974,
"text": "AngularJs Custom Directive Example"
},
{
"code": null,
"e": 6056,
"s": 6009,
"text": "Pandas read_excel – Read Excel files in Pandas"
},
{
"code": null,
"e": 6111,
"s": 6056,
"text": "Java 8 – Convert java.util.Date to java.time.LocalDate"
},
{
"code": null,
"e": 6117,
"s": 6115,
"text": "Δ"
},
{
"code": null,
"e": 6141,
"s": 6117,
"text": " Install Java on Mac OS"
},
{
"code": null,
"e": 6169,
"s": 6141,
"text": " Install AWS CLI on Windows"
},
{
"code": null,
"e": 6198,
"s": 6169,
"text": " Install Minikube on Windows"
},
{
"code": null,
"e": 6233,
"s": 6198,
"text": " Install Docker Toolbox on Windows"
},
{
"code": null,
"e": 6260,
"s": 6233,
"text": " Install SOAPUI on Windows"
},
{
"code": null,
"e": 6287,
"s": 6260,
"text": " Install Gradle on Windows"
},
{
"code": null,
"e": 6316,
"s": 6287,
"text": " Install RabbitMQ on Windows"
},
{
"code": null,
"e": 6342,
"s": 6316,
"text": " Install PuTTY on windows"
},
{
"code": null,
"e": 6368,
"s": 6342,
"text": " Install Mysql on Windows"
},
{
"code": null,
"e": 6404,
"s": 6368,
"text": " Install Hibernate Tools in Eclipse"
},
{
"code": null,
"e": 6438,
"s": 6404,
"text": " Install Elasticsearch on Windows"
},
{
"code": null,
"e": 6464,
"s": 6438,
"text": " Install Maven on Windows"
},
{
"code": null,
"e": 6489,
"s": 6464,
"text": " Install Maven on Ubuntu"
},
{
"code": null,
"e": 6523,
"s": 6489,
"text": " Install Maven on Windows Command"
},
{
"code": null,
"e": 6558,
"s": 6523,
"text": " Add OJDBC jar to Maven Repository"
},
{
"code": null,
"e": 6582,
"s": 6558,
"text": " Install Ant on Windows"
},
{
"code": null,
"e": 6611,
"s": 6582,
"text": " Install RabbitMQ on Windows"
},
{
"code": null,
"e": 6643,
"s": 6611,
"text": " Install Apache Kafka on Ubuntu"
}
] |
SciPy - Cluster Hierarchy Dendrogram - GeeksforGeeks | 21 Nov, 2021
In this article, we will learn about Cluster Hierarchy Dendrogram using Scipy module in python. For this first we will discuss some related concepts which are as follows:
Hierarchical clustering requires creating clusters that have a predetermined ordering from top to bottom. It is a type of unsupervised machine learning algorithm used to cluster unlabeled data points.
Each data point should be treated as a cluster at the start.Denote the number of clusters at the start as K.Form one cluster by combining the two nearest data points resulting in K-1 clusters.Form more clusters by combining the two closest clusters resulting in K-2 clusters.Repeat the above four steps until a single big cluster is created.Dendrograms are used to divide into multiple clusters as soon as a cluster is created.
Each data point should be treated as a cluster at the start.
Denote the number of clusters at the start as K.
Form one cluster by combining the two nearest data points resulting in K-1 clusters.
Form more clusters by combining the two closest clusters resulting in K-2 clusters.
Repeat the above four steps until a single big cluster is created.
Dendrograms are used to divide into multiple clusters as soon as a cluster is created.
1. Divisive clustering
Divisive clustering, also known as the top-down clustering method assigns all of the observations to a single cluster and then partition the cluster into two least similar clusters.
2. Agglomerative clustering
In the agglomerative or bottom-up clustering method, each observation is assigned to its own cluster.
1. Single Linkage
Single linkage clustering often yields clusters in which individuals are added sequentially to a single group. The distance between the two clusters is defined as the distance between their two nearest data points.
L(a , b) = min(D(xai , xbj))
2. Complete Linkage
Complete linkage clustering generally yields clusters that are well segregated and compact. The distance between the two clusters is defined as the longest distance between two data points in each cluster.
L(a , b) = max(D(xai , xbj))
3. Simple Average
The simple average algorithm defines the distance between clusters as the average distance between each of the members, weighted so that the two clusters have an equal influence on the final output.
L(a , b) = Tab / ( Na * Nb)
Tab: The sum of all pairwise distances between the two clusters.
Na and Nb: The sizes of the clusters a and b, respectively.
A Dendrogram is a tree-like diagram used to visualize the relationship among clusters. More the distance of the vertical lines in the dendrogram, the more the distance between those clusters. The key to interpreting a dendrogram is to concentrate on the height at which any two objects are joined together.
Example of a dendrogram:
Suppose we have six clusters: P, Q, R, S, T, and U. Cluster Hierarchy Dendrogram of these six observations shown on the scatterplot is:
Dendrogram from the given scatterplot
Parts of a dendrogram:
Parts of a Dendrogram
The branches of the dendrogram are called the Clades. These clades are arranged according to how similar or dissimilar they are.
Each clade of the dendrogram has one or more leaves. P, Q, R, S, T, and U are leaves of the dendrogram:Triple (trifolious): P, Q, RDouble (bifolius): S, TSingle (simplicifolius): U
Triple (trifolious): P, Q, R
Double (bifolius): S, T
Single (simplicifolius): U
For implementing the hierarchical clustering and plotting dendrogram we will use some methods which are as follows:
The functions for hierarchical and agglomerative clustering are provided by the hierarchy module.
To perform hierarchical clustering, scipy.cluster.hierarchy.linkage function is used. The parameters of this function are:
Syntax: scipy.cluster.hierarchy.linkage(ndarray , method , metric , optimal_ordering)
To plot the hierarchical clustering as a dendrogram scipy.cluster.hierarchy.dendrogram function is used.
Syntax: scipy.cluster.hierarchy.dendrogram(Z , p , truncate_mode , color_threshold , get_leaves , orientation , labels , count_sort , distance_sort , show_leaf_counts , no_plot , no_labels , leaf_font_size , leaf_rotation , leaf_label_func , show_contracted , link_color_func , ax , above_threshold_color)
Example 1: Normal Dendrogram
Python
# Python program to plot the hierarchical# clustering dendrogram using SciPy # Import the python librariesimport numpy as npfrom scipy.cluster import hierarchyimport matplotlib.pyplot as plt # Create an arrayx = np.array([100., 200., 300., 400., 500., 250., 450., 280., 450., 750.]) # Plot the hierarchical clustering as a dendrogram.temp = hierarchy.linkage(x, 'single')plt.figure() dn = hierarchy.dendrogram( temp, above_threshold_color="green", color_threshold=.7)
Output:
Example 2: Dendrogram using horizontal orientation:
Python
# Plot the dendrogram in horizontal orientation # Import the python librariesimport numpy as npfrom scipy.cluster import hierarchyimport matplotlib.pyplot as plt # Create an arrayx = np.array([100., 200., 300., 400., 500., 250., 450., 280., 450., 750.]) # Plot the hierarchical clustering as a dendrogram.temp = hierarchy.linkage(x, 'single')plt.figure()dn = hierarchy.dendrogram( temp, above_threshold_color="green", color_threshold=.7, orientation='right')
Output:
The parameter orientation of scipy.cluster.hierarchy.dendrogram has been set to ‘right’. It plots the root at the right, and plot descendant links going left.
kapoorsagar226
Picked
Python-scipy
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Python OOPs Concepts
How to Install PIP on Windows ?
Bar Plot in Matplotlib
Defaultdict in Python
Python Classes and Objects
Deque in Python
Check if element exists in list in Python
How to drop one or multiple columns in Pandas Dataframe
Python - Ways to remove duplicates from list
Class method vs Static method in Python | [
{
"code": null,
"e": 24212,
"s": 24184,
"text": "\n21 Nov, 2021"
},
{
"code": null,
"e": 24383,
"s": 24212,
"text": "In this article, we will learn about Cluster Hierarchy Dendrogram using Scipy module in python. For this first we will discuss some related concepts which are as follows:"
},
{
"code": null,
"e": 24585,
"s": 24383,
"text": "Hierarchical clustering requires creating clusters that have a predetermined ordering from top to bottom. It is a type of unsupervised machine learning algorithm used to cluster unlabeled data points. "
},
{
"code": null,
"e": 25013,
"s": 24585,
"text": "Each data point should be treated as a cluster at the start.Denote the number of clusters at the start as K.Form one cluster by combining the two nearest data points resulting in K-1 clusters.Form more clusters by combining the two closest clusters resulting in K-2 clusters.Repeat the above four steps until a single big cluster is created.Dendrograms are used to divide into multiple clusters as soon as a cluster is created."
},
{
"code": null,
"e": 25074,
"s": 25013,
"text": "Each data point should be treated as a cluster at the start."
},
{
"code": null,
"e": 25123,
"s": 25074,
"text": "Denote the number of clusters at the start as K."
},
{
"code": null,
"e": 25208,
"s": 25123,
"text": "Form one cluster by combining the two nearest data points resulting in K-1 clusters."
},
{
"code": null,
"e": 25292,
"s": 25208,
"text": "Form more clusters by combining the two closest clusters resulting in K-2 clusters."
},
{
"code": null,
"e": 25359,
"s": 25292,
"text": "Repeat the above four steps until a single big cluster is created."
},
{
"code": null,
"e": 25446,
"s": 25359,
"text": "Dendrograms are used to divide into multiple clusters as soon as a cluster is created."
},
{
"code": null,
"e": 25469,
"s": 25446,
"text": "1. Divisive clustering"
},
{
"code": null,
"e": 25651,
"s": 25469,
"text": "Divisive clustering, also known as the top-down clustering method assigns all of the observations to a single cluster and then partition the cluster into two least similar clusters."
},
{
"code": null,
"e": 25679,
"s": 25651,
"text": "2. Agglomerative clustering"
},
{
"code": null,
"e": 25781,
"s": 25679,
"text": "In the agglomerative or bottom-up clustering method, each observation is assigned to its own cluster."
},
{
"code": null,
"e": 25799,
"s": 25781,
"text": "1. Single Linkage"
},
{
"code": null,
"e": 26014,
"s": 25799,
"text": "Single linkage clustering often yields clusters in which individuals are added sequentially to a single group. The distance between the two clusters is defined as the distance between their two nearest data points."
},
{
"code": null,
"e": 26044,
"s": 26014,
"text": "L(a , b) = min(D(xai , xbj)) "
},
{
"code": null,
"e": 26064,
"s": 26044,
"text": "2. Complete Linkage"
},
{
"code": null,
"e": 26270,
"s": 26064,
"text": "Complete linkage clustering generally yields clusters that are well segregated and compact. The distance between the two clusters is defined as the longest distance between two data points in each cluster."
},
{
"code": null,
"e": 26299,
"s": 26270,
"text": "L(a , b) = max(D(xai , xbj))"
},
{
"code": null,
"e": 26321,
"s": 26303,
"text": "3. Simple Average"
},
{
"code": null,
"e": 26520,
"s": 26321,
"text": "The simple average algorithm defines the distance between clusters as the average distance between each of the members, weighted so that the two clusters have an equal influence on the final output."
},
{
"code": null,
"e": 26673,
"s": 26520,
"text": "L(a , b) = Tab / ( Na * Nb)\nTab: The sum of all pairwise distances between the two clusters.\nNa and Nb: The sizes of the clusters a and b, respectively."
},
{
"code": null,
"e": 26984,
"s": 26677,
"text": "A Dendrogram is a tree-like diagram used to visualize the relationship among clusters. More the distance of the vertical lines in the dendrogram, the more the distance between those clusters. The key to interpreting a dendrogram is to concentrate on the height at which any two objects are joined together."
},
{
"code": null,
"e": 27009,
"s": 26984,
"text": "Example of a dendrogram:"
},
{
"code": null,
"e": 27145,
"s": 27009,
"text": "Suppose we have six clusters: P, Q, R, S, T, and U. Cluster Hierarchy Dendrogram of these six observations shown on the scatterplot is:"
},
{
"code": null,
"e": 27183,
"s": 27145,
"text": "Dendrogram from the given scatterplot"
},
{
"code": null,
"e": 27206,
"s": 27183,
"text": "Parts of a dendrogram:"
},
{
"code": null,
"e": 27228,
"s": 27206,
"text": "Parts of a Dendrogram"
},
{
"code": null,
"e": 27357,
"s": 27228,
"text": "The branches of the dendrogram are called the Clades. These clades are arranged according to how similar or dissimilar they are."
},
{
"code": null,
"e": 27538,
"s": 27357,
"text": "Each clade of the dendrogram has one or more leaves. P, Q, R, S, T, and U are leaves of the dendrogram:Triple (trifolious): P, Q, RDouble (bifolius): S, TSingle (simplicifolius): U"
},
{
"code": null,
"e": 27567,
"s": 27538,
"text": "Triple (trifolious): P, Q, R"
},
{
"code": null,
"e": 27591,
"s": 27567,
"text": "Double (bifolius): S, T"
},
{
"code": null,
"e": 27618,
"s": 27591,
"text": "Single (simplicifolius): U"
},
{
"code": null,
"e": 27734,
"s": 27618,
"text": "For implementing the hierarchical clustering and plotting dendrogram we will use some methods which are as follows:"
},
{
"code": null,
"e": 27832,
"s": 27734,
"text": "The functions for hierarchical and agglomerative clustering are provided by the hierarchy module."
},
{
"code": null,
"e": 27955,
"s": 27832,
"text": "To perform hierarchical clustering, scipy.cluster.hierarchy.linkage function is used. The parameters of this function are:"
},
{
"code": null,
"e": 28041,
"s": 27955,
"text": "Syntax: scipy.cluster.hierarchy.linkage(ndarray , method , metric , optimal_ordering)"
},
{
"code": null,
"e": 28146,
"s": 28041,
"text": "To plot the hierarchical clustering as a dendrogram scipy.cluster.hierarchy.dendrogram function is used."
},
{
"code": null,
"e": 28452,
"s": 28146,
"text": "Syntax: scipy.cluster.hierarchy.dendrogram(Z , p , truncate_mode , color_threshold , get_leaves , orientation , labels , count_sort , distance_sort , show_leaf_counts , no_plot , no_labels , leaf_font_size , leaf_rotation , leaf_label_func , show_contracted , link_color_func , ax , above_threshold_color)"
},
{
"code": null,
"e": 28481,
"s": 28452,
"text": "Example 1: Normal Dendrogram"
},
{
"code": null,
"e": 28488,
"s": 28481,
"text": "Python"
},
{
"code": "# Python program to plot the hierarchical# clustering dendrogram using SciPy # Import the python librariesimport numpy as npfrom scipy.cluster import hierarchyimport matplotlib.pyplot as plt # Create an arrayx = np.array([100., 200., 300., 400., 500., 250., 450., 280., 450., 750.]) # Plot the hierarchical clustering as a dendrogram.temp = hierarchy.linkage(x, 'single')plt.figure() dn = hierarchy.dendrogram( temp, above_threshold_color=\"green\", color_threshold=.7)",
"e": 28972,
"s": 28488,
"text": null
},
{
"code": null,
"e": 28980,
"s": 28972,
"text": "Output:"
},
{
"code": null,
"e": 29032,
"s": 28980,
"text": "Example 2: Dendrogram using horizontal orientation:"
},
{
"code": null,
"e": 29039,
"s": 29032,
"text": "Python"
},
{
"code": "# Plot the dendrogram in horizontal orientation # Import the python librariesimport numpy as npfrom scipy.cluster import hierarchyimport matplotlib.pyplot as plt # Create an arrayx = np.array([100., 200., 300., 400., 500., 250., 450., 280., 450., 750.]) # Plot the hierarchical clustering as a dendrogram.temp = hierarchy.linkage(x, 'single')plt.figure()dn = hierarchy.dendrogram( temp, above_threshold_color=\"green\", color_threshold=.7, orientation='right')",
"e": 29514,
"s": 29039,
"text": null
},
{
"code": null,
"e": 29522,
"s": 29514,
"text": "Output:"
},
{
"code": null,
"e": 29681,
"s": 29522,
"text": "The parameter orientation of scipy.cluster.hierarchy.dendrogram has been set to ‘right’. It plots the root at the right, and plot descendant links going left."
},
{
"code": null,
"e": 29696,
"s": 29681,
"text": "kapoorsagar226"
},
{
"code": null,
"e": 29703,
"s": 29696,
"text": "Picked"
},
{
"code": null,
"e": 29716,
"s": 29703,
"text": "Python-scipy"
},
{
"code": null,
"e": 29723,
"s": 29716,
"text": "Python"
},
{
"code": null,
"e": 29821,
"s": 29723,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 29830,
"s": 29821,
"text": "Comments"
},
{
"code": null,
"e": 29843,
"s": 29830,
"text": "Old Comments"
},
{
"code": null,
"e": 29864,
"s": 29843,
"text": "Python OOPs Concepts"
},
{
"code": null,
"e": 29896,
"s": 29864,
"text": "How to Install PIP on Windows ?"
},
{
"code": null,
"e": 29919,
"s": 29896,
"text": "Bar Plot in Matplotlib"
},
{
"code": null,
"e": 29941,
"s": 29919,
"text": "Defaultdict in Python"
},
{
"code": null,
"e": 29968,
"s": 29941,
"text": "Python Classes and Objects"
},
{
"code": null,
"e": 29984,
"s": 29968,
"text": "Deque in Python"
},
{
"code": null,
"e": 30026,
"s": 29984,
"text": "Check if element exists in list in Python"
},
{
"code": null,
"e": 30082,
"s": 30026,
"text": "How to drop one or multiple columns in Pandas Dataframe"
},
{
"code": null,
"e": 30127,
"s": 30082,
"text": "Python - Ways to remove duplicates from list"
}
] |
Get the time difference and convert it to hours in MySQL? | You can achieve with the help of timestampdiff() method from MySQL. The syntax is as follows −
SELECT ABS(TIMESTAMPDIFF(HOUR,yourColumnName1,yourColumnName2)) as
anyVariableName from yourTableName;
To understand the above syntax, let us create a table. The query to create a table is as follows −
mysql> create table DifferenceInHours
-> (
-> StartDateTime datetime,
-> EndDateTime datetime
-> );
Query OK, 0 rows affected (0.59 sec)
Insert some records in the table using insert command. The query is as follows −
mysql> insert into DifferenceInHours values('2018-12-20 10:00:00', '2018-12-19 12:00:00');
Query OK, 1 row affected (0.11 sec)
mysql> insert into DifferenceInHours values('2018-12-20 11:00:00', '2018-12-19 11:00:00');
Query OK, 1 row affected (0.16 sec)
mysql> insert into DifferenceInHours values('2018-12-20 10:30:00', '2018-12-19 11:00:00');
Query OK, 1 row affected (0.13 sec)
Display all records from the table using select statement. The query is as follows −
mysql> select *from DifferenceInHours;
+---------------------+---------------------+
| StartDateTime | EndDateTime |
+---------------------+---------------------+
| 2018-12-20 10:00:00 | 2018-12-19 12:00:00 |
| 2018-12-20 11:00:00 | 2018-12-19 11:00:00 |
| 2018-12-20 10:30:00 | 2018-12-19 11:00:00 |
+---------------------+---------------------+
3 rows in set (0.00 sec)
Here is the query that gets time difference in hours. The query is as follows −
mysql> SELECT ABS(TIMESTAMPDIFF(HOUR,StartDateTime,EndDateTime)) as Hour from
DifferenceInHours;
The following is the output displaying the time difference in hours −
+------+
| Hour |
+------+
| 22 |
| 24 |
| 23 |
+------+
3 rows in set (0.00 sec) | [
{
"code": null,
"e": 1157,
"s": 1062,
"text": "You can achieve with the help of timestampdiff() method from MySQL. The syntax is as follows −"
},
{
"code": null,
"e": 1260,
"s": 1157,
"text": "SELECT ABS(TIMESTAMPDIFF(HOUR,yourColumnName1,yourColumnName2)) as\nanyVariableName from yourTableName;"
},
{
"code": null,
"e": 1359,
"s": 1260,
"text": "To understand the above syntax, let us create a table. The query to create a table is as follows −"
},
{
"code": null,
"e": 1508,
"s": 1359,
"text": "mysql> create table DifferenceInHours\n -> (\n -> StartDateTime datetime,\n -> EndDateTime datetime\n -> );\nQuery OK, 0 rows affected (0.59 sec)"
},
{
"code": null,
"e": 1589,
"s": 1508,
"text": "Insert some records in the table using insert command. The query is as follows −"
},
{
"code": null,
"e": 1972,
"s": 1589,
"text": "mysql> insert into DifferenceInHours values('2018-12-20 10:00:00', '2018-12-19 12:00:00');\nQuery OK, 1 row affected (0.11 sec)\n\nmysql> insert into DifferenceInHours values('2018-12-20 11:00:00', '2018-12-19 11:00:00');\nQuery OK, 1 row affected (0.16 sec)\n\nmysql> insert into DifferenceInHours values('2018-12-20 10:30:00', '2018-12-19 11:00:00');\nQuery OK, 1 row affected (0.13 sec)"
},
{
"code": null,
"e": 2057,
"s": 1972,
"text": "Display all records from the table using select statement. The query is as follows −"
},
{
"code": null,
"e": 2096,
"s": 2057,
"text": "mysql> select *from DifferenceInHours;"
},
{
"code": null,
"e": 2443,
"s": 2096,
"text": "+---------------------+---------------------+\n| StartDateTime | EndDateTime |\n+---------------------+---------------------+\n| 2018-12-20 10:00:00 | 2018-12-19 12:00:00 |\n| 2018-12-20 11:00:00 | 2018-12-19 11:00:00 |\n| 2018-12-20 10:30:00 | 2018-12-19 11:00:00 |\n+---------------------+---------------------+\n3 rows in set (0.00 sec)"
},
{
"code": null,
"e": 2523,
"s": 2443,
"text": "Here is the query that gets time difference in hours. The query is as follows −"
},
{
"code": null,
"e": 2620,
"s": 2523,
"text": "mysql> SELECT ABS(TIMESTAMPDIFF(HOUR,StartDateTime,EndDateTime)) as Hour from\nDifferenceInHours;"
},
{
"code": null,
"e": 2690,
"s": 2620,
"text": "The following is the output displaying the time difference in hours −"
},
{
"code": null,
"e": 2778,
"s": 2690,
"text": "+------+\n| Hour |\n+------+\n| 22 |\n| 24 |\n| 23 |\n+------+\n3 rows in set (0.00 sec)"
}
] |
Change Font Size of ggplot2 Facet Grid Labels in R - GeeksforGeeks | 08 Dec, 2021
In this article, we will see how to change font size of ggplot2 Facet Grid Labels in R Programming Language.
Let us first draw a regular plot without any changes so that the difference is apparent.
Example:
R
library("ggplot2") DF <- data.frame(X = rnorm(20), Y = rnorm(20), group = c("Label 1", "Label 2", "Label 3", "Label 4")) ggplot(DF, aes(X, Y)) + geom_point(size = 5, fill = "green", color = "black", shape = 21) + facet_grid(group ~ .)
Output :
Faceted ScatterPlot using ggplot2
By default, the size of the label is given by the Facets, here it is 9. But we can change the size. For that, we use theme() function, which is used to customize the appearance of plot. We can change size of facet labels, using strip.text it should passed with value to produce labels of desired size.
Syntax : theme(strip.text)
Parameter :
strip.text : For customize the Facet Labels. For horizontal facet labels ‘strip.text.x’ & for vertical facet labels ‘strip.text.y’ is used. this function only takes element_text() function as it’s value. We have to assign factors that we want to modify to element_text .
Return : Theme of the plot.
element_text is a theme element of text, which modify the style or theme of text. It has many parameters for different styles of text. size is one out of them, which changes the size of text.
Syntax : element_text(size, color)
Parameters :
size : Size of Text.
Return : Change the style of Text.
We can both increase and decrease the size. Let us first see the increased version.
Example 1 :
R
library("ggplot2") DF <- data.frame(X = rnorm(20), Y = rnorm(20), group = c("Label 1", "Label 2", "Label 3", "Label 4")) ggplot(DF, aes(X, Y)) + geom_point(size = 5, fill = "green", color = "black", shape = 21) + facet_grid(group ~ .)+ theme(strip.text = element_text( size = 20, color = "dark green"))
Output :
Increased Facet Label Size
Now lets see the decreased one.
Example 2:
R
library("ggplot2") DF <- data.frame(X = rnorm(20), Y = rnorm(20), group = c("Label 1", "Label 2", "Label 3", "Label 4")) ggplot(DF, aes(X, Y)) + geom_point(size = 5, fill = "green", color = "black", shape = 21) + facet_grid(group ~ .)+ theme(strip.text = element_text( size = 5, color = "dark green"))
Output :
Decreased Facet Label size
sagar0719kumar
Picked
R-ggplot
R Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Change Color of Bars in Barchart using ggplot2 in R
Group by function in R using Dplyr
How to Change Axis Scales in R Plots?
How to Split Column Into Multiple Columns in R DataFrame?
Replace Specific Characters in String in R
How to filter R DataFrame by values in a column?
R - if statement
How to import an Excel File into R ?
Plot mean and standard deviation using ggplot2 in R
How to filter R dataframe by multiple conditions? | [
{
"code": null,
"e": 26487,
"s": 26459,
"text": "\n08 Dec, 2021"
},
{
"code": null,
"e": 26597,
"s": 26487,
"text": "In this article, we will see how to change font size of ggplot2 Facet Grid Labels in R Programming Language. "
},
{
"code": null,
"e": 26686,
"s": 26597,
"text": "Let us first draw a regular plot without any changes so that the difference is apparent."
},
{
"code": null,
"e": 26695,
"s": 26686,
"text": "Example:"
},
{
"code": null,
"e": 26697,
"s": 26695,
"text": "R"
},
{
"code": "library(\"ggplot2\") DF <- data.frame(X = rnorm(20), Y = rnorm(20), group = c(\"Label 1\", \"Label 2\", \"Label 3\", \"Label 4\")) ggplot(DF, aes(X, Y)) + geom_point(size = 5, fill = \"green\", color = \"black\", shape = 21) + facet_grid(group ~ .)",
"e": 27074,
"s": 26697,
"text": null
},
{
"code": null,
"e": 27084,
"s": 27074,
"text": "Output : "
},
{
"code": null,
"e": 27118,
"s": 27084,
"text": "Faceted ScatterPlot using ggplot2"
},
{
"code": null,
"e": 27421,
"s": 27118,
"text": "By default, the size of the label is given by the Facets, here it is 9. But we can change the size. For that, we use theme() function, which is used to customize the appearance of plot. We can change size of facet labels, using strip.text it should passed with value to produce labels of desired size."
},
{
"code": null,
"e": 27448,
"s": 27421,
"text": "Syntax : theme(strip.text)"
},
{
"code": null,
"e": 27460,
"s": 27448,
"text": "Parameter :"
},
{
"code": null,
"e": 27731,
"s": 27460,
"text": "strip.text : For customize the Facet Labels. For horizontal facet labels ‘strip.text.x’ & for vertical facet labels ‘strip.text.y’ is used. this function only takes element_text() function as it’s value. We have to assign factors that we want to modify to element_text ."
},
{
"code": null,
"e": 27759,
"s": 27731,
"text": "Return : Theme of the plot."
},
{
"code": null,
"e": 27952,
"s": 27759,
"text": "element_text is a theme element of text, which modify the style or theme of text. It has many parameters for different styles of text. size is one out of them, which changes the size of text. "
},
{
"code": null,
"e": 27987,
"s": 27952,
"text": "Syntax : element_text(size, color)"
},
{
"code": null,
"e": 28000,
"s": 27987,
"text": "Parameters :"
},
{
"code": null,
"e": 28021,
"s": 28000,
"text": "size : Size of Text."
},
{
"code": null,
"e": 28056,
"s": 28021,
"text": "Return : Change the style of Text."
},
{
"code": null,
"e": 28140,
"s": 28056,
"text": "We can both increase and decrease the size. Let us first see the increased version."
},
{
"code": null,
"e": 28153,
"s": 28140,
"text": "Example 1 : "
},
{
"code": null,
"e": 28155,
"s": 28153,
"text": "R"
},
{
"code": "library(\"ggplot2\") DF <- data.frame(X = rnorm(20), Y = rnorm(20), group = c(\"Label 1\", \"Label 2\", \"Label 3\", \"Label 4\")) ggplot(DF, aes(X, Y)) + geom_point(size = 5, fill = \"green\", color = \"black\", shape = 21) + facet_grid(group ~ .)+ theme(strip.text = element_text( size = 20, color = \"dark green\"))",
"e": 28580,
"s": 28155,
"text": null
},
{
"code": null,
"e": 28591,
"s": 28580,
"text": "Output : "
},
{
"code": null,
"e": 28618,
"s": 28591,
"text": "Increased Facet Label Size"
},
{
"code": null,
"e": 28650,
"s": 28618,
"text": "Now lets see the decreased one."
},
{
"code": null,
"e": 28662,
"s": 28650,
"text": "Example 2: "
},
{
"code": null,
"e": 28664,
"s": 28662,
"text": "R"
},
{
"code": "library(\"ggplot2\") DF <- data.frame(X = rnorm(20), Y = rnorm(20), group = c(\"Label 1\", \"Label 2\", \"Label 3\", \"Label 4\")) ggplot(DF, aes(X, Y)) + geom_point(size = 5, fill = \"green\", color = \"black\", shape = 21) + facet_grid(group ~ .)+ theme(strip.text = element_text( size = 5, color = \"dark green\"))",
"e": 29088,
"s": 28664,
"text": null
},
{
"code": null,
"e": 29098,
"s": 29088,
"text": " Output :"
},
{
"code": null,
"e": 29125,
"s": 29098,
"text": "Decreased Facet Label size"
},
{
"code": null,
"e": 29142,
"s": 29127,
"text": "sagar0719kumar"
},
{
"code": null,
"e": 29149,
"s": 29142,
"text": "Picked"
},
{
"code": null,
"e": 29158,
"s": 29149,
"text": "R-ggplot"
},
{
"code": null,
"e": 29169,
"s": 29158,
"text": "R Language"
},
{
"code": null,
"e": 29267,
"s": 29169,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 29319,
"s": 29267,
"text": "Change Color of Bars in Barchart using ggplot2 in R"
},
{
"code": null,
"e": 29354,
"s": 29319,
"text": "Group by function in R using Dplyr"
},
{
"code": null,
"e": 29392,
"s": 29354,
"text": "How to Change Axis Scales in R Plots?"
},
{
"code": null,
"e": 29450,
"s": 29392,
"text": "How to Split Column Into Multiple Columns in R DataFrame?"
},
{
"code": null,
"e": 29493,
"s": 29450,
"text": "Replace Specific Characters in String in R"
},
{
"code": null,
"e": 29542,
"s": 29493,
"text": "How to filter R DataFrame by values in a column?"
},
{
"code": null,
"e": 29559,
"s": 29542,
"text": "R - if statement"
},
{
"code": null,
"e": 29596,
"s": 29559,
"text": "How to import an Excel File into R ?"
},
{
"code": null,
"e": 29648,
"s": 29596,
"text": "Plot mean and standard deviation using ggplot2 in R"
}
] |
sorting in fork() - GeeksforGeeks | 17 May, 2018
Prerequisite – Introduction of fork(), sorting algorithmsProblem statement – Write a program to sort the numbers in parent process and print the unsorted numbers in child process. For example :
Input : 5, 2, 3, 1, 4
Output :
Parent process
sorted numbers are
1, 2, 3, 4, 5
Child process
numbers to sort are
5, 2, 3, 1, 4
Explanation – Here, we had used fork() function to create two processes one child and one parent process.
fork() returns value greater than 0 for parent process so we can perform the sorting operation.
for child process fork() returns 0 so we can perform the printing operation.
Here we are using a simple sorting algorithm to sort the numbers in the desired order.
We are using the returned values of fork() to know which process is a child or which is a parent process.
Note – At some instance of time, it is not necessary that child process will execute first or parent process will be first allotted CPU, any process may get CPU assigned, at some quantum time. Moreover process id may differ during different executions.
Code –
// C++ program to demonstrate sorting in parent and// printing result in child processes using fork()#include <iostream>#include <unistd.h>#include <algorithm>using namespace std; // Driver codeint main(){ int a[] = { 1, 6, 3, 4, 9, 2, 7, 5, 8, 10 }; int n = sizeof(a)/sizeof(a[0]); int id = fork(); // Checking value of process id returned by fork if (id > 0) { cout << "Parent process \n"; sort(a, a+n); // Displaying Array cout << " sorted numbers are "; for (int i = 0; i < n; i++) cout << "\t" << a[i]; cout << "\n"; } // If n is 0 i.e. we are in child process else { cout << "Child process \n"; cout << "\n numbers to be sorted are "; for (int i = 0; i < n; i++) cout << "\t" << a[i]; } return 0;}
Output –
Output :
Parent process
sorted numbers are 1 2 3 4 5 6 7 8 9 10
Child process
numbers to be sorted are 1 6 3 4 9 2 7 5 8 10
This article is contributed by Pushpanjali Chauhan. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to [email protected]. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
AyushSaxena
system-programming
C++
C++ Programs
CPP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Operator Overloading in C++
Polymorphism in C++
Sorting a vector in C++
Friend class and function in C++
std::string class in C++
Header files in C/C++ and its uses
Program to print ASCII Value of a character
How to return multiple values from a function in C or C++?
C++ Program for QuickSort
Sorting a Map by value in C++ STL | [
{
"code": null,
"e": 25367,
"s": 25339,
"text": "\n17 May, 2018"
},
{
"code": null,
"e": 25561,
"s": 25367,
"text": "Prerequisite – Introduction of fork(), sorting algorithmsProblem statement – Write a program to sort the numbers in parent process and print the unsorted numbers in child process. For example :"
},
{
"code": null,
"e": 25695,
"s": 25561,
"text": "Input : 5, 2, 3, 1, 4\n\nOutput :\nParent process \nsorted numbers are\n1, 2, 3, 4, 5\n\n\nChild process \nnumbers to sort are\n 5, 2, 3, 1, 4\n"
},
{
"code": null,
"e": 25801,
"s": 25695,
"text": "Explanation – Here, we had used fork() function to create two processes one child and one parent process."
},
{
"code": null,
"e": 25897,
"s": 25801,
"text": "fork() returns value greater than 0 for parent process so we can perform the sorting operation."
},
{
"code": null,
"e": 25974,
"s": 25897,
"text": "for child process fork() returns 0 so we can perform the printing operation."
},
{
"code": null,
"e": 26061,
"s": 25974,
"text": "Here we are using a simple sorting algorithm to sort the numbers in the desired order."
},
{
"code": null,
"e": 26167,
"s": 26061,
"text": "We are using the returned values of fork() to know which process is a child or which is a parent process."
},
{
"code": null,
"e": 26420,
"s": 26167,
"text": "Note – At some instance of time, it is not necessary that child process will execute first or parent process will be first allotted CPU, any process may get CPU assigned, at some quantum time. Moreover process id may differ during different executions."
},
{
"code": null,
"e": 26427,
"s": 26420,
"text": "Code –"
},
{
"code": "// C++ program to demonstrate sorting in parent and// printing result in child processes using fork()#include <iostream>#include <unistd.h>#include <algorithm>using namespace std; // Driver codeint main(){ int a[] = { 1, 6, 3, 4, 9, 2, 7, 5, 8, 10 }; int n = sizeof(a)/sizeof(a[0]); int id = fork(); // Checking value of process id returned by fork if (id > 0) { cout << \"Parent process \\n\"; sort(a, a+n); // Displaying Array cout << \" sorted numbers are \"; for (int i = 0; i < n; i++) cout << \"\\t\" << a[i]; cout << \"\\n\"; } // If n is 0 i.e. we are in child process else { cout << \"Child process \\n\"; cout << \"\\n numbers to be sorted are \"; for (int i = 0; i < n; i++) cout << \"\\t\" << a[i]; } return 0;}",
"e": 27273,
"s": 26427,
"text": null
},
{
"code": null,
"e": 27282,
"s": 27273,
"text": "Output –"
},
{
"code": null,
"e": 27410,
"s": 27282,
"text": "Output :\nParent process \nsorted numbers are 1 2 3 4 5 6 7 8 9 10\n\nChild process \nnumbers to be sorted are 1 6 3 4 9 2 7 5 8 10\n"
},
{
"code": null,
"e": 27717,
"s": 27410,
"text": "This article is contributed by Pushpanjali Chauhan. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to [email protected]. See your article appearing on the GeeksforGeeks main page and help other Geeks."
},
{
"code": null,
"e": 27842,
"s": 27717,
"text": "Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above."
},
{
"code": null,
"e": 27854,
"s": 27842,
"text": "AyushSaxena"
},
{
"code": null,
"e": 27873,
"s": 27854,
"text": "system-programming"
},
{
"code": null,
"e": 27877,
"s": 27873,
"text": "C++"
},
{
"code": null,
"e": 27890,
"s": 27877,
"text": "C++ Programs"
},
{
"code": null,
"e": 27894,
"s": 27890,
"text": "CPP"
},
{
"code": null,
"e": 27992,
"s": 27894,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 28020,
"s": 27992,
"text": "Operator Overloading in C++"
},
{
"code": null,
"e": 28040,
"s": 28020,
"text": "Polymorphism in C++"
},
{
"code": null,
"e": 28064,
"s": 28040,
"text": "Sorting a vector in C++"
},
{
"code": null,
"e": 28097,
"s": 28064,
"text": "Friend class and function in C++"
},
{
"code": null,
"e": 28122,
"s": 28097,
"text": "std::string class in C++"
},
{
"code": null,
"e": 28157,
"s": 28122,
"text": "Header files in C/C++ and its uses"
},
{
"code": null,
"e": 28201,
"s": 28157,
"text": "Program to print ASCII Value of a character"
},
{
"code": null,
"e": 28260,
"s": 28201,
"text": "How to return multiple values from a function in C or C++?"
},
{
"code": null,
"e": 28286,
"s": 28260,
"text": "C++ Program for QuickSort"
}
] |
How to create multiple background image parallax in CSS ? - GeeksforGeeks | 08 Sep, 2021
In this article, we will learn How to create multiple background image parallax in CSS.
Approach: First, we will add background images using the background-image property in CSS. We can add multiple images using background-image.
Syntax:
background-image: url(image_url1),url(image_url2),...;
Then we apply animation property in CSS that animate the images.
Syntax:
animation: duration timing-function iteration-count direction;
Below is the full implementation of the above approach:
Example 1:
HTML
<!DOCTYPE html><html lang="en"> <head> <style> html { /* Add background image */ background-image: url("gfg_stiker.png"); /* Repeat image in x-axis */ background-repeat: repeat-x; /* Animate Using animation: duration timing-function iteration-count direction; */ animation: 30s parallel infinite linear; } /* timing-function */ @keyframes parallel { 100% { /* set background-position */ background-position: -5000px 20%; } } </style> </head> <body> <div id="rocket"> <img src="gfg_stiker.png" alt="rocket" style="margin: 200px 0px 50px 35%;"> </div> </body></html>
Output:
Example 2:
HTML
<!DOCTYPE html><html lang="en"> <head> <style> html { /* Add background image */ background-image: url("gfg_complete_logo_2x-min.png"); /* Repeat image in y-axis */ background-repeat: repeat-y; /* Animate Using animation: duration timing-function iteration-count direction; */ animation: 30s parallel infinite linear; } /* timing-function */ @keyframes parallel { 100% { /* set background-position */ background-position: 5000px 20%; } } </style> </head> <body> <div id="rocket"> <img src="gfg_complete_logo_2x-min.png" alt="rocket" style="margin: 200px 0px 50px 35%;"> </div> </body></html>
Output:
surinderdawra388
CSS-Properties
CSS-Questions
HTML-Tags
Picked
CSS
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Design a web page using HTML and CSS
How to set space between the flexbox ?
Form validation using jQuery
Search Bar using HTML, CSS and JavaScript
How to style a checkbox using CSS?
Remove elements from a JavaScript Array
Installation of Node.js on Linux
Convert a string to an integer in JavaScript
How to fetch data from an API in ReactJS ?
Difference between var, let and const keywords in JavaScript | [
{
"code": null,
"e": 26621,
"s": 26593,
"text": "\n08 Sep, 2021"
},
{
"code": null,
"e": 26711,
"s": 26621,
"text": "In this article, we will learn How to create multiple background image parallax in CSS. "
},
{
"code": null,
"e": 26853,
"s": 26711,
"text": "Approach: First, we will add background images using the background-image property in CSS. We can add multiple images using background-image."
},
{
"code": null,
"e": 26861,
"s": 26853,
"text": "Syntax:"
},
{
"code": null,
"e": 26916,
"s": 26861,
"text": "background-image: url(image_url1),url(image_url2),...;"
},
{
"code": null,
"e": 26981,
"s": 26916,
"text": "Then we apply animation property in CSS that animate the images."
},
{
"code": null,
"e": 26989,
"s": 26981,
"text": "Syntax:"
},
{
"code": null,
"e": 27052,
"s": 26989,
"text": "animation: duration timing-function iteration-count direction;"
},
{
"code": null,
"e": 27108,
"s": 27052,
"text": "Below is the full implementation of the above approach:"
},
{
"code": null,
"e": 27119,
"s": 27108,
"text": "Example 1:"
},
{
"code": null,
"e": 27124,
"s": 27119,
"text": "HTML"
},
{
"code": "<!DOCTYPE html><html lang=\"en\"> <head> <style> html { /* Add background image */ background-image: url(\"gfg_stiker.png\"); /* Repeat image in x-axis */ background-repeat: repeat-x; /* Animate Using animation: duration timing-function iteration-count direction; */ animation: 30s parallel infinite linear; } /* timing-function */ @keyframes parallel { 100% { /* set background-position */ background-position: -5000px 20%; } } </style> </head> <body> <div id=\"rocket\"> <img src=\"gfg_stiker.png\" alt=\"rocket\" style=\"margin: 200px 0px 50px 35%;\"> </div> </body></html>",
"e": 27824,
"s": 27124,
"text": null
},
{
"code": null,
"e": 27832,
"s": 27824,
"text": "Output:"
},
{
"code": null,
"e": 27843,
"s": 27832,
"text": "Example 2:"
},
{
"code": null,
"e": 27848,
"s": 27843,
"text": "HTML"
},
{
"code": "<!DOCTYPE html><html lang=\"en\"> <head> <style> html { /* Add background image */ background-image: url(\"gfg_complete_logo_2x-min.png\"); /* Repeat image in y-axis */ background-repeat: repeat-y; /* Animate Using animation: duration timing-function iteration-count direction; */ animation: 30s parallel infinite linear; } /* timing-function */ @keyframes parallel { 100% { /* set background-position */ background-position: 5000px 20%; } } </style> </head> <body> <div id=\"rocket\"> <img src=\"gfg_complete_logo_2x-min.png\" alt=\"rocket\" style=\"margin: 200px 0px 50px 35%;\"> </div> </body></html>",
"e": 28575,
"s": 27848,
"text": null
},
{
"code": null,
"e": 28583,
"s": 28575,
"text": "Output:"
},
{
"code": null,
"e": 28600,
"s": 28583,
"text": "surinderdawra388"
},
{
"code": null,
"e": 28615,
"s": 28600,
"text": "CSS-Properties"
},
{
"code": null,
"e": 28629,
"s": 28615,
"text": "CSS-Questions"
},
{
"code": null,
"e": 28639,
"s": 28629,
"text": "HTML-Tags"
},
{
"code": null,
"e": 28646,
"s": 28639,
"text": "Picked"
},
{
"code": null,
"e": 28650,
"s": 28646,
"text": "CSS"
},
{
"code": null,
"e": 28667,
"s": 28650,
"text": "Web Technologies"
},
{
"code": null,
"e": 28765,
"s": 28667,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 28802,
"s": 28765,
"text": "Design a web page using HTML and CSS"
},
{
"code": null,
"e": 28841,
"s": 28802,
"text": "How to set space between the flexbox ?"
},
{
"code": null,
"e": 28870,
"s": 28841,
"text": "Form validation using jQuery"
},
{
"code": null,
"e": 28912,
"s": 28870,
"text": "Search Bar using HTML, CSS and JavaScript"
},
{
"code": null,
"e": 28947,
"s": 28912,
"text": "How to style a checkbox using CSS?"
},
{
"code": null,
"e": 28987,
"s": 28947,
"text": "Remove elements from a JavaScript Array"
},
{
"code": null,
"e": 29020,
"s": 28987,
"text": "Installation of Node.js on Linux"
},
{
"code": null,
"e": 29065,
"s": 29020,
"text": "Convert a string to an integer in JavaScript"
},
{
"code": null,
"e": 29108,
"s": 29065,
"text": "How to fetch data from an API in ReactJS ?"
}
] |
Python | Delete elements in range - GeeksforGeeks | 26 Feb, 2019
The deletion of a single element comparatively easier, but when we wish to delete element in range, the task becomes a tedious once due to the rearrangements and shifting of list elements automatically in python. Let’s discuss certain ways in which elements can be deleted in range.
Method #1 : Using del + sorted()In this method, we reverse the list of indices we wish to delete and delete them in the original list in backward manner so that the rearrangement of list doesn’t destroy the integrity of the solution.
# Python3 code to demonstrate# range deletion of elements # using del + sorted() # initializing list test_list = [3, 5, 6, 7, 2, 10] # initializing indicesindices_list = [1, 4, 2] # printing the original listprint ("The original list is : " + str(test_list)) # printing the indices listprint ("The indices list is : " + str(indices_list)) # using del + sorted()# range deletion of elementsfor i in sorted(indices_list, reverse = True): del test_list[i] # printing resultprint ("The modified deleted list is : " + str(test_list))
The original list is : [3, 5, 6, 7, 2, 10]
The indices list is : [1, 4, 2]
The modified deleted list is : [3, 7, 10]
Method #2 : Using enumerate() + list comprehensionThis task can also be performed if we make a list that would not have the elements in the delete list, i.e rather than actually deleting the elements, we can remake it without them.
# Python3 code to demonstrate# range deletion of elements # using enumerate() + list comprehension # initializing list test_list = [3, 5, 6, 7, 2, 10] # initializing indicesindices_list = [1, 4, 2] # printing the original listprint ("The original list is : " + str(test_list)) # printing the indices listprint ("The indices list is : " + str(indices_list)) # using enumerate() + list comprehension# range deletion of elementstest_list[:] = [ j for i, j in enumerate(test_list) if i not in indices_list ] # printing resultprint ("The modified deleted list is : " + str(test_list))
The original list is : [3, 5, 6, 7, 2, 10]
The indices list is : [1, 4, 2]
The modified deleted list is : [3, 7, 10]
Python list-programs
python-list
Python
Python Programs
python-list
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
Python Classes and Objects
How to drop one or multiple columns in Pandas Dataframe
Defaultdict in Python
Python | Get dictionary keys as a list
Python | Split string into list of characters
Python | Convert a list to dictionary
How to print without newline in Python? | [
{
"code": null,
"e": 25537,
"s": 25509,
"text": "\n26 Feb, 2019"
},
{
"code": null,
"e": 25820,
"s": 25537,
"text": "The deletion of a single element comparatively easier, but when we wish to delete element in range, the task becomes a tedious once due to the rearrangements and shifting of list elements automatically in python. Let’s discuss certain ways in which elements can be deleted in range."
},
{
"code": null,
"e": 26054,
"s": 25820,
"text": "Method #1 : Using del + sorted()In this method, we reverse the list of indices we wish to delete and delete them in the original list in backward manner so that the rearrangement of list doesn’t destroy the integrity of the solution."
},
{
"code": "# Python3 code to demonstrate# range deletion of elements # using del + sorted() # initializing list test_list = [3, 5, 6, 7, 2, 10] # initializing indicesindices_list = [1, 4, 2] # printing the original listprint (\"The original list is : \" + str(test_list)) # printing the indices listprint (\"The indices list is : \" + str(indices_list)) # using del + sorted()# range deletion of elementsfor i in sorted(indices_list, reverse = True): del test_list[i] # printing resultprint (\"The modified deleted list is : \" + str(test_list))",
"e": 26592,
"s": 26054,
"text": null
},
{
"code": null,
"e": 26710,
"s": 26592,
"text": "The original list is : [3, 5, 6, 7, 2, 10]\nThe indices list is : [1, 4, 2]\nThe modified deleted list is : [3, 7, 10]\n"
},
{
"code": null,
"e": 26943,
"s": 26710,
"text": " Method #2 : Using enumerate() + list comprehensionThis task can also be performed if we make a list that would not have the elements in the delete list, i.e rather than actually deleting the elements, we can remake it without them."
},
{
"code": "# Python3 code to demonstrate# range deletion of elements # using enumerate() + list comprehension # initializing list test_list = [3, 5, 6, 7, 2, 10] # initializing indicesindices_list = [1, 4, 2] # printing the original listprint (\"The original list is : \" + str(test_list)) # printing the indices listprint (\"The indices list is : \" + str(indices_list)) # using enumerate() + list comprehension# range deletion of elementstest_list[:] = [ j for i, j in enumerate(test_list) if i not in indices_list ] # printing resultprint (\"The modified deleted list is : \" + str(test_list))",
"e": 27553,
"s": 26943,
"text": null
},
{
"code": null,
"e": 27671,
"s": 27553,
"text": "The original list is : [3, 5, 6, 7, 2, 10]\nThe indices list is : [1, 4, 2]\nThe modified deleted list is : [3, 7, 10]\n"
},
{
"code": null,
"e": 27692,
"s": 27671,
"text": "Python list-programs"
},
{
"code": null,
"e": 27704,
"s": 27692,
"text": "python-list"
},
{
"code": null,
"e": 27711,
"s": 27704,
"text": "Python"
},
{
"code": null,
"e": 27727,
"s": 27711,
"text": "Python Programs"
},
{
"code": null,
"e": 27739,
"s": 27727,
"text": "python-list"
},
{
"code": null,
"e": 27837,
"s": 27739,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 27869,
"s": 27837,
"text": "How to Install PIP on Windows ?"
},
{
"code": null,
"e": 27911,
"s": 27869,
"text": "Check if element exists in list in Python"
},
{
"code": null,
"e": 27953,
"s": 27911,
"text": "How To Convert Python Dictionary To JSON?"
},
{
"code": null,
"e": 27980,
"s": 27953,
"text": "Python Classes and Objects"
},
{
"code": null,
"e": 28036,
"s": 27980,
"text": "How to drop one or multiple columns in Pandas Dataframe"
},
{
"code": null,
"e": 28058,
"s": 28036,
"text": "Defaultdict in Python"
},
{
"code": null,
"e": 28097,
"s": 28058,
"text": "Python | Get dictionary keys as a list"
},
{
"code": null,
"e": 28143,
"s": 28097,
"text": "Python | Split string into list of characters"
},
{
"code": null,
"e": 28181,
"s": 28143,
"text": "Python | Convert a list to dictionary"
}
] |
How to implement BarChart in ReactJS ? - GeeksforGeeks | 04 Mar, 2021
In our React app sometimes we want to display a BarChart representation of a particular data. We can use react-chartjs-2 and chart.js module in ReactJS to display information in BarCharts format. Following are some simple steps to do so:
Step 1: Create a React application using the following command.
npx create-react-app BARCHART_REACT
Step 2: After creating your project folder i.e. BARCHART_REACT, move to it using the following command.
cd BARCHART_REACT
Step 3: After creating the ReactJS application, Install react-chartjs-2 and chart.js modules using the following command.
npm install --save react-chartjs-2 chart.js
Project structure:
Example: Now write down the following code in the App.js file. Here, App is our default component where we have written our code.
App.js
import { Bar } from "react-chartjs-2"; function App() { return ( <div className="App"> <h1>GEEKSFORGEEKS BAR CHART REACTJS</h1> <div style={{ maxWidth: "650px" }}> <Bar data={{ // Name of the variables on x-axies for each bar labels: ["1st bar", "2nd bar", "3rd bar", "4th bar"], datasets: [ { // Label for bars label: "total count/value", // Data or value of your each variable data: [1552, 1319, 613, 1400], // Color of each bar backgroundColor: ["aqua", "green", "red", "yellow"], // Border color of each bar borderColor: ["aqua", "green", "red", "yellow"], borderWidth: 0.5, }, ], }} // Height of graph height={400} options={{ maintainAspectRatio: false, scales: { yAxes: [ { ticks: { // The y-axis value will start from zero beginAtZero: true, }, }, ], }, legend: { labels: { fontSize: 15, }, }, }} /> </div> </div> );} export default App;
Step to Run Application: Run the application using the following command from the root directory of the project:
npm start
Output: Now open your browser and go to http://localhost:3000/, you will see the following output:
React-Questions
Technical Scripter 2020
ReactJS
Technical Scripter
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
ReactJS useNavigate() Hook
How to set background images in ReactJS ?
Axios in React: A Guide for Beginners
How to create a table in ReactJS ?
How to navigate on path by button click in react router ?
Remove elements from a JavaScript Array
Installation of Node.js on Linux
Convert a string to an integer in JavaScript
How to insert spaces/tabs in text using HTML/CSS?
Difference between var, let and const keywords in JavaScript | [
{
"code": null,
"e": 26071,
"s": 26043,
"text": "\n04 Mar, 2021"
},
{
"code": null,
"e": 26309,
"s": 26071,
"text": "In our React app sometimes we want to display a BarChart representation of a particular data. We can use react-chartjs-2 and chart.js module in ReactJS to display information in BarCharts format. Following are some simple steps to do so:"
},
{
"code": null,
"e": 26373,
"s": 26309,
"text": "Step 1: Create a React application using the following command."
},
{
"code": null,
"e": 26409,
"s": 26373,
"text": "npx create-react-app BARCHART_REACT"
},
{
"code": null,
"e": 26513,
"s": 26409,
"text": "Step 2: After creating your project folder i.e. BARCHART_REACT, move to it using the following command."
},
{
"code": null,
"e": 26531,
"s": 26513,
"text": "cd BARCHART_REACT"
},
{
"code": null,
"e": 26653,
"s": 26531,
"text": "Step 3: After creating the ReactJS application, Install react-chartjs-2 and chart.js modules using the following command."
},
{
"code": null,
"e": 26697,
"s": 26653,
"text": "npm install --save react-chartjs-2 chart.js"
},
{
"code": null,
"e": 26716,
"s": 26697,
"text": "Project structure:"
},
{
"code": null,
"e": 26846,
"s": 26716,
"text": "Example: Now write down the following code in the App.js file. Here, App is our default component where we have written our code."
},
{
"code": null,
"e": 26853,
"s": 26846,
"text": "App.js"
},
{
"code": "import { Bar } from \"react-chartjs-2\"; function App() { return ( <div className=\"App\"> <h1>GEEKSFORGEEKS BAR CHART REACTJS</h1> <div style={{ maxWidth: \"650px\" }}> <Bar data={{ // Name of the variables on x-axies for each bar labels: [\"1st bar\", \"2nd bar\", \"3rd bar\", \"4th bar\"], datasets: [ { // Label for bars label: \"total count/value\", // Data or value of your each variable data: [1552, 1319, 613, 1400], // Color of each bar backgroundColor: [\"aqua\", \"green\", \"red\", \"yellow\"], // Border color of each bar borderColor: [\"aqua\", \"green\", \"red\", \"yellow\"], borderWidth: 0.5, }, ], }} // Height of graph height={400} options={{ maintainAspectRatio: false, scales: { yAxes: [ { ticks: { // The y-axis value will start from zero beginAtZero: true, }, }, ], }, legend: { labels: { fontSize: 15, }, }, }} /> </div> </div> );} export default App;",
"e": 28220,
"s": 26853,
"text": null
},
{
"code": null,
"e": 28333,
"s": 28220,
"text": "Step to Run Application: Run the application using the following command from the root directory of the project:"
},
{
"code": null,
"e": 28343,
"s": 28333,
"text": "npm start"
},
{
"code": null,
"e": 28442,
"s": 28343,
"text": "Output: Now open your browser and go to http://localhost:3000/, you will see the following output:"
},
{
"code": null,
"e": 28458,
"s": 28442,
"text": "React-Questions"
},
{
"code": null,
"e": 28482,
"s": 28458,
"text": "Technical Scripter 2020"
},
{
"code": null,
"e": 28490,
"s": 28482,
"text": "ReactJS"
},
{
"code": null,
"e": 28509,
"s": 28490,
"text": "Technical Scripter"
},
{
"code": null,
"e": 28526,
"s": 28509,
"text": "Web Technologies"
},
{
"code": null,
"e": 28624,
"s": 28526,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 28651,
"s": 28624,
"text": "ReactJS useNavigate() Hook"
},
{
"code": null,
"e": 28693,
"s": 28651,
"text": "How to set background images in ReactJS ?"
},
{
"code": null,
"e": 28731,
"s": 28693,
"text": "Axios in React: A Guide for Beginners"
},
{
"code": null,
"e": 28766,
"s": 28731,
"text": "How to create a table in ReactJS ?"
},
{
"code": null,
"e": 28824,
"s": 28766,
"text": "How to navigate on path by button click in react router ?"
},
{
"code": null,
"e": 28864,
"s": 28824,
"text": "Remove elements from a JavaScript Array"
},
{
"code": null,
"e": 28897,
"s": 28864,
"text": "Installation of Node.js on Linux"
},
{
"code": null,
"e": 28942,
"s": 28897,
"text": "Convert a string to an integer in JavaScript"
},
{
"code": null,
"e": 28992,
"s": 28942,
"text": "How to insert spaces/tabs in text using HTML/CSS?"
}
] |
How to Convert string to float type in Golang? - GeeksforGeeks | 19 May, 2020
ParseFloat function is an in-build function in the strconv library which converts the string type into a floating-point number with the precision specified by bit size.
Example: In this example the same string -2.514 is being converted into float data type and then their sum is being printed. Once it is converted to 8 bit-size and other times it is 32 bit-size. Both yield different results because ParseFloat accepts decimal and hexadecimal floating-point number syntax. If a1 or a2 is well-formed and near a valid floating-point number, ParseFloat returns the nearest floating-point number rounded using IEEE754 unbiased rounding which is parsing a hexadecimal floating-point value only rounds when there are more bits in the hexadecimal representation than will fit in the mantissa.
// Golang program to Convert// string to float typepackage main import ( "fmt" "strconv") func main() { // defining a string a1 a1 := "-2.514" // converting the string a1 // into float and storing it // in b1 using ParseFloat b1, _ := strconv.ParseFloat(a1, 8) // printing the float b1 fmt.Println(b1) a2 := "-2.514" b2, _ := strconv.ParseFloat(a2, 32) fmt.Println(b2) fmt.Println(b1 + b2)}
Output:
-2.514
-2.5139999389648438
-5.027999938964843
Golang-Program
Golang-strconv
Picked
Go Language
Write From Home
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
6 Best Books to Learn Go Programming Language
How to Parse JSON in Golang?
Strings in Golang
Time Durations in Golang
Structures in Golang
Convert integer to string in Python
Convert string to integer in Python
How to set input type date in dd-mm-yyyy format using HTML ?
Python infinity
Matplotlib.pyplot.title() in Python | [
{
"code": null,
"e": 25703,
"s": 25675,
"text": "\n19 May, 2020"
},
{
"code": null,
"e": 25872,
"s": 25703,
"text": "ParseFloat function is an in-build function in the strconv library which converts the string type into a floating-point number with the precision specified by bit size."
},
{
"code": null,
"e": 26491,
"s": 25872,
"text": "Example: In this example the same string -2.514 is being converted into float data type and then their sum is being printed. Once it is converted to 8 bit-size and other times it is 32 bit-size. Both yield different results because ParseFloat accepts decimal and hexadecimal floating-point number syntax. If a1 or a2 is well-formed and near a valid floating-point number, ParseFloat returns the nearest floating-point number rounded using IEEE754 unbiased rounding which is parsing a hexadecimal floating-point value only rounds when there are more bits in the hexadecimal representation than will fit in the mantissa."
},
{
"code": "// Golang program to Convert// string to float typepackage main import ( \"fmt\" \"strconv\") func main() { // defining a string a1 a1 := \"-2.514\" // converting the string a1 // into float and storing it // in b1 using ParseFloat b1, _ := strconv.ParseFloat(a1, 8) // printing the float b1 fmt.Println(b1) a2 := \"-2.514\" b2, _ := strconv.ParseFloat(a2, 32) fmt.Println(b2) fmt.Println(b1 + b2)}",
"e": 26937,
"s": 26491,
"text": null
},
{
"code": null,
"e": 26945,
"s": 26937,
"text": "Output:"
},
{
"code": null,
"e": 26992,
"s": 26945,
"text": "-2.514\n-2.5139999389648438\n-5.027999938964843\n"
},
{
"code": null,
"e": 27007,
"s": 26992,
"text": "Golang-Program"
},
{
"code": null,
"e": 27022,
"s": 27007,
"text": "Golang-strconv"
},
{
"code": null,
"e": 27029,
"s": 27022,
"text": "Picked"
},
{
"code": null,
"e": 27041,
"s": 27029,
"text": "Go Language"
},
{
"code": null,
"e": 27057,
"s": 27041,
"text": "Write From Home"
},
{
"code": null,
"e": 27155,
"s": 27057,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 27201,
"s": 27155,
"text": "6 Best Books to Learn Go Programming Language"
},
{
"code": null,
"e": 27230,
"s": 27201,
"text": "How to Parse JSON in Golang?"
},
{
"code": null,
"e": 27248,
"s": 27230,
"text": "Strings in Golang"
},
{
"code": null,
"e": 27273,
"s": 27248,
"text": "Time Durations in Golang"
},
{
"code": null,
"e": 27294,
"s": 27273,
"text": "Structures in Golang"
},
{
"code": null,
"e": 27330,
"s": 27294,
"text": "Convert integer to string in Python"
},
{
"code": null,
"e": 27366,
"s": 27330,
"text": "Convert string to integer in Python"
},
{
"code": null,
"e": 27427,
"s": 27366,
"text": "How to set input type date in dd-mm-yyyy format using HTML ?"
},
{
"code": null,
"e": 27443,
"s": 27427,
"text": "Python infinity"
}
] |
Tensorflow.js tf.LayersModel class .compile() Method - GeeksforGeeks | 10 May, 2021
Tensorflow.js is an open-source library developed by Google for running machine learning models and deep learning neural networks in the browser or node environment.
The .compile() function configures and makes the model for training and evaluation process. By calling .compile() function we prepare the model with an optimizer, loss, and metrics. The .compile() function takes an argument object as a parameter.
Note: If you call .fit() or .evaluate() function on an uncompiled model, then program will throw an error.
Syntax:
tf.model.compile({optimizer, loss}, metrics=[])
Parameters:
optimizer: It is a compulsory parameter. It accepts either an object of tf.train.Optimizer or a string name for an Optimizer. Following are string names for the optimizers — “sgd”, “adam”, “adamax”, “adadelta”, “adagrad”, “rmsprop”, “momentum”.
loss: It is a compulsory parameter. It accepts a string value or string array for the type of loss. If our model has multiple outputs, we can use a different loss on each output by passing an array of losses. The loss value that will be minimized by the model will then be the sum of all individual losses. Following are the string name for loss — “meanSquaredError”, “meanAbsoluteError”, etc.
metrics: It is an optional parameter. It accepts a list of metrics to be evaluated by the model during the training and testing phase. Usually, we use metrics=[‘accuracy’]. To specify different metrics for different outputs of a multi-output model, we can also pass a dictionary.
Return Value: Since it prepares the model for training, it does not return anything. (i.e. return type is void)
Example 1: In this example, we will create a simple model, and we will pass values for optimizer and loss parameters. Here we are using optimizer as “adam” and loss as “meanSquaredError”.
Javascript
// Importing the tensorflow.js libraryconst tf = require("@tensorflow/tfjs"); // define the modelconst model = tf.sequential({ layers: [tf.layers.dense({ units: 1, inputShape: [10] })],}); // compile the model// using "adam" optimizer and "meanSquaredError" lossmodel.compile({ optimizer: "adam", loss: "meanSquaredError" }); // evaluate the model which was compiled above// computation is done in batches of size 4const result = model.evaluate(tf.ones([8, 10]), tf.ones([8, 1]), { batchSize: 4,}); // print the resultresult.print();
Output:
Tensor
2.6806342601776123
Example 2: In this example, we will create a simple model, and we will pass values for optimizer, loss, and metrics parameters. Here we are using optimizer as “sgd” and loss as “meanAbsoluteError” and “accuracy” as metrics.
Javascript
// Importing the tensorflow.js libraryconst tf = require("@tensorflow/tfjs"); // define the modelconst model = tf.sequential({ layers: [tf.layers.dense({ units: 1, inputShape: [10] })],}); // compile the model// using "adam" optimizer, "meanSquaredError" loss and "accuracy" metricsmodel.compile( { optimizer: "adam", loss: "meanSquaredError" }, (metrics = ["accuracy"])); // evaluate the model which was compiled above// computation is done in batches of size 4const result = model.evaluate(tf.ones([8, 10]), tf.ones([8, 1]), { batchSize: 4,}); // print the resultresult.print();
Output:
Tensor
1.4847172498703003
Example 3: In this example, we will create a simple model and we will pass values for optimizer, loss and metrics parameters. Here we are using optimizer as “sgd” and loss as “meanAbsoluteError” and “precision” as metrics.
Javascript
// Importing the tensorflow.js libraryconst tf = require("@tensorflow/tfjs"); // define the modelconst model = tf.sequential({ layers: [tf.layers.dense({ units: 1, inputShape: [10] })],}); // compile the model// using "adam" optimizer, "meanSquaredError" loss and "accuracy" metricsmodel.compile( { optimizer: "sgd", loss: "meanAbsoluteError" }, (metrics = ["precision"])); // evaluate the model which was compiled above// computation is done in batches of size 4const result = model.evaluate(tf.ones([8, 10]), tf.ones([8, 1]), { batchSize: 4,}); // print the resultresult.print();
Output:
Tensor
1.507279634475708
Reference: https://js.tensorflow.org/api/latest/#tf.LayersModel.compile
Picked
Tensorflow.js
JavaScript
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Remove elements from a JavaScript Array
Difference between var, let and const keywords in JavaScript
Difference Between PUT and PATCH Request
JavaScript | Promises
How to get character array from string in JavaScript?
Remove elements from a JavaScript Array
Installation of Node.js on Linux
How to fetch data from an API in ReactJS ?
How to insert spaces/tabs in text using HTML/CSS?
Difference between var, let and const keywords in JavaScript | [
{
"code": null,
"e": 26545,
"s": 26517,
"text": "\n10 May, 2021"
},
{
"code": null,
"e": 26711,
"s": 26545,
"text": "Tensorflow.js is an open-source library developed by Google for running machine learning models and deep learning neural networks in the browser or node environment."
},
{
"code": null,
"e": 26958,
"s": 26711,
"text": "The .compile() function configures and makes the model for training and evaluation process. By calling .compile() function we prepare the model with an optimizer, loss, and metrics. The .compile() function takes an argument object as a parameter."
},
{
"code": null,
"e": 27065,
"s": 26958,
"text": "Note: If you call .fit() or .evaluate() function on an uncompiled model, then program will throw an error."
},
{
"code": null,
"e": 27073,
"s": 27065,
"text": "Syntax:"
},
{
"code": null,
"e": 27121,
"s": 27073,
"text": "tf.model.compile({optimizer, loss}, metrics=[])"
},
{
"code": null,
"e": 27133,
"s": 27121,
"text": "Parameters:"
},
{
"code": null,
"e": 27378,
"s": 27133,
"text": "optimizer: It is a compulsory parameter. It accepts either an object of tf.train.Optimizer or a string name for an Optimizer. Following are string names for the optimizers — “sgd”, “adam”, “adamax”, “adadelta”, “adagrad”, “rmsprop”, “momentum”."
},
{
"code": null,
"e": 27772,
"s": 27378,
"text": "loss: It is a compulsory parameter. It accepts a string value or string array for the type of loss. If our model has multiple outputs, we can use a different loss on each output by passing an array of losses. The loss value that will be minimized by the model will then be the sum of all individual losses. Following are the string name for loss — “meanSquaredError”, “meanAbsoluteError”, etc."
},
{
"code": null,
"e": 28052,
"s": 27772,
"text": "metrics: It is an optional parameter. It accepts a list of metrics to be evaluated by the model during the training and testing phase. Usually, we use metrics=[‘accuracy’]. To specify different metrics for different outputs of a multi-output model, we can also pass a dictionary."
},
{
"code": null,
"e": 28164,
"s": 28052,
"text": "Return Value: Since it prepares the model for training, it does not return anything. (i.e. return type is void)"
},
{
"code": null,
"e": 28352,
"s": 28164,
"text": "Example 1: In this example, we will create a simple model, and we will pass values for optimizer and loss parameters. Here we are using optimizer as “adam” and loss as “meanSquaredError”."
},
{
"code": null,
"e": 28363,
"s": 28352,
"text": "Javascript"
},
{
"code": "// Importing the tensorflow.js libraryconst tf = require(\"@tensorflow/tfjs\"); // define the modelconst model = tf.sequential({ layers: [tf.layers.dense({ units: 1, inputShape: [10] })],}); // compile the model// using \"adam\" optimizer and \"meanSquaredError\" lossmodel.compile({ optimizer: \"adam\", loss: \"meanSquaredError\" }); // evaluate the model which was compiled above// computation is done in batches of size 4const result = model.evaluate(tf.ones([8, 10]), tf.ones([8, 1]), { batchSize: 4,}); // print the resultresult.print();",
"e": 28907,
"s": 28363,
"text": null
},
{
"code": null,
"e": 28915,
"s": 28907,
"text": "Output:"
},
{
"code": null,
"e": 28946,
"s": 28915,
"text": "Tensor\n 2.6806342601776123 "
},
{
"code": null,
"e": 29170,
"s": 28946,
"text": "Example 2: In this example, we will create a simple model, and we will pass values for optimizer, loss, and metrics parameters. Here we are using optimizer as “sgd” and loss as “meanAbsoluteError” and “accuracy” as metrics."
},
{
"code": null,
"e": 29181,
"s": 29170,
"text": "Javascript"
},
{
"code": "// Importing the tensorflow.js libraryconst tf = require(\"@tensorflow/tfjs\"); // define the modelconst model = tf.sequential({ layers: [tf.layers.dense({ units: 1, inputShape: [10] })],}); // compile the model// using \"adam\" optimizer, \"meanSquaredError\" loss and \"accuracy\" metricsmodel.compile( { optimizer: \"adam\", loss: \"meanSquaredError\" }, (metrics = [\"accuracy\"])); // evaluate the model which was compiled above// computation is done in batches of size 4const result = model.evaluate(tf.ones([8, 10]), tf.ones([8, 1]), { batchSize: 4,}); // print the resultresult.print();",
"e": 29778,
"s": 29181,
"text": null
},
{
"code": null,
"e": 29786,
"s": 29778,
"text": "Output:"
},
{
"code": null,
"e": 29816,
"s": 29786,
"text": "Tensor\n 1.4847172498703003"
},
{
"code": null,
"e": 30039,
"s": 29816,
"text": "Example 3: In this example, we will create a simple model and we will pass values for optimizer, loss and metrics parameters. Here we are using optimizer as “sgd” and loss as “meanAbsoluteError” and “precision” as metrics."
},
{
"code": null,
"e": 30050,
"s": 30039,
"text": "Javascript"
},
{
"code": "// Importing the tensorflow.js libraryconst tf = require(\"@tensorflow/tfjs\"); // define the modelconst model = tf.sequential({ layers: [tf.layers.dense({ units: 1, inputShape: [10] })],}); // compile the model// using \"adam\" optimizer, \"meanSquaredError\" loss and \"accuracy\" metricsmodel.compile( { optimizer: \"sgd\", loss: \"meanAbsoluteError\" }, (metrics = [\"precision\"])); // evaluate the model which was compiled above// computation is done in batches of size 4const result = model.evaluate(tf.ones([8, 10]), tf.ones([8, 1]), { batchSize: 4,}); // print the resultresult.print();",
"e": 30648,
"s": 30050,
"text": null
},
{
"code": null,
"e": 30656,
"s": 30648,
"text": "Output:"
},
{
"code": null,
"e": 30684,
"s": 30656,
"text": "Tensor\n 1.507279634475708"
},
{
"code": null,
"e": 30756,
"s": 30684,
"text": "Reference: https://js.tensorflow.org/api/latest/#tf.LayersModel.compile"
},
{
"code": null,
"e": 30763,
"s": 30756,
"text": "Picked"
},
{
"code": null,
"e": 30777,
"s": 30763,
"text": "Tensorflow.js"
},
{
"code": null,
"e": 30788,
"s": 30777,
"text": "JavaScript"
},
{
"code": null,
"e": 30805,
"s": 30788,
"text": "Web Technologies"
},
{
"code": null,
"e": 30903,
"s": 30805,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 30943,
"s": 30903,
"text": "Remove elements from a JavaScript Array"
},
{
"code": null,
"e": 31004,
"s": 30943,
"text": "Difference between var, let and const keywords in JavaScript"
},
{
"code": null,
"e": 31045,
"s": 31004,
"text": "Difference Between PUT and PATCH Request"
},
{
"code": null,
"e": 31067,
"s": 31045,
"text": "JavaScript | Promises"
},
{
"code": null,
"e": 31121,
"s": 31067,
"text": "How to get character array from string in JavaScript?"
},
{
"code": null,
"e": 31161,
"s": 31121,
"text": "Remove elements from a JavaScript Array"
},
{
"code": null,
"e": 31194,
"s": 31161,
"text": "Installation of Node.js on Linux"
},
{
"code": null,
"e": 31237,
"s": 31194,
"text": "How to fetch data from an API in ReactJS ?"
},
{
"code": null,
"e": 31287,
"s": 31237,
"text": "How to insert spaces/tabs in text using HTML/CSS?"
}
] |
How to check if a string is html or not using JavaScript? - GeeksforGeeks | 31 Jul, 2019
The task is to validate whether the given string is valid HTML or not using JavaScript. we’re going to discuss few techniques.
Approach
Get the HTML string into a variable.
Create a RegExp which checks for the validation.
RegExp should follow the rules of creating a HTML document.
Example 1: In this example, a regexp is created and it is validating the HTML string as valid.
<!DOCTYPE HTML><html> <head> <title> JavaScript | Check if a string is html or not. </title></head> <body style="text-align:center;" id="body"> <h1 style="color:green;" id="h1"> GeeksForGeeks </h1> <p id="GFG_UP" style="font-size: 15px; font-weight: bold;"> </p> <button onclick="GFG_Fun()"> click here </button> <p id="GFG_DOWN" style="color:green; font-size: 20px; font-weight: bold;"> </p> <script> var up = document.getElementById('GFG_UP'); var str1 = '<div>GeeksForGeeks</div>'; var str = '<div>GeeksForGeeks</div>'; up.innerHTML = "Click on the button to check "+ "for the valid HTML.<br> String - " + str1; var down = document.getElementById('GFG_DOWN'); function GFG_Fun() { down.innerHTML = /<(?=.*? .*?\/ ?>|br|hr|input|!--|wbr)[a-z]+.*?>|<([a-z]+).*?<\/\1>/i.test(str); } </script></body> </html>
Output:
Before clicking on the button:
After clicking on the button:
Example 2: In this example, Here also, A regexp is created and it is validating the HTML string as invalid.
<!DOCTYPE HTML><html> <head> <title> JavaScript | Check if a string is html or not. </title></head> <body style="text-align:center;" id="body"> <h1 style="color:green;" id="h1"> GeeksForGeeks </h1> <p id="GFG_UP" style="font-size: 15px; font-weight: bold;"> </p> <button onclick="GFG_Fun()"> click here </button> <p id="GFG_DOWN" style="color:green; font-size: 20px; font-weight: bold;"> </p> <script> var up = document.getElementById('GFG_UP'); var str1 = '<div>GeeksForGeeks</dv>'; var str = '<div>GeeksForGeeks</dv>'; up.innerHTML = "Click on the button to check "+ "for the valid HTML.<br> String - " + str1; var down = document.getElementById('GFG_DOWN'); function GFG_Fun() { down.innerHTML = /<([A-Za-z][A-Za-z0-9]*)\b[^>]*>(.*?)<\/\1>/.test(str); } </script></body> </html>
Output:
Before clicking on the button:
After clicking on the button:
JavaScript-Misc
JavaScript
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Remove elements from a JavaScript Array
Convert a string to an integer in JavaScript
Difference between var, let and const keywords in JavaScript
Differences between Functional Components and Class Components in React
How to append HTML code to a div using JavaScript ?
Remove elements from a JavaScript Array
Installation of Node.js on Linux
Convert a string to an integer in JavaScript
How to fetch data from an API in ReactJS ?
Top 10 Projects For Beginners To Practice HTML and CSS Skills | [
{
"code": null,
"e": 26341,
"s": 26313,
"text": "\n31 Jul, 2019"
},
{
"code": null,
"e": 26468,
"s": 26341,
"text": "The task is to validate whether the given string is valid HTML or not using JavaScript. we’re going to discuss few techniques."
},
{
"code": null,
"e": 26477,
"s": 26468,
"text": "Approach"
},
{
"code": null,
"e": 26514,
"s": 26477,
"text": "Get the HTML string into a variable."
},
{
"code": null,
"e": 26563,
"s": 26514,
"text": "Create a RegExp which checks for the validation."
},
{
"code": null,
"e": 26623,
"s": 26563,
"text": "RegExp should follow the rules of creating a HTML document."
},
{
"code": null,
"e": 26718,
"s": 26623,
"text": "Example 1: In this example, a regexp is created and it is validating the HTML string as valid."
},
{
"code": "<!DOCTYPE HTML><html> <head> <title> JavaScript | Check if a string is html or not. </title></head> <body style=\"text-align:center;\" id=\"body\"> <h1 style=\"color:green;\" id=\"h1\"> GeeksForGeeks </h1> <p id=\"GFG_UP\" style=\"font-size: 15px; font-weight: bold;\"> </p> <button onclick=\"GFG_Fun()\"> click here </button> <p id=\"GFG_DOWN\" style=\"color:green; font-size: 20px; font-weight: bold;\"> </p> <script> var up = document.getElementById('GFG_UP'); var str1 = '<div>GeeksForGeeks</div>'; var str = '<div>GeeksForGeeks</div>'; up.innerHTML = \"Click on the button to check \"+ \"for the valid HTML.<br> String - \" + str1; var down = document.getElementById('GFG_DOWN'); function GFG_Fun() { down.innerHTML = /<(?=.*? .*?\\/ ?>|br|hr|input|!--|wbr)[a-z]+.*?>|<([a-z]+).*?<\\/\\1>/i.test(str); } </script></body> </html>",
"e": 27758,
"s": 26718,
"text": null
},
{
"code": null,
"e": 27766,
"s": 27758,
"text": "Output:"
},
{
"code": null,
"e": 27797,
"s": 27766,
"text": "Before clicking on the button:"
},
{
"code": null,
"e": 27827,
"s": 27797,
"text": "After clicking on the button:"
},
{
"code": null,
"e": 27935,
"s": 27827,
"text": "Example 2: In this example, Here also, A regexp is created and it is validating the HTML string as invalid."
},
{
"code": "<!DOCTYPE HTML><html> <head> <title> JavaScript | Check if a string is html or not. </title></head> <body style=\"text-align:center;\" id=\"body\"> <h1 style=\"color:green;\" id=\"h1\"> GeeksForGeeks </h1> <p id=\"GFG_UP\" style=\"font-size: 15px; font-weight: bold;\"> </p> <button onclick=\"GFG_Fun()\"> click here </button> <p id=\"GFG_DOWN\" style=\"color:green; font-size: 20px; font-weight: bold;\"> </p> <script> var up = document.getElementById('GFG_UP'); var str1 = '<div>GeeksForGeeks</dv>'; var str = '<div>GeeksForGeeks</dv>'; up.innerHTML = \"Click on the button to check \"+ \"for the valid HTML.<br> String - \" + str1; var down = document.getElementById('GFG_DOWN'); function GFG_Fun() { down.innerHTML = /<([A-Za-z][A-Za-z0-9]*)\\b[^>]*>(.*?)<\\/\\1>/.test(str); } </script></body> </html>",
"e": 28949,
"s": 27935,
"text": null
},
{
"code": null,
"e": 28957,
"s": 28949,
"text": "Output:"
},
{
"code": null,
"e": 28988,
"s": 28957,
"text": "Before clicking on the button:"
},
{
"code": null,
"e": 29018,
"s": 28988,
"text": "After clicking on the button:"
},
{
"code": null,
"e": 29034,
"s": 29018,
"text": "JavaScript-Misc"
},
{
"code": null,
"e": 29045,
"s": 29034,
"text": "JavaScript"
},
{
"code": null,
"e": 29062,
"s": 29045,
"text": "Web Technologies"
},
{
"code": null,
"e": 29160,
"s": 29062,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 29200,
"s": 29160,
"text": "Remove elements from a JavaScript Array"
},
{
"code": null,
"e": 29245,
"s": 29200,
"text": "Convert a string to an integer in JavaScript"
},
{
"code": null,
"e": 29306,
"s": 29245,
"text": "Difference between var, let and const keywords in JavaScript"
},
{
"code": null,
"e": 29378,
"s": 29306,
"text": "Differences between Functional Components and Class Components in React"
},
{
"code": null,
"e": 29430,
"s": 29378,
"text": "How to append HTML code to a div using JavaScript ?"
},
{
"code": null,
"e": 29470,
"s": 29430,
"text": "Remove elements from a JavaScript Array"
},
{
"code": null,
"e": 29503,
"s": 29470,
"text": "Installation of Node.js on Linux"
},
{
"code": null,
"e": 29548,
"s": 29503,
"text": "Convert a string to an integer in JavaScript"
},
{
"code": null,
"e": 29591,
"s": 29548,
"text": "How to fetch data from an API in ReactJS ?"
}
] |
Ways to copy a vector in C++ - GeeksforGeeks | 11 May, 2022
In the case of arrays, there is not much choice to copy an array into another, other than the iterative method i.e running a loop to copy each element at its respective index. But Vector classes have more than one method for copying entire vector into others in easier ways.
There are basically two types of copying :-
Method 1 : Iterative method.This method is a general method to copy, in this method a loop is used to push_back() the old vector elements into new vector.They are deeply copied
// C++ code to demonstrate copy of vector// by iterative method.#include<iostream>#include<vector>using namespace std; int main(){ // Initializing vector with values vector<int> vect1{1, 2, 3, 4}; // Declaring new vector vector<int> vect2; // A loop to copy elements of // old vector into new vector // by Iterative method for (int i=0; i<vect1.size(); i++) vect2.push_back(vect1[i]); cout << "Old vector elements are : "; for (int i=0; i<vect1.size(); i++) cout << vect1[i] << " "; cout << endl; cout << "New vector elements are : "; for (int i=0; i<vect2.size(); i++) cout << vect2[i] << " "; cout<< endl; // Changing value of vector to show that a new // copy is created. vect1[0] = 2; cout << "The first element of old vector is :"; cout << vect1[0] << endl; cout << "The first element of new vector is :"; cout << vect2[0] <<endl; return 0;}
Output:
Old vector elements are : 1 2 3 4
New vector elements are : 1 2 3 4
The first element of old vector is : 2
The first element of new vector is : 1
In the above code, on changing the value at one vector did not alter value at other vector, hence they are not allocated at same address, hence deep copy.Method 2 : By assignment “=” operator.Simply assigning the new vector to old one copies the vector. This way of assignment is not possible in case of arrays.
// C++ code to demonstrate copy of vector// by iterative method.#include<iostream>#include<vector>using namespace std; int main(){ // Initializing vector with values vector<int> vect1{1, 2, 3, 4}; // Declaring new vector vector<int> vect2; // Using assignment operator to copy one // vector to other vect2 = vect1; cout << "Old vector elements are : "; for (int i=0; i<vect1.size(); i++) cout << vect1[i] << " "; cout << endl; cout << "New vector elements are : "; for (int i=0; i<vect2.size(); i++) cout << vect2[i] << " "; cout<< endl; // Changing value of vector to show that a new // copy is created. vect1[0] = 2; cout << "The first element of old vector is :"; cout << vect1[0] << endl; cout << "The first element of new vector is :"; cout << vect2[0] <<endl; return 0;}
Output:
Old vector elements are : 1 2 3 4
New vector elements are : 1 2 3 4
The first element of old vector is : 2
The first element of new vector is : 1
Method 3 : By passing vector as constructor. At the time of declaration of vector, passing an old initialized vector, copies the elements of passed vector into the newly declared vector. They are deeply copied.
// C++ code to demonstrate copy of vector// by constructor method.#include<bits/stdc++.h>using namespace std; int main(){ // Initializing vector with values vector<int> vect1{1, 2, 3, 4}; // Declaring new vector and copying // element of old vector // constructor method, Deep copy vector<int> vect2(vect1); cout << "Old vector elements are : "; for (int i=0; i<vect1.size(); i++) cout << vect1[i] << " "; cout << endl; cout << "New vector elements are : "; for (int i=0; i<vect2.size(); i++) cout << vect2[i] << " "; cout<< endl; // Changing value of vector to show that a new // copy is created. vect1[0] = 2; cout << "The first element of old vector is :"; cout << vect1[0] << endl; cout << "The first element of new vector is :"; cout << vect2[0] <<endl; return 0;}
Output:
Old vector elements are : 1 2 3 4
New vector elements are : 1 2 3 4
The first element of old vector is :2
The first element of new vector is :1
Method 4 : By using inbuilt functions
copy(first_iterator_o, last_iterator_o, back_inserter()) :- This is another way to copy old vector into new one. This function takes 3 arguments, first, the first iterator of old vector, second, the last iterator of old vector and third is back_inserter function to insert values from back. This alsogenerated a deep copy.// C++ code to demonstrate copy of vector// by assign() and copy().#include<iostream>#include<vector> // for vector#include<algorithm> // for copy() and assign()#include<iterator> // for back_inserterusing namespace std;int main(){ // Initializing vector with values vector<int> vect1{1, 2, 3, 4}; // Declaring new vector vector<int> vect2; // Copying vector by copy function copy(vect1.begin(), vect1.end(), back_inserter(vect2)); cout << "Old vector elements are : "; for (int i=0; i<vect1.size(); i++) cout << vect1[i] << " "; cout << endl; cout << "New vector elements are : "; for (int i=0; i<vect2.size(); i++) cout << vect2[i] << " "; cout<< endl; // Changing value of vector to show that a new // copy is created. vect1[0] = 2; cout << "The first element of old vector is :"; cout << vect1[0] << endl; cout << "The first element of new vector is :"; cout << vect2[0] <<endl; return 0;}Output :Old vector elements are : 1 2 3 4
New vector elements are : 1 2 3 4
The first element of old vector is :2
The first element of new vector is :1
// C++ code to demonstrate copy of vector// by assign() and copy().#include<iostream>#include<vector> // for vector#include<algorithm> // for copy() and assign()#include<iterator> // for back_inserterusing namespace std;int main(){ // Initializing vector with values vector<int> vect1{1, 2, 3, 4}; // Declaring new vector vector<int> vect2; // Copying vector by copy function copy(vect1.begin(), vect1.end(), back_inserter(vect2)); cout << "Old vector elements are : "; for (int i=0; i<vect1.size(); i++) cout << vect1[i] << " "; cout << endl; cout << "New vector elements are : "; for (int i=0; i<vect2.size(); i++) cout << vect2[i] << " "; cout<< endl; // Changing value of vector to show that a new // copy is created. vect1[0] = 2; cout << "The first element of old vector is :"; cout << vect1[0] << endl; cout << "The first element of new vector is :"; cout << vect2[0] <<endl; return 0;}
Output :
Old vector elements are : 1 2 3 4
New vector elements are : 1 2 3 4
The first element of old vector is :2
The first element of new vector is :1
assign(first_iterator_o, last_iterator_o) :- This method assigns the same values to new vector as old one. This takes 2 arguments, first iterator to old vector and last iterator to old vector.This generates a deep copy.// C++ code to demonstrate copy of vector// by assign()#include<iostream>#include<vector> // for vector#include<algorithm> // for copy() and assign()#include<iterator> // for back_inserterusing namespace std; int main(){ // Initializing vector with values vector<int> vect1{1, 2, 3, 4}; // Declaring another vector vector<int> vect2; // Copying vector by assign function vect2.assign(vect1.begin(), vect1.end()); cout << "Old vector elements are : "; for (int i=0; i<vect1.size(); i++) cout << vect1[i] << " "; cout << endl; cout << "New vector elements are : "; for (int i=0; i<vect2.size(); i++) cout << vect2[i] << " "; cout<< endl; // Changing value of vector to show that a new // copy is created. vect1[0] = 2; cout << "The first element of old vector is :"; cout << vect1[0] << endl; cout << "The first element of new vector is :"; cout << vect2[0] <<endl; return 0;}Output:Old vector elements are : 1 2 3 4
New vector elements are : 1 2 3 4
The first element of old vector is :2
The first element of new vector is :1
// C++ code to demonstrate copy of vector// by assign()#include<iostream>#include<vector> // for vector#include<algorithm> // for copy() and assign()#include<iterator> // for back_inserterusing namespace std; int main(){ // Initializing vector with values vector<int> vect1{1, 2, 3, 4}; // Declaring another vector vector<int> vect2; // Copying vector by assign function vect2.assign(vect1.begin(), vect1.end()); cout << "Old vector elements are : "; for (int i=0; i<vect1.size(); i++) cout << vect1[i] << " "; cout << endl; cout << "New vector elements are : "; for (int i=0; i<vect2.size(); i++) cout << vect2[i] << " "; cout<< endl; // Changing value of vector to show that a new // copy is created. vect1[0] = 2; cout << "The first element of old vector is :"; cout << vect1[0] << endl; cout << "The first element of new vector is :"; cout << vect2[0] <<endl; return 0;}
Output:
Old vector elements are : 1 2 3 4
New vector elements are : 1 2 3 4
The first element of old vector is :2
The first element of new vector is :1
This article is contributed by Manjeet Singh .If you like GeeksforGeeks and would like to contribute, you can also write an article using write.geeksforgeeks.org or mail your article to [email protected]. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
cpp-algorithm-library
cpp-strings-library
cpp-vector
STL
C Language
C++
STL
CPP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Left Shift and Right Shift Operators in C/C++
Function Pointer in C
Substring in C++
rand() and srand() in C/C++
fork() in C
Inheritance in C++
Map in C++ Standard Template Library (STL)
C++ Classes and Objects
Virtual Function in C++
Templates in C++ with Examples | [
{
"code": null,
"e": 25719,
"s": 25691,
"text": "\n11 May, 2022"
},
{
"code": null,
"e": 25994,
"s": 25719,
"text": "In the case of arrays, there is not much choice to copy an array into another, other than the iterative method i.e running a loop to copy each element at its respective index. But Vector classes have more than one method for copying entire vector into others in easier ways."
},
{
"code": null,
"e": 26038,
"s": 25994,
"text": "There are basically two types of copying :-"
},
{
"code": null,
"e": 26215,
"s": 26038,
"text": "Method 1 : Iterative method.This method is a general method to copy, in this method a loop is used to push_back() the old vector elements into new vector.They are deeply copied"
},
{
"code": "// C++ code to demonstrate copy of vector// by iterative method.#include<iostream>#include<vector>using namespace std; int main(){ // Initializing vector with values vector<int> vect1{1, 2, 3, 4}; // Declaring new vector vector<int> vect2; // A loop to copy elements of // old vector into new vector // by Iterative method for (int i=0; i<vect1.size(); i++) vect2.push_back(vect1[i]); cout << \"Old vector elements are : \"; for (int i=0; i<vect1.size(); i++) cout << vect1[i] << \" \"; cout << endl; cout << \"New vector elements are : \"; for (int i=0; i<vect2.size(); i++) cout << vect2[i] << \" \"; cout<< endl; // Changing value of vector to show that a new // copy is created. vect1[0] = 2; cout << \"The first element of old vector is :\"; cout << vect1[0] << endl; cout << \"The first element of new vector is :\"; cout << vect2[0] <<endl; return 0;}",
"e": 27164,
"s": 26215,
"text": null
},
{
"code": null,
"e": 27172,
"s": 27164,
"text": "Output:"
},
{
"code": null,
"e": 27321,
"s": 27172,
"text": "Old vector elements are : 1 2 3 4 \nNew vector elements are : 1 2 3 4 \nThe first element of old vector is : 2\nThe first element of new vector is : 1\n"
},
{
"code": null,
"e": 27633,
"s": 27321,
"text": "In the above code, on changing the value at one vector did not alter value at other vector, hence they are not allocated at same address, hence deep copy.Method 2 : By assignment “=” operator.Simply assigning the new vector to old one copies the vector. This way of assignment is not possible in case of arrays."
},
{
"code": "// C++ code to demonstrate copy of vector// by iterative method.#include<iostream>#include<vector>using namespace std; int main(){ // Initializing vector with values vector<int> vect1{1, 2, 3, 4}; // Declaring new vector vector<int> vect2; // Using assignment operator to copy one // vector to other vect2 = vect1; cout << \"Old vector elements are : \"; for (int i=0; i<vect1.size(); i++) cout << vect1[i] << \" \"; cout << endl; cout << \"New vector elements are : \"; for (int i=0; i<vect2.size(); i++) cout << vect2[i] << \" \"; cout<< endl; // Changing value of vector to show that a new // copy is created. vect1[0] = 2; cout << \"The first element of old vector is :\"; cout << vect1[0] << endl; cout << \"The first element of new vector is :\"; cout << vect2[0] <<endl; return 0;}",
"e": 28502,
"s": 27633,
"text": null
},
{
"code": null,
"e": 28510,
"s": 28502,
"text": "Output:"
},
{
"code": null,
"e": 28659,
"s": 28510,
"text": "Old vector elements are : 1 2 3 4 \nNew vector elements are : 1 2 3 4 \nThe first element of old vector is : 2\nThe first element of new vector is : 1\n"
},
{
"code": null,
"e": 28870,
"s": 28659,
"text": "Method 3 : By passing vector as constructor. At the time of declaration of vector, passing an old initialized vector, copies the elements of passed vector into the newly declared vector. They are deeply copied."
},
{
"code": "// C++ code to demonstrate copy of vector// by constructor method.#include<bits/stdc++.h>using namespace std; int main(){ // Initializing vector with values vector<int> vect1{1, 2, 3, 4}; // Declaring new vector and copying // element of old vector // constructor method, Deep copy vector<int> vect2(vect1); cout << \"Old vector elements are : \"; for (int i=0; i<vect1.size(); i++) cout << vect1[i] << \" \"; cout << endl; cout << \"New vector elements are : \"; for (int i=0; i<vect2.size(); i++) cout << vect2[i] << \" \"; cout<< endl; // Changing value of vector to show that a new // copy is created. vect1[0] = 2; cout << \"The first element of old vector is :\"; cout << vect1[0] << endl; cout << \"The first element of new vector is :\"; cout << vect2[0] <<endl; return 0;}",
"e": 29727,
"s": 28870,
"text": null
},
{
"code": null,
"e": 29735,
"s": 29727,
"text": "Output:"
},
{
"code": null,
"e": 29881,
"s": 29735,
"text": "Old vector elements are : 1 2 3 4 \nNew vector elements are : 1 2 3 4 \nThe first element of old vector is :2\nThe first element of new vector is :1"
},
{
"code": null,
"e": 29919,
"s": 29881,
"text": "Method 4 : By using inbuilt functions"
},
{
"code": null,
"e": 31377,
"s": 29919,
"text": "copy(first_iterator_o, last_iterator_o, back_inserter()) :- This is another way to copy old vector into new one. This function takes 3 arguments, first, the first iterator of old vector, second, the last iterator of old vector and third is back_inserter function to insert values from back. This alsogenerated a deep copy.// C++ code to demonstrate copy of vector// by assign() and copy().#include<iostream>#include<vector> // for vector#include<algorithm> // for copy() and assign()#include<iterator> // for back_inserterusing namespace std;int main(){ // Initializing vector with values vector<int> vect1{1, 2, 3, 4}; // Declaring new vector vector<int> vect2; // Copying vector by copy function copy(vect1.begin(), vect1.end(), back_inserter(vect2)); cout << \"Old vector elements are : \"; for (int i=0; i<vect1.size(); i++) cout << vect1[i] << \" \"; cout << endl; cout << \"New vector elements are : \"; for (int i=0; i<vect2.size(); i++) cout << vect2[i] << \" \"; cout<< endl; // Changing value of vector to show that a new // copy is created. vect1[0] = 2; cout << \"The first element of old vector is :\"; cout << vect1[0] << endl; cout << \"The first element of new vector is :\"; cout << vect2[0] <<endl; return 0;}Output :Old vector elements are : 1 2 3 4 \nNew vector elements are : 1 2 3 4 \nThe first element of old vector is :2\nThe first element of new vector is :1\n"
},
{
"code": "// C++ code to demonstrate copy of vector// by assign() and copy().#include<iostream>#include<vector> // for vector#include<algorithm> // for copy() and assign()#include<iterator> // for back_inserterusing namespace std;int main(){ // Initializing vector with values vector<int> vect1{1, 2, 3, 4}; // Declaring new vector vector<int> vect2; // Copying vector by copy function copy(vect1.begin(), vect1.end(), back_inserter(vect2)); cout << \"Old vector elements are : \"; for (int i=0; i<vect1.size(); i++) cout << vect1[i] << \" \"; cout << endl; cout << \"New vector elements are : \"; for (int i=0; i<vect2.size(); i++) cout << vect2[i] << \" \"; cout<< endl; // Changing value of vector to show that a new // copy is created. vect1[0] = 2; cout << \"The first element of old vector is :\"; cout << vect1[0] << endl; cout << \"The first element of new vector is :\"; cout << vect2[0] <<endl; return 0;}",
"e": 32359,
"s": 31377,
"text": null
},
{
"code": null,
"e": 32368,
"s": 32359,
"text": "Output :"
},
{
"code": null,
"e": 32515,
"s": 32368,
"text": "Old vector elements are : 1 2 3 4 \nNew vector elements are : 1 2 3 4 \nThe first element of old vector is :2\nThe first element of new vector is :1\n"
},
{
"code": null,
"e": 33851,
"s": 32515,
"text": "assign(first_iterator_o, last_iterator_o) :- This method assigns the same values to new vector as old one. This takes 2 arguments, first iterator to old vector and last iterator to old vector.This generates a deep copy.// C++ code to demonstrate copy of vector// by assign()#include<iostream>#include<vector> // for vector#include<algorithm> // for copy() and assign()#include<iterator> // for back_inserterusing namespace std; int main(){ // Initializing vector with values vector<int> vect1{1, 2, 3, 4}; // Declaring another vector vector<int> vect2; // Copying vector by assign function vect2.assign(vect1.begin(), vect1.end()); cout << \"Old vector elements are : \"; for (int i=0; i<vect1.size(); i++) cout << vect1[i] << \" \"; cout << endl; cout << \"New vector elements are : \"; for (int i=0; i<vect2.size(); i++) cout << vect2[i] << \" \"; cout<< endl; // Changing value of vector to show that a new // copy is created. vect1[0] = 2; cout << \"The first element of old vector is :\"; cout << vect1[0] << endl; cout << \"The first element of new vector is :\"; cout << vect2[0] <<endl; return 0;}Output:Old vector elements are : 1 2 3 4 \nNew vector elements are : 1 2 3 4 \nThe first element of old vector is :2\nThe first element of new vector is :1\n"
},
{
"code": "// C++ code to demonstrate copy of vector// by assign()#include<iostream>#include<vector> // for vector#include<algorithm> // for copy() and assign()#include<iterator> // for back_inserterusing namespace std; int main(){ // Initializing vector with values vector<int> vect1{1, 2, 3, 4}; // Declaring another vector vector<int> vect2; // Copying vector by assign function vect2.assign(vect1.begin(), vect1.end()); cout << \"Old vector elements are : \"; for (int i=0; i<vect1.size(); i++) cout << vect1[i] << \" \"; cout << endl; cout << \"New vector elements are : \"; for (int i=0; i<vect2.size(); i++) cout << vect2[i] << \" \"; cout<< endl; // Changing value of vector to show that a new // copy is created. vect1[0] = 2; cout << \"The first element of old vector is :\"; cout << vect1[0] << endl; cout << \"The first element of new vector is :\"; cout << vect2[0] <<endl; return 0;}",
"e": 34815,
"s": 33851,
"text": null
},
{
"code": null,
"e": 34823,
"s": 34815,
"text": "Output:"
},
{
"code": null,
"e": 34970,
"s": 34823,
"text": "Old vector elements are : 1 2 3 4 \nNew vector elements are : 1 2 3 4 \nThe first element of old vector is :2\nThe first element of new vector is :1\n"
},
{
"code": null,
"e": 35267,
"s": 34970,
"text": "This article is contributed by Manjeet Singh .If you like GeeksforGeeks and would like to contribute, you can also write an article using write.geeksforgeeks.org or mail your article to [email protected]. See your article appearing on the GeeksforGeeks main page and help other Geeks."
},
{
"code": null,
"e": 35392,
"s": 35267,
"text": "Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above."
},
{
"code": null,
"e": 35414,
"s": 35392,
"text": "cpp-algorithm-library"
},
{
"code": null,
"e": 35434,
"s": 35414,
"text": "cpp-strings-library"
},
{
"code": null,
"e": 35445,
"s": 35434,
"text": "cpp-vector"
},
{
"code": null,
"e": 35449,
"s": 35445,
"text": "STL"
},
{
"code": null,
"e": 35460,
"s": 35449,
"text": "C Language"
},
{
"code": null,
"e": 35464,
"s": 35460,
"text": "C++"
},
{
"code": null,
"e": 35468,
"s": 35464,
"text": "STL"
},
{
"code": null,
"e": 35472,
"s": 35468,
"text": "CPP"
},
{
"code": null,
"e": 35570,
"s": 35472,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 35616,
"s": 35570,
"text": "Left Shift and Right Shift Operators in C/C++"
},
{
"code": null,
"e": 35638,
"s": 35616,
"text": "Function Pointer in C"
},
{
"code": null,
"e": 35655,
"s": 35638,
"text": "Substring in C++"
},
{
"code": null,
"e": 35683,
"s": 35655,
"text": "rand() and srand() in C/C++"
},
{
"code": null,
"e": 35695,
"s": 35683,
"text": "fork() in C"
},
{
"code": null,
"e": 35714,
"s": 35695,
"text": "Inheritance in C++"
},
{
"code": null,
"e": 35757,
"s": 35714,
"text": "Map in C++ Standard Template Library (STL)"
},
{
"code": null,
"e": 35781,
"s": 35757,
"text": "C++ Classes and Objects"
},
{
"code": null,
"e": 35805,
"s": 35781,
"text": "Virtual Function in C++"
}
] |
When to use Vanilla JavaScript vs jQuery ? - GeeksforGeeks | 09 Nov, 2021
Earlier, the websites used to be static. However, the introduction of vanilla JavaScript revolutionized the way websites used to look and function. Vanilla JS helped the developers in creating dynamic websites. Then came jQuery, a library of tools created by developers around the world, using Javascript.
In simple words, jQuery is a lightweight and easy to use JavaScript library that helps in creating complex functionalities with few lines of coding. jQuery helps in CSS manipulation, making AJAX requests, handling JSON data received from the server, and also helps in adding animation effects like hide, show etc to the components. The best part is that jQuery is browser flexible. This means the jQuery is compatible with every browser in the market, thus the developer need not have to worry about the browser that the user might be using.
jQuery simplifies a lot of things. It’s easier to implement some things using jQuery than vanilla JS. Have a look at this example. Here, we have to display a popup message on the screen, once the user clicks on the 'click here for popup!" button’.
jQuery Code:
<!DOCTYPE html><html> <head> <link rel="stylesheet" href="styles.css"> <script src="app.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"> </script></head> <body> <input id="button1" type="button" value="click here for popup!" /> <script> $('#button1').click(function() { alert("GeeksforGeeks"); }); </script></body> </html>
Output:
Before Clicking the Button:
After Clicking the Button:
JavaScript Code:
<!DOCTYPE html><html> <head> <link rel="stylesheet" href="styles.css"> <script src = "app.js"></script></head> <body> <input id="button1" type="button" value="click here for popup!"/> <script> document.getElementById("button1") .addEventListener('click', function(){ alert("GeeksforGeeks"); }); </script></body> </html>
Output:
Before Clicking the Button:
After Clicking the Button:
It can be easily seen that the jQuery coding is shorter and much simplified than the vanilla JS code. Let’s glance at another example for better understanding.
Suppose the programmer want to select all elements with class name = 'hello'.Javascript
document.getElementsByClassName("hello");
jQuery
$('.hello')
There is not a written rulebook that tells where to use jQuery and where to use JavaScript. It is said that jQuery is better for DOM manipulation than Javascript, however, after monitoring both of their performances, vanilla JS was found to be faster than jQuery. However, writing complex functionalities using Javascript may turn out to be difficult for novice programmers.
To put things in a nutshell, jQuery is a better option while working with CMS websites like WordPress, Weebly, etc. It makes development easier because of the huge library of plugins it already has. However, even though jQuery is made from Javascript, ignoring vanilla Javascript is not a wise decision. If you want to become a front end or a full stack web developer, then learning vanilla JS is a necessity. This is because Javascript has other frameworks and libraries like Angular, React, and Vue as well, which has a large number of advantages over jQuery. That’s why it is advised to first learn vanilla JS in-depth, as libraries and frameworks will come and go, but the base of all of them will always be vanilla JS. This is the reason why in an interview, a candidate knowing Javascript will hold an advantage over the other candidates knowing jQuery.
It must also be known that a person who’s learning vanilla JS will find it easier to switch to jQuery. However, switching to Javascript from jQuery may not seem smooth at first. As per a recent survey, it was observed that about 77 percent of the top 1 million websites on the internet use jQuery, learning the vanilla language first is always the best way to go forward.
davidbenalal
JavaScript-Misc
jQuery-Misc
Picked
JavaScript
JQuery
Technical Scripter
Web Technologies
Web technologies Questions
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Remove elements from a JavaScript Array
Difference between var, let and const keywords in JavaScript
Difference Between PUT and PATCH Request
JavaScript | Promises
How to get character array from string in JavaScript?
JQuery | Set the value of an input text field
Form validation using jQuery
How to change selected value of a drop-down list using jQuery?
How to fetch data from JSON file and display in HTML table using jQuery ?
How to Dynamically Add/Remove Table Rows using jQuery ? | [
{
"code": null,
"e": 26606,
"s": 26578,
"text": "\n09 Nov, 2021"
},
{
"code": null,
"e": 26912,
"s": 26606,
"text": "Earlier, the websites used to be static. However, the introduction of vanilla JavaScript revolutionized the way websites used to look and function. Vanilla JS helped the developers in creating dynamic websites. Then came jQuery, a library of tools created by developers around the world, using Javascript."
},
{
"code": null,
"e": 27454,
"s": 26912,
"text": "In simple words, jQuery is a lightweight and easy to use JavaScript library that helps in creating complex functionalities with few lines of coding. jQuery helps in CSS manipulation, making AJAX requests, handling JSON data received from the server, and also helps in adding animation effects like hide, show etc to the components. The best part is that jQuery is browser flexible. This means the jQuery is compatible with every browser in the market, thus the developer need not have to worry about the browser that the user might be using."
},
{
"code": null,
"e": 27702,
"s": 27454,
"text": "jQuery simplifies a lot of things. It’s easier to implement some things using jQuery than vanilla JS. Have a look at this example. Here, we have to display a popup message on the screen, once the user clicks on the 'click here for popup!\" button’."
},
{
"code": null,
"e": 27715,
"s": 27702,
"text": "jQuery Code:"
},
{
"code": "<!DOCTYPE html><html> <head> <link rel=\"stylesheet\" href=\"styles.css\"> <script src=\"app.js\"></script> <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js\"> </script></head> <body> <input id=\"button1\" type=\"button\" value=\"click here for popup!\" /> <script> $('#button1').click(function() { alert(\"GeeksforGeeks\"); }); </script></body> </html>",
"e": 28153,
"s": 27715,
"text": null
},
{
"code": null,
"e": 28161,
"s": 28153,
"text": "Output:"
},
{
"code": null,
"e": 28189,
"s": 28161,
"text": "Before Clicking the Button:"
},
{
"code": null,
"e": 28216,
"s": 28189,
"text": "After Clicking the Button:"
},
{
"code": null,
"e": 28233,
"s": 28216,
"text": "JavaScript Code:"
},
{
"code": "<!DOCTYPE html><html> <head> <link rel=\"stylesheet\" href=\"styles.css\"> <script src = \"app.js\"></script></head> <body> <input id=\"button1\" type=\"button\" value=\"click here for popup!\"/> <script> document.getElementById(\"button1\") .addEventListener('click', function(){ alert(\"GeeksforGeeks\"); }); </script></body> </html>",
"e": 28626,
"s": 28233,
"text": null
},
{
"code": null,
"e": 28634,
"s": 28626,
"text": "Output:"
},
{
"code": null,
"e": 28662,
"s": 28634,
"text": "Before Clicking the Button:"
},
{
"code": null,
"e": 28689,
"s": 28662,
"text": "After Clicking the Button:"
},
{
"code": null,
"e": 28849,
"s": 28689,
"text": "It can be easily seen that the jQuery coding is shorter and much simplified than the vanilla JS code. Let’s glance at another example for better understanding."
},
{
"code": null,
"e": 28937,
"s": 28849,
"text": "Suppose the programmer want to select all elements with class name = 'hello'.Javascript"
},
{
"code": null,
"e": 28981,
"s": 28937,
"text": "document.getElementsByClassName(\"hello\"); "
},
{
"code": null,
"e": 28988,
"s": 28981,
"text": "jQuery"
},
{
"code": null,
"e": 29000,
"s": 28988,
"text": "$('.hello')"
},
{
"code": null,
"e": 29375,
"s": 29000,
"text": "There is not a written rulebook that tells where to use jQuery and where to use JavaScript. It is said that jQuery is better for DOM manipulation than Javascript, however, after monitoring both of their performances, vanilla JS was found to be faster than jQuery. However, writing complex functionalities using Javascript may turn out to be difficult for novice programmers."
},
{
"code": null,
"e": 30235,
"s": 29375,
"text": "To put things in a nutshell, jQuery is a better option while working with CMS websites like WordPress, Weebly, etc. It makes development easier because of the huge library of plugins it already has. However, even though jQuery is made from Javascript, ignoring vanilla Javascript is not a wise decision. If you want to become a front end or a full stack web developer, then learning vanilla JS is a necessity. This is because Javascript has other frameworks and libraries like Angular, React, and Vue as well, which has a large number of advantages over jQuery. That’s why it is advised to first learn vanilla JS in-depth, as libraries and frameworks will come and go, but the base of all of them will always be vanilla JS. This is the reason why in an interview, a candidate knowing Javascript will hold an advantage over the other candidates knowing jQuery."
},
{
"code": null,
"e": 30607,
"s": 30235,
"text": "It must also be known that a person who’s learning vanilla JS will find it easier to switch to jQuery. However, switching to Javascript from jQuery may not seem smooth at first. As per a recent survey, it was observed that about 77 percent of the top 1 million websites on the internet use jQuery, learning the vanilla language first is always the best way to go forward."
},
{
"code": null,
"e": 30620,
"s": 30607,
"text": "davidbenalal"
},
{
"code": null,
"e": 30636,
"s": 30620,
"text": "JavaScript-Misc"
},
{
"code": null,
"e": 30648,
"s": 30636,
"text": "jQuery-Misc"
},
{
"code": null,
"e": 30655,
"s": 30648,
"text": "Picked"
},
{
"code": null,
"e": 30666,
"s": 30655,
"text": "JavaScript"
},
{
"code": null,
"e": 30673,
"s": 30666,
"text": "JQuery"
},
{
"code": null,
"e": 30692,
"s": 30673,
"text": "Technical Scripter"
},
{
"code": null,
"e": 30709,
"s": 30692,
"text": "Web Technologies"
},
{
"code": null,
"e": 30736,
"s": 30709,
"text": "Web technologies Questions"
},
{
"code": null,
"e": 30834,
"s": 30736,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 30874,
"s": 30834,
"text": "Remove elements from a JavaScript Array"
},
{
"code": null,
"e": 30935,
"s": 30874,
"text": "Difference between var, let and const keywords in JavaScript"
},
{
"code": null,
"e": 30976,
"s": 30935,
"text": "Difference Between PUT and PATCH Request"
},
{
"code": null,
"e": 30998,
"s": 30976,
"text": "JavaScript | Promises"
},
{
"code": null,
"e": 31052,
"s": 30998,
"text": "How to get character array from string in JavaScript?"
},
{
"code": null,
"e": 31098,
"s": 31052,
"text": "JQuery | Set the value of an input text field"
},
{
"code": null,
"e": 31127,
"s": 31098,
"text": "Form validation using jQuery"
},
{
"code": null,
"e": 31190,
"s": 31127,
"text": "How to change selected value of a drop-down list using jQuery?"
},
{
"code": null,
"e": 31264,
"s": 31190,
"text": "How to fetch data from JSON file and display in HTML table using jQuery ?"
}
] |
How to set font for Text in Tkinter? - GeeksforGeeks | 02 Dec, 2020
Prerequisite: Python GUI – tkinter
Python provides a Tkinter module for GUI (Graphical User Interface). In this article, we are going to see how to set text font in Tkinter.
Text Widget is used where a user wants to insert multi-line text fields. In this article, we are going to learn the approaches to set the font inserted in the text fields of the text widget. It can be done with different methods.
Method 1: Using a tuple and .configure( ) method.
Approach :
Import the tkinter module.
Create a GUI window.
Create our text widget.
Create a tuple containing the specifications of the font. But while creating this tuple, the order should be maintained like this, (font_family, font_size_in_pixel, font_weight). Font_family and font_weight should be passed as a string and the font size as an integer.
Parse the specifications to the Text widget using .configure( ) method.
Below is the implementation of the above approach
Python3
# Import the tkinter moduleimport tkinter # Creating the GUI window.root = tkinter.Tk()root.title("Welcome to GeekForGeeks") root.geometry("400x240") # Creating our text widget.sample_text = tkinter.Text( root, height = 10)sample_text.pack() # Creating a tuple containing # the specifications of the font.Font_tuple = ("Comic Sans MS", 20, "bold") # Parsed the specifications to the# Text widget using .configure( ) method.sample_text.configure(font = Font_tuple)root.mainloop()
Output :
Method 2: Setting the font using the Font object of tkinter.font
Approach:
Import the Tkinter module.
Import Tkinter font.
Create the GUI window
Create our text widget.
Create an object of type Font from tkinter.font module. It takes in the desired font specifications(font_family, font_size_in_pixel , font_weight) as a constructor of this object. This is that specified object that the text widget requires while determining its font.
Parse the Font object to the Text widget using .configure( ) method.
Below is the implementation of the above approach:
Python3
# Import moduleimport tkinterimport tkinter.font # Creating the GUI window.root = tkinter.Tk()root.title("Welcome to GeekForGeeks") root.geometry("918x450") # Creating our text widget.sample_text=tkinter.Text( root, height = 10)sample_text.pack() # Create an object of type Font from tkinter.Desired_font = tkinter.font.Font( family = "Comic Sans MS", size = 20, weight = "bold") # Parsed the Font object # to the Text widget using .configure( ) method.sample_text.configure(font = Desired_font)root.mainloop()
Output:
Python-tkinter
Technical Scripter 2020
Python
Technical Scripter
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
Python Classes and Objects
How to drop one or multiple columns in Pandas Dataframe
Defaultdict in Python
Python | Get unique values from a list
Python | os.path.join() method
Create a directory in Python
Python | Pandas dataframe.groupby() | [
{
"code": null,
"e": 25561,
"s": 25533,
"text": "\n02 Dec, 2020"
},
{
"code": null,
"e": 25597,
"s": 25561,
"text": "Prerequisite: Python GUI – tkinter"
},
{
"code": null,
"e": 25736,
"s": 25597,
"text": "Python provides a Tkinter module for GUI (Graphical User Interface). In this article, we are going to see how to set text font in Tkinter."
},
{
"code": null,
"e": 25966,
"s": 25736,
"text": "Text Widget is used where a user wants to insert multi-line text fields. In this article, we are going to learn the approaches to set the font inserted in the text fields of the text widget. It can be done with different methods."
},
{
"code": null,
"e": 26016,
"s": 25966,
"text": "Method 1: Using a tuple and .configure( ) method."
},
{
"code": null,
"e": 26027,
"s": 26016,
"text": "Approach :"
},
{
"code": null,
"e": 26054,
"s": 26027,
"text": "Import the tkinter module."
},
{
"code": null,
"e": 26075,
"s": 26054,
"text": "Create a GUI window."
},
{
"code": null,
"e": 26099,
"s": 26075,
"text": "Create our text widget."
},
{
"code": null,
"e": 26368,
"s": 26099,
"text": "Create a tuple containing the specifications of the font. But while creating this tuple, the order should be maintained like this, (font_family, font_size_in_pixel, font_weight). Font_family and font_weight should be passed as a string and the font size as an integer."
},
{
"code": null,
"e": 26440,
"s": 26368,
"text": "Parse the specifications to the Text widget using .configure( ) method."
},
{
"code": null,
"e": 26490,
"s": 26440,
"text": "Below is the implementation of the above approach"
},
{
"code": null,
"e": 26498,
"s": 26490,
"text": "Python3"
},
{
"code": "# Import the tkinter moduleimport tkinter # Creating the GUI window.root = tkinter.Tk()root.title(\"Welcome to GeekForGeeks\") root.geometry(\"400x240\") # Creating our text widget.sample_text = tkinter.Text( root, height = 10)sample_text.pack() # Creating a tuple containing # the specifications of the font.Font_tuple = (\"Comic Sans MS\", 20, \"bold\") # Parsed the specifications to the# Text widget using .configure( ) method.sample_text.configure(font = Font_tuple)root.mainloop()",
"e": 26981,
"s": 26498,
"text": null
},
{
"code": null,
"e": 26990,
"s": 26981,
"text": "Output :"
},
{
"code": null,
"e": 27055,
"s": 26990,
"text": "Method 2: Setting the font using the Font object of tkinter.font"
},
{
"code": null,
"e": 27066,
"s": 27055,
"text": "Approach: "
},
{
"code": null,
"e": 27093,
"s": 27066,
"text": "Import the Tkinter module."
},
{
"code": null,
"e": 27114,
"s": 27093,
"text": "Import Tkinter font."
},
{
"code": null,
"e": 27136,
"s": 27114,
"text": "Create the GUI window"
},
{
"code": null,
"e": 27160,
"s": 27136,
"text": "Create our text widget."
},
{
"code": null,
"e": 27428,
"s": 27160,
"text": "Create an object of type Font from tkinter.font module. It takes in the desired font specifications(font_family, font_size_in_pixel , font_weight) as a constructor of this object. This is that specified object that the text widget requires while determining its font."
},
{
"code": null,
"e": 27497,
"s": 27428,
"text": "Parse the Font object to the Text widget using .configure( ) method."
},
{
"code": null,
"e": 27548,
"s": 27497,
"text": "Below is the implementation of the above approach:"
},
{
"code": null,
"e": 27556,
"s": 27548,
"text": "Python3"
},
{
"code": "# Import moduleimport tkinterimport tkinter.font # Creating the GUI window.root = tkinter.Tk()root.title(\"Welcome to GeekForGeeks\") root.geometry(\"918x450\") # Creating our text widget.sample_text=tkinter.Text( root, height = 10)sample_text.pack() # Create an object of type Font from tkinter.Desired_font = tkinter.font.Font( family = \"Comic Sans MS\", size = 20, weight = \"bold\") # Parsed the Font object # to the Text widget using .configure( ) method.sample_text.configure(font = Desired_font)root.mainloop()",
"e": 28137,
"s": 27556,
"text": null
},
{
"code": null,
"e": 28145,
"s": 28137,
"text": "Output:"
},
{
"code": null,
"e": 28160,
"s": 28145,
"text": "Python-tkinter"
},
{
"code": null,
"e": 28184,
"s": 28160,
"text": "Technical Scripter 2020"
},
{
"code": null,
"e": 28191,
"s": 28184,
"text": "Python"
},
{
"code": null,
"e": 28210,
"s": 28191,
"text": "Technical Scripter"
},
{
"code": null,
"e": 28308,
"s": 28210,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 28340,
"s": 28308,
"text": "How to Install PIP on Windows ?"
},
{
"code": null,
"e": 28382,
"s": 28340,
"text": "Check if element exists in list in Python"
},
{
"code": null,
"e": 28424,
"s": 28382,
"text": "How To Convert Python Dictionary To JSON?"
},
{
"code": null,
"e": 28451,
"s": 28424,
"text": "Python Classes and Objects"
},
{
"code": null,
"e": 28507,
"s": 28451,
"text": "How to drop one or multiple columns in Pandas Dataframe"
},
{
"code": null,
"e": 28529,
"s": 28507,
"text": "Defaultdict in Python"
},
{
"code": null,
"e": 28568,
"s": 28529,
"text": "Python | Get unique values from a list"
},
{
"code": null,
"e": 28599,
"s": 28568,
"text": "Python | os.path.join() method"
},
{
"code": null,
"e": 28628,
"s": 28599,
"text": "Create a directory in Python"
}
] |
How to override functions of module in Node.js ? - GeeksforGeeks | 10 Oct, 2021
Overriding means not change the original definition of any object or module but changing its behavior in the current scenario (where it has been imported or inherited). In order to implement overriding, we are going to override the function of ‘url‘, the in-built module of nodeJS. Let us look at the steps involved in overriding a module:
First of all, require the module which we want to override.
const url = require('url')
Then delete the function of the module which we want to override. Here we would override the format() function of ‘url‘ module
delete url['format']
Now add the function with the same name ‘format‘ to provide a new definition to the format() function of the module
url.format = function(params...) {
// statement(s)
}
Now re-export the ‘url‘ module for changes to take effect
module.exports = url
Let us walk through step by step to implement the full working code:
Step 1: Create an “app.js” file and initialize your project with npm.
npm init
The project structure would look like this:
Project/File structure
Step 2: Now let us code the “app.js” file. In it, we follow all the steps mentioned above for overriding a module. After those steps, you would have successfully overridden the format() function of ‘url’ module. Find the full working code below in which the behaviour of format() function before overriding and after it has been shown.
app.js
// Requiring the in-built url module// to overrideconst url = require("url"); // The default behaviour of format()// function of urlconsole.log(url.format("http://localhost:3000/")); // Deleting the format function of urldelete url["format"]; // Adding new function to url with same// name so that it would overrideurl.format = function (str) { return "Sorry!! I don't know how to format the url";}; // Re-exporting the module for changes// to take effectmodule.exports = url; // The new behaviour of export() function// of url moduleconsole.log(url.format("http://localhost:3000/"));
Step 3: Run your node app using the following command.
node app.js
Output:
output in console
NodeJS-Questions
Picked
Node.js
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Difference between dependencies, devDependencies and peerDependencies
Node.js Export Module
How to connect Node.js with React.js ?
Mongoose find() Function
Mongoose Populate() Method
Remove elements from a JavaScript Array
Convert a string to an integer in JavaScript
How to fetch data from an API in ReactJS ?
How to insert spaces/tabs in text using HTML/CSS?
Difference between var, let and const keywords in JavaScript | [
{
"code": null,
"e": 26267,
"s": 26239,
"text": "\n10 Oct, 2021"
},
{
"code": null,
"e": 26607,
"s": 26267,
"text": "Overriding means not change the original definition of any object or module but changing its behavior in the current scenario (where it has been imported or inherited). In order to implement overriding, we are going to override the function of ‘url‘, the in-built module of nodeJS. Let us look at the steps involved in overriding a module:"
},
{
"code": null,
"e": 26667,
"s": 26607,
"text": "First of all, require the module which we want to override."
},
{
"code": null,
"e": 26694,
"s": 26667,
"text": "const url = require('url')"
},
{
"code": null,
"e": 26821,
"s": 26694,
"text": "Then delete the function of the module which we want to override. Here we would override the format() function of ‘url‘ module"
},
{
"code": null,
"e": 26842,
"s": 26821,
"text": "delete url['format']"
},
{
"code": null,
"e": 26958,
"s": 26842,
"text": "Now add the function with the same name ‘format‘ to provide a new definition to the format() function of the module"
},
{
"code": null,
"e": 27016,
"s": 26958,
"text": "url.format = function(params...) {\n // statement(s)\n}\n"
},
{
"code": null,
"e": 27074,
"s": 27016,
"text": "Now re-export the ‘url‘ module for changes to take effect"
},
{
"code": null,
"e": 27095,
"s": 27074,
"text": "module.exports = url"
},
{
"code": null,
"e": 27164,
"s": 27095,
"text": "Let us walk through step by step to implement the full working code:"
},
{
"code": null,
"e": 27234,
"s": 27164,
"text": "Step 1: Create an “app.js” file and initialize your project with npm."
},
{
"code": null,
"e": 27243,
"s": 27234,
"text": "npm init"
},
{
"code": null,
"e": 27287,
"s": 27243,
"text": "The project structure would look like this:"
},
{
"code": null,
"e": 27310,
"s": 27287,
"text": "Project/File structure"
},
{
"code": null,
"e": 27646,
"s": 27310,
"text": "Step 2: Now let us code the “app.js” file. In it, we follow all the steps mentioned above for overriding a module. After those steps, you would have successfully overridden the format() function of ‘url’ module. Find the full working code below in which the behaviour of format() function before overriding and after it has been shown."
},
{
"code": null,
"e": 27653,
"s": 27646,
"text": "app.js"
},
{
"code": "// Requiring the in-built url module// to overrideconst url = require(\"url\"); // The default behaviour of format()// function of urlconsole.log(url.format(\"http://localhost:3000/\")); // Deleting the format function of urldelete url[\"format\"]; // Adding new function to url with same// name so that it would overrideurl.format = function (str) { return \"Sorry!! I don't know how to format the url\";}; // Re-exporting the module for changes// to take effectmodule.exports = url; // The new behaviour of export() function// of url moduleconsole.log(url.format(\"http://localhost:3000/\"));",
"e": 28244,
"s": 27653,
"text": null
},
{
"code": null,
"e": 28300,
"s": 28244,
"text": "Step 3: Run your node app using the following command. "
},
{
"code": null,
"e": 28312,
"s": 28300,
"text": "node app.js"
},
{
"code": null,
"e": 28320,
"s": 28312,
"text": "Output:"
},
{
"code": null,
"e": 28338,
"s": 28320,
"text": "output in console"
},
{
"code": null,
"e": 28355,
"s": 28338,
"text": "NodeJS-Questions"
},
{
"code": null,
"e": 28362,
"s": 28355,
"text": "Picked"
},
{
"code": null,
"e": 28370,
"s": 28362,
"text": "Node.js"
},
{
"code": null,
"e": 28387,
"s": 28370,
"text": "Web Technologies"
},
{
"code": null,
"e": 28485,
"s": 28387,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 28555,
"s": 28485,
"text": "Difference between dependencies, devDependencies and peerDependencies"
},
{
"code": null,
"e": 28577,
"s": 28555,
"text": "Node.js Export Module"
},
{
"code": null,
"e": 28616,
"s": 28577,
"text": "How to connect Node.js with React.js ?"
},
{
"code": null,
"e": 28641,
"s": 28616,
"text": "Mongoose find() Function"
},
{
"code": null,
"e": 28668,
"s": 28641,
"text": "Mongoose Populate() Method"
},
{
"code": null,
"e": 28708,
"s": 28668,
"text": "Remove elements from a JavaScript Array"
},
{
"code": null,
"e": 28753,
"s": 28708,
"text": "Convert a string to an integer in JavaScript"
},
{
"code": null,
"e": 28796,
"s": 28753,
"text": "How to fetch data from an API in ReactJS ?"
},
{
"code": null,
"e": 28846,
"s": 28796,
"text": "How to insert spaces/tabs in text using HTML/CSS?"
}
] |
PyQt5 QSpinBox - Setting single step size - GeeksforGeeks | 06 May, 2020
In this article we will see how we can set the single step size of the spin box, by default when we create a spin box it step size is 1. Step size is basically the incremental or decrement size.
In order to do this we will use setSingleStep method.
Syntax : spin_box.setSingleStep(step)
Argument : It takes integer as argument
Return : None
Below is the implementation
# importing librariesfrom PyQt5.QtWidgets import * from PyQt5 import QtCore, QtGuifrom PyQt5.QtGui import * from PyQt5.QtCore import * import sys class Window(QMainWindow): def __init__(self): super().__init__() # setting title self.setWindowTitle("Python ") # setting geometry self.setGeometry(100, 100, 600, 400) # calling method self.UiComponents() # showing all the widgets self.show() # method for widgets def UiComponents(self): # creating spin box self.spin = QSpinBox(self) # setting geometry to spin box self.spin.setGeometry(100, 100, 150, 40) # setting single step size self.spin.setSingleStep(5) # create pyqt5 appApp = QApplication(sys.argv) # create the instance of our Windowwindow = Window() # start the appsys.exit(App.exec())
Output :
Python PyQt-SpinBox
Python-gui
Python-PyQt
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Read a file line by line in Python
How to Install PIP on Windows ?
Enumerate() in Python
Different ways to create Pandas Dataframe
Iterate over a list in Python
Python String | replace()
*args and **kwargs in Python
Reading and Writing to text files in Python
Create a Pandas DataFrame from Lists | [
{
"code": null,
"e": 25585,
"s": 25557,
"text": "\n06 May, 2020"
},
{
"code": null,
"e": 25780,
"s": 25585,
"text": "In this article we will see how we can set the single step size of the spin box, by default when we create a spin box it step size is 1. Step size is basically the incremental or decrement size."
},
{
"code": null,
"e": 25834,
"s": 25780,
"text": "In order to do this we will use setSingleStep method."
},
{
"code": null,
"e": 25872,
"s": 25834,
"text": "Syntax : spin_box.setSingleStep(step)"
},
{
"code": null,
"e": 25912,
"s": 25872,
"text": "Argument : It takes integer as argument"
},
{
"code": null,
"e": 25926,
"s": 25912,
"text": "Return : None"
},
{
"code": null,
"e": 25954,
"s": 25926,
"text": "Below is the implementation"
},
{
"code": "# importing librariesfrom PyQt5.QtWidgets import * from PyQt5 import QtCore, QtGuifrom PyQt5.QtGui import * from PyQt5.QtCore import * import sys class Window(QMainWindow): def __init__(self): super().__init__() # setting title self.setWindowTitle(\"Python \") # setting geometry self.setGeometry(100, 100, 600, 400) # calling method self.UiComponents() # showing all the widgets self.show() # method for widgets def UiComponents(self): # creating spin box self.spin = QSpinBox(self) # setting geometry to spin box self.spin.setGeometry(100, 100, 150, 40) # setting single step size self.spin.setSingleStep(5) # create pyqt5 appApp = QApplication(sys.argv) # create the instance of our Windowwindow = Window() # start the appsys.exit(App.exec())",
"e": 26846,
"s": 25954,
"text": null
},
{
"code": null,
"e": 26855,
"s": 26846,
"text": "Output :"
},
{
"code": null,
"e": 26875,
"s": 26855,
"text": "Python PyQt-SpinBox"
},
{
"code": null,
"e": 26886,
"s": 26875,
"text": "Python-gui"
},
{
"code": null,
"e": 26898,
"s": 26886,
"text": "Python-PyQt"
},
{
"code": null,
"e": 26905,
"s": 26898,
"text": "Python"
},
{
"code": null,
"e": 27003,
"s": 26905,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 27021,
"s": 27003,
"text": "Python Dictionary"
},
{
"code": null,
"e": 27056,
"s": 27021,
"text": "Read a file line by line in Python"
},
{
"code": null,
"e": 27088,
"s": 27056,
"text": "How to Install PIP on Windows ?"
},
{
"code": null,
"e": 27110,
"s": 27088,
"text": "Enumerate() in Python"
},
{
"code": null,
"e": 27152,
"s": 27110,
"text": "Different ways to create Pandas Dataframe"
},
{
"code": null,
"e": 27182,
"s": 27152,
"text": "Iterate over a list in Python"
},
{
"code": null,
"e": 27208,
"s": 27182,
"text": "Python String | replace()"
},
{
"code": null,
"e": 27237,
"s": 27208,
"text": "*args and **kwargs in Python"
},
{
"code": null,
"e": 27281,
"s": 27237,
"text": "Reading and Writing to text files in Python"
}
] |
Difference between Super Key and Candidate Key - GeeksforGeeks | 07 Jun, 2021
Prerequisite – Keys in Relational Model Super Key: Super Key is an attribute (or set of attributes) that is used to uniquely identifies all attributes in a relation. All super keys can’t be candidate keys but its reverse is true. In a relation, number of super keys are more than number of candidate keys.
Example: We have a given relation R(A, B, C, D, E, F) and we shall check for being super keys by following given dependencies:
Functional dependencies Super key
AB->CDEF YES
CD->ABEF YES
CB->DF NO
D->BC NO
By Using key AB we can identify rest of the attributes (CDEF) of the table. Similarly, Key CD. But, by using key CB we can only identifies D and F not A and E. Similarly key D.
Candidate Key: Candidate key is a set of attributes (or attribute) which uniquely identify the tuples in a relation or table. As we know that Primary key is a minimal super key, so there is one and only one primary key in any relation but there is more than one candidate key can take place. Candidate key’s attributes can contain NULL value which oppose to the primary key.
Example:
Student{ID, First_name, Last_name, Age, Sex, Phone_no}
Here we can see the two candidate keys ID and {First_name, Last_name, DOB, Phone_no}. So here, there are present more than one candidate keys, which can uniquely identifies a tuple in a relation.
Difference between Super Key and Candidate Key:
Kumarsuraj
jaffreyjoy
DBMS
Difference Between
GATE CS
DBMS
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Deadlock in DBMS
Types of Functional dependencies in DBMS
KDD Process in Data Mining
Conflict Serializability in DBMS
Introduction of Relational Algebra in DBMS
Difference between BFS and DFS
Class method vs Static method in Python
Differences between TCP and UDP
Difference between var, let and const keywords in JavaScript
Differences between IPv4 and IPv6 | [
{
"code": null,
"e": 25575,
"s": 25547,
"text": "\n07 Jun, 2021"
},
{
"code": null,
"e": 25882,
"s": 25575,
"text": "Prerequisite – Keys in Relational Model Super Key: Super Key is an attribute (or set of attributes) that is used to uniquely identifies all attributes in a relation. All super keys can’t be candidate keys but its reverse is true. In a relation, number of super keys are more than number of candidate keys. "
},
{
"code": null,
"e": 26011,
"s": 25882,
"text": "Example: We have a given relation R(A, B, C, D, E, F) and we shall check for being super keys by following given dependencies: "
},
{
"code": null,
"e": 26200,
"s": 26011,
"text": "Functional dependencies Super key\nAB->CDEF YES\nCD->ABEF YES\nCB->DF NO\nD->BC NO "
},
{
"code": null,
"e": 26378,
"s": 26200,
"text": "By Using key AB we can identify rest of the attributes (CDEF) of the table. Similarly, Key CD. But, by using key CB we can only identifies D and F not A and E. Similarly key D. "
},
{
"code": null,
"e": 26755,
"s": 26378,
"text": "Candidate Key: Candidate key is a set of attributes (or attribute) which uniquely identify the tuples in a relation or table. As we know that Primary key is a minimal super key, so there is one and only one primary key in any relation but there is more than one candidate key can take place. Candidate key’s attributes can contain NULL value which oppose to the primary key. "
},
{
"code": null,
"e": 26766,
"s": 26755,
"text": "Example: "
},
{
"code": null,
"e": 26822,
"s": 26766,
"text": "Student{ID, First_name, Last_name, Age, Sex, Phone_no} "
},
{
"code": null,
"e": 27019,
"s": 26822,
"text": "Here we can see the two candidate keys ID and {First_name, Last_name, DOB, Phone_no}. So here, there are present more than one candidate keys, which can uniquely identifies a tuple in a relation. "
},
{
"code": null,
"e": 27069,
"s": 27019,
"text": "Difference between Super Key and Candidate Key: "
},
{
"code": null,
"e": 27080,
"s": 27069,
"text": "Kumarsuraj"
},
{
"code": null,
"e": 27091,
"s": 27080,
"text": "jaffreyjoy"
},
{
"code": null,
"e": 27096,
"s": 27091,
"text": "DBMS"
},
{
"code": null,
"e": 27115,
"s": 27096,
"text": "Difference Between"
},
{
"code": null,
"e": 27123,
"s": 27115,
"text": "GATE CS"
},
{
"code": null,
"e": 27128,
"s": 27123,
"text": "DBMS"
},
{
"code": null,
"e": 27226,
"s": 27128,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 27243,
"s": 27226,
"text": "Deadlock in DBMS"
},
{
"code": null,
"e": 27284,
"s": 27243,
"text": "Types of Functional dependencies in DBMS"
},
{
"code": null,
"e": 27311,
"s": 27284,
"text": "KDD Process in Data Mining"
},
{
"code": null,
"e": 27344,
"s": 27311,
"text": "Conflict Serializability in DBMS"
},
{
"code": null,
"e": 27387,
"s": 27344,
"text": "Introduction of Relational Algebra in DBMS"
},
{
"code": null,
"e": 27418,
"s": 27387,
"text": "Difference between BFS and DFS"
},
{
"code": null,
"e": 27458,
"s": 27418,
"text": "Class method vs Static method in Python"
},
{
"code": null,
"e": 27490,
"s": 27458,
"text": "Differences between TCP and UDP"
},
{
"code": null,
"e": 27551,
"s": 27490,
"text": "Difference between var, let and const keywords in JavaScript"
}
] |
Count numbers with difference between number and its digit sum greater than specific value - GeeksforGeeks | 22 Apr, 2021
Given a positive value N, we need to find the count of numbers smaller than N such that the difference between the number and sum of its digits is greater than or equal to given specific value diff. Examples:
Input : N = 13, diff = 2
Output : 4
Then 10, 11, 12 and 13 satisfy the given
condition shown below,
10 – sumofdigit(10) = 9 >= 2
11 – sumofdigit(11) = 9 >= 2
12 – sumofdigit(12) = 9 >= 2
13 – sumofdigit(13) = 9 >= 2
Whereas no number from 1 to 9 satisfies
above equation so final result will be 4
We can solve this problem by observing a fact that for a number k less than N,
if k – sumofdigit(k) >= diff then
above equation will be true for (k+1)
also because we know that sumofdigit(k+1)
is not greater than sumofdigit(k) + 1
so, k + 1 - sumofdigit(k + 1) >=
k - sumofdigit(k)
but we know that right side of above
inequality is greater than diff,
so left side will also be greater than
diff.
So, finally we can say that if a number k satisfies the difference condition then (k + 1) will also satisfy same equation so our job is to find the smallest number which satisfies the difference condition then all numbers greater than this and up to N will satisfy the condition so our answer will be N – smallest number we found. We can find the smallest number satisfying this condition using binary search so total time complexity of solution will be O(log N)
C++
Java
Python3
C#
PHP
Javascript
/* C++ program to count total numbers whichhave difference with sum of digits greaterthan specific value */#include <bits/stdc++.h>using namespace std; // Utility method to get sum of digits of Kint sumOfDigit(int K){ // loop until K is not zero int sod = 0; while (K) { sod += K % 10; K /= 10; } return sod;} // method returns count of numbers smaller than N,// satisfying difference conditionint totalNumbersWithSpecificDifference(int N, int diff){ int low = 1, high = N; // binary search while loop while (low <= high) { int mid = (low + high) / 2; /* if difference between number and its sum of digit is smaller than given difference then smallest number will be on left side */ if (mid - sumOfDigit(mid) < diff) low = mid + 1; /* if difference between number and its sum of digit is greater than or equal to given difference then smallest number will be on right side */ else high = mid - 1; } // return the difference between 'smallest number // found' and 'N' as result return (N - high);} // Driver code to test above methodsint main(){ int N = 13; int diff = 2; cout << totalNumbersWithSpecificDifference(N, diff); return 0;}
/* Java program to count total numbers which have difference with sum of digits greater than specific value */ class Test{ // Utility method to get sum of digits of K static int sumOfDigit(int K) { // loop until K is not zero int sod = 0; while (K != 0) { sod += K % 10; K /= 10; } return sod; } // method returns count of numbers smaller than N, // satisfying difference condition static int totalNumbersWithSpecificDifference(int N, int diff) { int low = 1, high = N; // binary search while loop while (low <= high) { int mid = (low + high) / 2; /* if difference between number and its sum of digit is smaller than given difference then smallest number will be on left side */ if (mid - sumOfDigit(mid) < diff) low = mid + 1; /* if difference between number and its sum of digit is greater than or equal to given difference then smallest number will be on right side */ else high = mid - 1; } // return the difference between 'smallest number // found' and 'N' as result return (N - high); } // Driver method public static void main(String args[]) { int N = 13; int diff = 2; System.out.println(totalNumbersWithSpecificDifference(N, diff)); }}
# Python program to count total numbers which# have difference with sum of digits greater# than specific value # Utility method to get sum of digits of Kdef sumOfDigit(K): # loop until K is not zero sod = 0 while (K): sod =sod + K % 10 K =K // 10 return sod # method returns count of# numbers smaller than N,# satisfying difference conditiondef totalNumbersWithSpecificDifference(N,diff): low = 1 high = N # binary search while loop while (low <= high): mid = (low + high) // 2 ''' if difference between number and its sum of digit is smaller than given difference then smallest number will be on left side''' if (mid - sumOfDigit(mid) < diff): low = mid + 1 # if difference between number and its sum # of digit greater than equal to given # difference then smallest number will be on # right side else: high = mid - 1 # return the difference between 'smallest number # found' and 'N' as result return (N - high) # Driver code to test above methodsN = 13diff = 2 print(totalNumbersWithSpecificDifference(N, diff)) # This code is contributed by Anant Agarwal.
// C# program to count total numbers// which have difference with sum of // digits greater than specific valueusing System; class Test { // Utility method to get sum // of digits of K static int sumOfDigit(int K) { // loop until K is not zero int sod = 0; while (K != 0) { sod += K % 10; K /= 10; } return sod; } // method returns count of numbers // smaller than N, satisfying // difference condition static int totalNumbersWithSpecificDifference(int N, int diff) { int low = 1, high = N; // binary search while loop while (low <= high) { int mid = (low + high) / 2; // if difference between number and // its sum of digit is smaller than // given difference then smallest // number will be on left side if (mid - sumOfDigit(mid) < diff) low = mid + 1; // if difference between number and // its sum of digit is greater than // or equal to given difference then // smallest number will be on right side else high = mid - 1; } // return the difference between // 'smallest number found' // and 'N' as result return (N - high); } // Driver code public static void Main() { int N = 13; int diff = 2; Console.Write(totalNumbersWithSpecificDifference(N, diff)); }} // This code is contributed by nitin mittal
<?php// PHP program to count total numbers which// have difference with sum of digits greater// than specific value // method to get sum of digits of Kfunction sumOfDigit($K){ // loop until K is not zero $sod = 0; while ($K) { $sod += $K % 10; $K /= 10; } return $sod;} // method returns count of// numbers smaller than N,// satisfying difference conditionfunction totalNumbersWithSpecificDifference($N, $diff){ $low = 1; $high = $N; // binary search while loop while ($low <= $high) { $mid = floor(($low + $high) / 2); /* if difference between number and its sum of digit is smaller than given difference then smallest number will be on left side */ if ($mid - sumOfDigit($mid) < $diff) $low = $mid + 1; /* if difference between number and its sum of digit is greater than or equal to given difference then smallest number will be on right side */ else $high = $mid - 1; } // return the difference // between 'smallest number // found' and 'N' as result return ($N - $high);} // Driver Code$N = 13;$diff = 2;echo totalNumbersWithSpecificDifference($N, $diff); // This code is contributed by nitin mittal?>
<script> // javascript program to// count total numbers which// have difference with sum// of digits greater// than specific value // method to get sum of digits of Kfunction sumOfDigit(K){ // loop until K is not zero let sod = 0; while (K) { sod += K % 10; K /= 10; } return sod;} // method returns count of// numbers smaller than N,// satisfying difference conditionfunctiontotalNumbersWithSpecificDifference(N, diff){ let low = 1; let high = N; // binary search while loop while (low <= high) { let mid = Math.floor((low + high) / 2); /* if difference between number and its sum of digit is smaller than given difference then smallest number will be on left side */ if (mid - sumOfDigit(mid) < diff) low = mid + 1; /* if difference between number and its sum of digit is greater than or equal to given difference then smallest number will be on right side */ else high = mid - 1; } // return the difference // between 'smallest number // found' and 'N' as result return (N - high);} // Driver Codelet N = 13;let diff = 2;document.write(totalNumbersWithSpecificDifference(N, diff)); // This code is contributed by Bobby </script>
Output:
4
This article is contributed by Utkarsh Trivedi. If you like GeeksforGeeks and would like to contribute, you can also write an article using write.geeksforgeeks.org or mail your article to [email protected]. See your article appearing on the GeeksforGeeks main page and help other Geeks.Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
nitin mittal
gottumukkalabobby
Binary Search
number-digits
Mathematical
Searching
Searching
Mathematical
Binary Search
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Merge two sorted arrays
Modulo Operator (%) in C/C++ with Examples
Prime Numbers
Print all possible combinations of r elements in a given array of size n
Operators in C / C++
Binary Search
Maximum and minimum of an array using minimum number of comparisons
Linear Search
Search an element in a sorted and rotated array
Find the Missing Number | [
{
"code": null,
"e": 25937,
"s": 25909,
"text": "\n22 Apr, 2021"
},
{
"code": null,
"e": 26148,
"s": 25937,
"text": "Given a positive value N, we need to find the count of numbers smaller than N such that the difference between the number and sum of its digits is greater than or equal to given specific value diff. Examples: "
},
{
"code": null,
"e": 26448,
"s": 26148,
"text": "Input : N = 13, diff = 2\nOutput : 4\nThen 10, 11, 12 and 13 satisfy the given\ncondition shown below,\n10 – sumofdigit(10) = 9 >= 2\n11 – sumofdigit(11) = 9 >= 2\n12 – sumofdigit(12) = 9 >= 2\n13 – sumofdigit(13) = 9 >= 2 \nWhereas no number from 1 to 9 satisfies \nabove equation so final result will be 4"
},
{
"code": null,
"e": 26531,
"s": 26450,
"text": "We can solve this problem by observing a fact that for a number k less than N, "
},
{
"code": null,
"e": 26855,
"s": 26531,
"text": " \nif k – sumofdigit(k) >= diff then\nabove equation will be true for (k+1)\nalso because we know that sumofdigit(k+1)\nis not greater than sumofdigit(k) + 1\nso, k + 1 - sumofdigit(k + 1) >= \nk - sumofdigit(k)\nbut we know that right side of above \ninequality is greater than diff, \nso left side will also be greater than \ndiff."
},
{
"code": null,
"e": 27321,
"s": 26855,
"text": "So, finally we can say that if a number k satisfies the difference condition then (k + 1) will also satisfy same equation so our job is to find the smallest number which satisfies the difference condition then all numbers greater than this and up to N will satisfy the condition so our answer will be N – smallest number we found. We can find the smallest number satisfying this condition using binary search so total time complexity of solution will be O(log N) "
},
{
"code": null,
"e": 27325,
"s": 27321,
"text": "C++"
},
{
"code": null,
"e": 27330,
"s": 27325,
"text": "Java"
},
{
"code": null,
"e": 27338,
"s": 27330,
"text": "Python3"
},
{
"code": null,
"e": 27341,
"s": 27338,
"text": "C#"
},
{
"code": null,
"e": 27345,
"s": 27341,
"text": "PHP"
},
{
"code": null,
"e": 27356,
"s": 27345,
"text": "Javascript"
},
{
"code": "/* C++ program to count total numbers whichhave difference with sum of digits greaterthan specific value */#include <bits/stdc++.h>using namespace std; // Utility method to get sum of digits of Kint sumOfDigit(int K){ // loop until K is not zero int sod = 0; while (K) { sod += K % 10; K /= 10; } return sod;} // method returns count of numbers smaller than N,// satisfying difference conditionint totalNumbersWithSpecificDifference(int N, int diff){ int low = 1, high = N; // binary search while loop while (low <= high) { int mid = (low + high) / 2; /* if difference between number and its sum of digit is smaller than given difference then smallest number will be on left side */ if (mid - sumOfDigit(mid) < diff) low = mid + 1; /* if difference between number and its sum of digit is greater than or equal to given difference then smallest number will be on right side */ else high = mid - 1; } // return the difference between 'smallest number // found' and 'N' as result return (N - high);} // Driver code to test above methodsint main(){ int N = 13; int diff = 2; cout << totalNumbersWithSpecificDifference(N, diff); return 0;}",
"e": 28691,
"s": 27356,
"text": null
},
{
"code": "/* Java program to count total numbers which have difference with sum of digits greater than specific value */ class Test{ // Utility method to get sum of digits of K static int sumOfDigit(int K) { // loop until K is not zero int sod = 0; while (K != 0) { sod += K % 10; K /= 10; } return sod; } // method returns count of numbers smaller than N, // satisfying difference condition static int totalNumbersWithSpecificDifference(int N, int diff) { int low = 1, high = N; // binary search while loop while (low <= high) { int mid = (low + high) / 2; /* if difference between number and its sum of digit is smaller than given difference then smallest number will be on left side */ if (mid - sumOfDigit(mid) < diff) low = mid + 1; /* if difference between number and its sum of digit is greater than or equal to given difference then smallest number will be on right side */ else high = mid - 1; } // return the difference between 'smallest number // found' and 'N' as result return (N - high); } // Driver method public static void main(String args[]) { int N = 13; int diff = 2; System.out.println(totalNumbersWithSpecificDifference(N, diff)); }}",
"e": 30249,
"s": 28691,
"text": null
},
{
"code": "# Python program to count total numbers which# have difference with sum of digits greater# than specific value # Utility method to get sum of digits of Kdef sumOfDigit(K): # loop until K is not zero sod = 0 while (K): sod =sod + K % 10 K =K // 10 return sod # method returns count of# numbers smaller than N,# satisfying difference conditiondef totalNumbersWithSpecificDifference(N,diff): low = 1 high = N # binary search while loop while (low <= high): mid = (low + high) // 2 ''' if difference between number and its sum of digit is smaller than given difference then smallest number will be on left side''' if (mid - sumOfDigit(mid) < diff): low = mid + 1 # if difference between number and its sum # of digit greater than equal to given # difference then smallest number will be on # right side else: high = mid - 1 # return the difference between 'smallest number # found' and 'N' as result return (N - high) # Driver code to test above methodsN = 13diff = 2 print(totalNumbersWithSpecificDifference(N, diff)) # This code is contributed by Anant Agarwal.",
"e": 31516,
"s": 30249,
"text": null
},
{
"code": "// C# program to count total numbers// which have difference with sum of // digits greater than specific valueusing System; class Test { // Utility method to get sum // of digits of K static int sumOfDigit(int K) { // loop until K is not zero int sod = 0; while (K != 0) { sod += K % 10; K /= 10; } return sod; } // method returns count of numbers // smaller than N, satisfying // difference condition static int totalNumbersWithSpecificDifference(int N, int diff) { int low = 1, high = N; // binary search while loop while (low <= high) { int mid = (low + high) / 2; // if difference between number and // its sum of digit is smaller than // given difference then smallest // number will be on left side if (mid - sumOfDigit(mid) < diff) low = mid + 1; // if difference between number and // its sum of digit is greater than // or equal to given difference then // smallest number will be on right side else high = mid - 1; } // return the difference between // 'smallest number found' // and 'N' as result return (N - high); } // Driver code public static void Main() { int N = 13; int diff = 2; Console.Write(totalNumbersWithSpecificDifference(N, diff)); }} // This code is contributed by nitin mittal",
"e": 33181,
"s": 31516,
"text": null
},
{
"code": "<?php// PHP program to count total numbers which// have difference with sum of digits greater// than specific value // method to get sum of digits of Kfunction sumOfDigit($K){ // loop until K is not zero $sod = 0; while ($K) { $sod += $K % 10; $K /= 10; } return $sod;} // method returns count of// numbers smaller than N,// satisfying difference conditionfunction totalNumbersWithSpecificDifference($N, $diff){ $low = 1; $high = $N; // binary search while loop while ($low <= $high) { $mid = floor(($low + $high) / 2); /* if difference between number and its sum of digit is smaller than given difference then smallest number will be on left side */ if ($mid - sumOfDigit($mid) < $diff) $low = $mid + 1; /* if difference between number and its sum of digit is greater than or equal to given difference then smallest number will be on right side */ else $high = $mid - 1; } // return the difference // between 'smallest number // found' and 'N' as result return ($N - $high);} // Driver Code$N = 13;$diff = 2;echo totalNumbersWithSpecificDifference($N, $diff); // This code is contributed by nitin mittal?>",
"e": 34482,
"s": 33181,
"text": null
},
{
"code": "<script> // javascript program to// count total numbers which// have difference with sum// of digits greater// than specific value // method to get sum of digits of Kfunction sumOfDigit(K){ // loop until K is not zero let sod = 0; while (K) { sod += K % 10; K /= 10; } return sod;} // method returns count of// numbers smaller than N,// satisfying difference conditionfunctiontotalNumbersWithSpecificDifference(N, diff){ let low = 1; let high = N; // binary search while loop while (low <= high) { let mid = Math.floor((low + high) / 2); /* if difference between number and its sum of digit is smaller than given difference then smallest number will be on left side */ if (mid - sumOfDigit(mid) < diff) low = mid + 1; /* if difference between number and its sum of digit is greater than or equal to given difference then smallest number will be on right side */ else high = mid - 1; } // return the difference // between 'smallest number // found' and 'N' as result return (N - high);} // Driver Codelet N = 13;let diff = 2;document.write(totalNumbersWithSpecificDifference(N, diff)); // This code is contributed by Bobby </script>",
"e": 35794,
"s": 34482,
"text": null
},
{
"code": null,
"e": 35803,
"s": 35794,
"text": "Output: "
},
{
"code": null,
"e": 35805,
"s": 35803,
"text": "4"
},
{
"code": null,
"e": 36229,
"s": 35805,
"text": "This article is contributed by Utkarsh Trivedi. If you like GeeksforGeeks and would like to contribute, you can also write an article using write.geeksforgeeks.org or mail your article to [email protected]. See your article appearing on the GeeksforGeeks main page and help other Geeks.Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above. "
},
{
"code": null,
"e": 36242,
"s": 36229,
"text": "nitin mittal"
},
{
"code": null,
"e": 36260,
"s": 36242,
"text": "gottumukkalabobby"
},
{
"code": null,
"e": 36274,
"s": 36260,
"text": "Binary Search"
},
{
"code": null,
"e": 36288,
"s": 36274,
"text": "number-digits"
},
{
"code": null,
"e": 36301,
"s": 36288,
"text": "Mathematical"
},
{
"code": null,
"e": 36311,
"s": 36301,
"text": "Searching"
},
{
"code": null,
"e": 36321,
"s": 36311,
"text": "Searching"
},
{
"code": null,
"e": 36334,
"s": 36321,
"text": "Mathematical"
},
{
"code": null,
"e": 36348,
"s": 36334,
"text": "Binary Search"
},
{
"code": null,
"e": 36446,
"s": 36348,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 36470,
"s": 36446,
"text": "Merge two sorted arrays"
},
{
"code": null,
"e": 36513,
"s": 36470,
"text": "Modulo Operator (%) in C/C++ with Examples"
},
{
"code": null,
"e": 36527,
"s": 36513,
"text": "Prime Numbers"
},
{
"code": null,
"e": 36600,
"s": 36527,
"text": "Print all possible combinations of r elements in a given array of size n"
},
{
"code": null,
"e": 36621,
"s": 36600,
"text": "Operators in C / C++"
},
{
"code": null,
"e": 36635,
"s": 36621,
"text": "Binary Search"
},
{
"code": null,
"e": 36703,
"s": 36635,
"text": "Maximum and minimum of an array using minimum number of comparisons"
},
{
"code": null,
"e": 36717,
"s": 36703,
"text": "Linear Search"
},
{
"code": null,
"e": 36765,
"s": 36717,
"text": "Search an element in a sorted and rotated array"
}
] |
How to insert a pandas DataFrame to an existing PostgreSQL table? - GeeksforGeeks | 22 Nov, 2021
In this article, we are going to see how to insert a pandas DataFrame to an existing PostgreSQL table.
pandas: Pandas DataFrame is two-dimensional size-mutable, potentially heterogeneous tabular data structure with labeled axes (rows and columns). A Data frame is a two-dimensional data structure, i.e., data is aligned in a tabular fashion in rows and columns. Pandas DataFrame consists of three principal components, the data, rows, and columns.
psycopg2: PostgreSQL is a powerful, open source object-relational database system. PostgreSQL runs on all major operating systems. PostgreSQL follows ACID property of DataBase system and has the support of triggers, updatable views and materialized views, foreign keys.
sqlalchemy: SQLAlchemy is the Python SQL toolkit and Object Relational Mapper that gives application developers the full power and flexibility of SQL
we start the code by importing packages and creating a connection string of the format:
‘postgres://user:password@host/database’
The create_engine() function takes the connection string as an argument and forms a connection to the PostgreSQL database, after connecting we create a dictionary, and further convert it into a dataframe using the method pandas.DataFrame() method.
The to_sql() method is used to insert a pandas data frame into the Postgresql table. Finally, we execute commands using the execute() method to execute our SQL commands and fetchall() method to fetch the records.
df.to_sql(‘data’, con=conn, if_exists=’replace’, index=False)
arguments are:
name of the table
connection
if_exists : if the table already exists the function we want to apply . ex: ‘append’ help us add data instead of replacing the data.
index : True or False
Example 1:
Insert a pandas DataFrame to an existing PostgreSQL table using sqlalchemy. The create table command used to create a table in the PostgreSQL database in the following example is:
create table data( Name varchar, Age bigint);
Code:
Python3
import psycopg2import pandas as pdfrom sqlalchemy import create_engine conn_string = 'postgres://user:password@host/data1' db = create_engine(conn_string)conn = db.connect() # our dataframedata = {'Name': ['Tom', 'dick', 'harry'], 'Age': [22, 21, 24]} # Create DataFramedf = pd.DataFrame(data)df.to_sql('data', con=conn, if_exists='replace', index=False)conn = psycopg2.connect(conn_string )conn.autocommit = Truecursor = conn.cursor() sql1 = '''select * from data;'''cursor.execute(sql1)for i in cursor.fetchall(): print(i) # conn.commit()conn.close()
Output:
('Tom', 22)
('dick', 21)
('harry', 24)
Output in PostgreSQL:
output table in PostgreSQL
Example 2:
Insert a pandas DataFrame to an existing PostgreSQL table without using sqlalchemy. As usual, we form a connection to PostgreSQL using the connect() command and execute the execute_values() method, where there’s the ‘insert’ SQL command is executed. a try-except clause is included to make sure the errors are caught if any.
To view or download the CSV file used in the below program: click here.
The create table command used to create a table in the PostgreSQL database in the following example is :
create table fossil_fuels_c02(year int, country varchar,total int,solidfuel int, liquidfuel int,gasfuel int,cement int,gasflaring int,percapita int,bunkerfuels int);
Code:
Python3
import psycopg2import numpy as npimport psycopg2.extras as extrasimport pandas as pd def execute_values(conn, df, table): tuples = [tuple(x) for x in df.to_numpy()] cols = ','.join(list(df.columns)) # SQL query to execute query = "INSERT INTO %s(%s) VALUES %%s" % (table, cols) cursor = conn.cursor() try: extras.execute_values(cursor, query, tuples) conn.commit() except (Exception, psycopg2.DatabaseError) as error: print("Error: %s" % error) conn.rollback() cursor.close() return 1 print("the dataframe is inserted") cursor.close() conn = psycopg2.connect( database="ENVIRONMENT_DATABASE", user='postgres', password='pass', host='127.0.0.1', port='5432') df = pd.read_csv('fossilfuels.csv') execute_values(conn, df, 'fossil_fuels_c02')
Output:
the dataframe is inserted
after inserting the dataFrame
Picked
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
How To Convert Python Dictionary To JSON?
Check if element exists in list in Python
How to drop one or multiple columns in Pandas Dataframe
Python Classes and Objects
Python | os.path.join() method
Python | Get unique values from a list
Create a directory in Python
Defaultdict in Python
Python | Pandas dataframe.groupby() | [
{
"code": null,
"e": 25555,
"s": 25527,
"text": "\n22 Nov, 2021"
},
{
"code": null,
"e": 25658,
"s": 25555,
"text": "In this article, we are going to see how to insert a pandas DataFrame to an existing PostgreSQL table."
},
{
"code": null,
"e": 26003,
"s": 25658,
"text": "pandas: Pandas DataFrame is two-dimensional size-mutable, potentially heterogeneous tabular data structure with labeled axes (rows and columns). A Data frame is a two-dimensional data structure, i.e., data is aligned in a tabular fashion in rows and columns. Pandas DataFrame consists of three principal components, the data, rows, and columns."
},
{
"code": null,
"e": 26273,
"s": 26003,
"text": "psycopg2: PostgreSQL is a powerful, open source object-relational database system. PostgreSQL runs on all major operating systems. PostgreSQL follows ACID property of DataBase system and has the support of triggers, updatable views and materialized views, foreign keys."
},
{
"code": null,
"e": 26423,
"s": 26273,
"text": "sqlalchemy: SQLAlchemy is the Python SQL toolkit and Object Relational Mapper that gives application developers the full power and flexibility of SQL"
},
{
"code": null,
"e": 26511,
"s": 26423,
"text": "we start the code by importing packages and creating a connection string of the format:"
},
{
"code": null,
"e": 26552,
"s": 26511,
"text": "‘postgres://user:password@host/database’"
},
{
"code": null,
"e": 26800,
"s": 26552,
"text": "The create_engine() function takes the connection string as an argument and forms a connection to the PostgreSQL database, after connecting we create a dictionary, and further convert it into a dataframe using the method pandas.DataFrame() method."
},
{
"code": null,
"e": 27014,
"s": 26800,
"text": "The to_sql() method is used to insert a pandas data frame into the Postgresql table. Finally, we execute commands using the execute() method to execute our SQL commands and fetchall() method to fetch the records."
},
{
"code": null,
"e": 27076,
"s": 27014,
"text": "df.to_sql(‘data’, con=conn, if_exists=’replace’, index=False)"
},
{
"code": null,
"e": 27091,
"s": 27076,
"text": "arguments are:"
},
{
"code": null,
"e": 27109,
"s": 27091,
"text": "name of the table"
},
{
"code": null,
"e": 27120,
"s": 27109,
"text": "connection"
},
{
"code": null,
"e": 27253,
"s": 27120,
"text": "if_exists : if the table already exists the function we want to apply . ex: ‘append’ help us add data instead of replacing the data."
},
{
"code": null,
"e": 27275,
"s": 27253,
"text": "index : True or False"
},
{
"code": null,
"e": 27286,
"s": 27275,
"text": "Example 1:"
},
{
"code": null,
"e": 27467,
"s": 27286,
"text": "Insert a pandas DataFrame to an existing PostgreSQL table using sqlalchemy. The create table command used to create a table in the PostgreSQL database in the following example is:"
},
{
"code": null,
"e": 27513,
"s": 27467,
"text": "create table data( Name varchar, Age bigint);"
},
{
"code": null,
"e": 27519,
"s": 27513,
"text": "Code:"
},
{
"code": null,
"e": 27527,
"s": 27519,
"text": "Python3"
},
{
"code": "import psycopg2import pandas as pdfrom sqlalchemy import create_engine conn_string = 'postgres://user:password@host/data1' db = create_engine(conn_string)conn = db.connect() # our dataframedata = {'Name': ['Tom', 'dick', 'harry'], 'Age': [22, 21, 24]} # Create DataFramedf = pd.DataFrame(data)df.to_sql('data', con=conn, if_exists='replace', index=False)conn = psycopg2.connect(conn_string )conn.autocommit = Truecursor = conn.cursor() sql1 = '''select * from data;'''cursor.execute(sql1)for i in cursor.fetchall(): print(i) # conn.commit()conn.close()",
"e": 28132,
"s": 27527,
"text": null
},
{
"code": null,
"e": 28140,
"s": 28132,
"text": "Output:"
},
{
"code": null,
"e": 28179,
"s": 28140,
"text": "('Tom', 22)\n('dick', 21)\n('harry', 24)"
},
{
"code": null,
"e": 28201,
"s": 28179,
"text": "Output in PostgreSQL:"
},
{
"code": null,
"e": 28228,
"s": 28201,
"text": "output table in PostgreSQL"
},
{
"code": null,
"e": 28239,
"s": 28228,
"text": "Example 2:"
},
{
"code": null,
"e": 28564,
"s": 28239,
"text": "Insert a pandas DataFrame to an existing PostgreSQL table without using sqlalchemy. As usual, we form a connection to PostgreSQL using the connect() command and execute the execute_values() method, where there’s the ‘insert’ SQL command is executed. a try-except clause is included to make sure the errors are caught if any."
},
{
"code": null,
"e": 28637,
"s": 28564,
"text": "To view or download the CSV file used in the below program: click here. "
},
{
"code": null,
"e": 28742,
"s": 28637,
"text": "The create table command used to create a table in the PostgreSQL database in the following example is :"
},
{
"code": null,
"e": 28908,
"s": 28742,
"text": "create table fossil_fuels_c02(year int, country varchar,total int,solidfuel int, liquidfuel int,gasfuel int,cement int,gasflaring int,percapita int,bunkerfuels int);"
},
{
"code": null,
"e": 28914,
"s": 28908,
"text": "Code:"
},
{
"code": null,
"e": 28922,
"s": 28914,
"text": "Python3"
},
{
"code": "import psycopg2import numpy as npimport psycopg2.extras as extrasimport pandas as pd def execute_values(conn, df, table): tuples = [tuple(x) for x in df.to_numpy()] cols = ','.join(list(df.columns)) # SQL query to execute query = \"INSERT INTO %s(%s) VALUES %%s\" % (table, cols) cursor = conn.cursor() try: extras.execute_values(cursor, query, tuples) conn.commit() except (Exception, psycopg2.DatabaseError) as error: print(\"Error: %s\" % error) conn.rollback() cursor.close() return 1 print(\"the dataframe is inserted\") cursor.close() conn = psycopg2.connect( database=\"ENVIRONMENT_DATABASE\", user='postgres', password='pass', host='127.0.0.1', port='5432') df = pd.read_csv('fossilfuels.csv') execute_values(conn, df, 'fossil_fuels_c02')",
"e": 29745,
"s": 28922,
"text": null
},
{
"code": null,
"e": 29753,
"s": 29745,
"text": "Output:"
},
{
"code": null,
"e": 29779,
"s": 29753,
"text": "the dataframe is inserted"
},
{
"code": null,
"e": 29809,
"s": 29779,
"text": "after inserting the dataFrame"
},
{
"code": null,
"e": 29816,
"s": 29809,
"text": "Picked"
},
{
"code": null,
"e": 29823,
"s": 29816,
"text": "Python"
},
{
"code": null,
"e": 29921,
"s": 29823,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 29953,
"s": 29921,
"text": "How to Install PIP on Windows ?"
},
{
"code": null,
"e": 29995,
"s": 29953,
"text": "How To Convert Python Dictionary To JSON?"
},
{
"code": null,
"e": 30037,
"s": 29995,
"text": "Check if element exists in list in Python"
},
{
"code": null,
"e": 30093,
"s": 30037,
"text": "How to drop one or multiple columns in Pandas Dataframe"
},
{
"code": null,
"e": 30120,
"s": 30093,
"text": "Python Classes and Objects"
},
{
"code": null,
"e": 30151,
"s": 30120,
"text": "Python | os.path.join() method"
},
{
"code": null,
"e": 30190,
"s": 30151,
"text": "Python | Get unique values from a list"
},
{
"code": null,
"e": 30219,
"s": 30190,
"text": "Create a directory in Python"
},
{
"code": null,
"e": 30241,
"s": 30219,
"text": "Defaultdict in Python"
}
] |
Pointer vs Array in C - GeeksforGeeks | 21 Oct, 2021
Most of the time, pointer and array accesses can be treated as acting the same, the major exceptions being:
1) the sizeof operator o sizeof(array) returns the amount of memory used by all elements in array o sizeof(pointer) only returns the amount of memory used by the pointer variable itself
2) the & operator o array is an alias for &array[0] and returns the address of the first element in array o &pointer returns the address of pointer
3) a string literal initialization of a character array o char array[] = “abc” sets the first four elements in array to ‘a’, ‘b’, ‘c’, and ‘\0’ o char *pointer = “abc” sets pointer to the address of the “abc” string (which may be stored in read-only memory and thus unchangeable)
4) Pointer variable can be assigned a value whereas array variable cannot be.
Chapters
descriptions off, selected
captions settings, opens captions settings dialog
captions off, selected
English
This is a modal window.
Beginning of dialog window. Escape will cancel and close the window.
End of dialog window.
int a[10];
int *p;
p=a; /*legal*/
a=p; /*illegal*/
5) Arithmetic on pointer variable is allowed.
p++; /*Legal*/
a++; /*illegal*/
Please refer Difference between pointer and array in C? for more details.
References: http://icecube.wisc.edu/~dglo/c_class/array_ptr.html
shengzhao91
C-Pointers
cpp-array
cpp-pointer
C Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Multidimensional Arrays in C / C++
Left Shift and Right Shift Operators in C/C++
Substring in C++
Core Dump (Segmentation fault) in C/C++
rand() and srand() in C/C++
fork() in C
std::string class in C++
Converting Strings to Numbers in C/C++
Enumeration (or enum) in C
Command line arguments in C/C++ | [
{
"code": null,
"e": 25985,
"s": 25957,
"text": "\n21 Oct, 2021"
},
{
"code": null,
"e": 26094,
"s": 25985,
"text": "Most of the time, pointer and array accesses can be treated as acting the same, the major exceptions being: "
},
{
"code": null,
"e": 26281,
"s": 26094,
"text": "1) the sizeof operator o sizeof(array) returns the amount of memory used by all elements in array o sizeof(pointer) only returns the amount of memory used by the pointer variable itself "
},
{
"code": null,
"e": 26430,
"s": 26281,
"text": "2) the & operator o array is an alias for &array[0] and returns the address of the first element in array o &pointer returns the address of pointer "
},
{
"code": null,
"e": 26711,
"s": 26430,
"text": "3) a string literal initialization of a character array o char array[] = “abc” sets the first four elements in array to ‘a’, ‘b’, ‘c’, and ‘\\0’ o char *pointer = “abc” sets pointer to the address of the “abc” string (which may be stored in read-only memory and thus unchangeable) "
},
{
"code": null,
"e": 26789,
"s": 26711,
"text": "4) Pointer variable can be assigned a value whereas array variable cannot be."
},
{
"code": null,
"e": 26798,
"s": 26789,
"text": "Chapters"
},
{
"code": null,
"e": 26825,
"s": 26798,
"text": "descriptions off, selected"
},
{
"code": null,
"e": 26875,
"s": 26825,
"text": "captions settings, opens captions settings dialog"
},
{
"code": null,
"e": 26898,
"s": 26875,
"text": "captions off, selected"
},
{
"code": null,
"e": 26906,
"s": 26898,
"text": "English"
},
{
"code": null,
"e": 26930,
"s": 26906,
"text": "This is a modal window."
},
{
"code": null,
"e": 26999,
"s": 26930,
"text": "Beginning of dialog window. Escape will cancel and close the window."
},
{
"code": null,
"e": 27021,
"s": 26999,
"text": "End of dialog window."
},
{
"code": null,
"e": 27074,
"s": 27021,
"text": "int a[10];\nint *p; \np=a; /*legal*/\na=p; /*illegal*/ "
},
{
"code": null,
"e": 27121,
"s": 27074,
"text": "5) Arithmetic on pointer variable is allowed. "
},
{
"code": null,
"e": 27154,
"s": 27121,
"text": "p++; /*Legal*/\na++; /*illegal*/ "
},
{
"code": null,
"e": 27229,
"s": 27154,
"text": "Please refer Difference between pointer and array in C? for more details. "
},
{
"code": null,
"e": 27295,
"s": 27229,
"text": "References: http://icecube.wisc.edu/~dglo/c_class/array_ptr.html "
},
{
"code": null,
"e": 27307,
"s": 27295,
"text": "shengzhao91"
},
{
"code": null,
"e": 27318,
"s": 27307,
"text": "C-Pointers"
},
{
"code": null,
"e": 27328,
"s": 27318,
"text": "cpp-array"
},
{
"code": null,
"e": 27340,
"s": 27328,
"text": "cpp-pointer"
},
{
"code": null,
"e": 27351,
"s": 27340,
"text": "C Language"
},
{
"code": null,
"e": 27449,
"s": 27351,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 27484,
"s": 27449,
"text": "Multidimensional Arrays in C / C++"
},
{
"code": null,
"e": 27530,
"s": 27484,
"text": "Left Shift and Right Shift Operators in C/C++"
},
{
"code": null,
"e": 27547,
"s": 27530,
"text": "Substring in C++"
},
{
"code": null,
"e": 27587,
"s": 27547,
"text": "Core Dump (Segmentation fault) in C/C++"
},
{
"code": null,
"e": 27615,
"s": 27587,
"text": "rand() and srand() in C/C++"
},
{
"code": null,
"e": 27627,
"s": 27615,
"text": "fork() in C"
},
{
"code": null,
"e": 27652,
"s": 27627,
"text": "std::string class in C++"
},
{
"code": null,
"e": 27691,
"s": 27652,
"text": "Converting Strings to Numbers in C/C++"
},
{
"code": null,
"e": 27718,
"s": 27691,
"text": "Enumeration (or enum) in C"
}
] |
Find minimum moves to reach target on an infinite line - GeeksforGeeks | 08 Apr, 2021
Given a target position on infinite number line, i.e -infinity to +infinity. Starting form 0 you have to reach the target by moving as described : In ith move you can take i steps forward or backward. Find the minimum number of moves require to reach the target.Examples :
Input : target = 3
Output : 2
Explanation:
On the first move we step from 0 to 1.
On the second step we step from 1 to 3.
Input: target = 2
Output: 3
Explanation:
On the first move we step from 0 to 1.
On the second move we step from 1 to -1.
On the third move we step from -1 to 2.
We have discussed a naive recursive solution in below post. Minimum steps to reach a destinationIf target is negative, we can take it as positive because we start from 0 in symmetrical way. Idea is to move in one direction as long as possible, this will give minimum moves. Starting at 0 first move takes us to 1, second move takes us to 3 (1+2) position, third move takes us to 6 (1+2+3) position, ans so on; So for finding target we keep on adding moves until we find the nth move such that 1+2+3+...+n>=target. Now if sum (1+2+3+...+n) is equal to target the our job is done, i.e we’ll need n moves to reach target. Now next case where sum is greater than target. Find the difference by how much we are ahead, i.e sum – target. Let the difference be d = sum – target. If we take the i-th move backward then the new sum will become (sum – 2i), i.e 1+2+3+...-x+x+1...+n. Now if sum-2i = target then our job is done. Since, sum – target = 2i, i.e difference should be even as we will get an integer i flipping which will give the answer. So following cases arise. Case 1 : Difference is even then answer is n, (because we will always get a move flipping which will lead to target). Case 2 : Difference is odd, then we take one more step, i.e add n+1 to sum and now again take the difference. If difference is even the n+1 is the answer else we would have to take one more move and this will certainly make the difference even then answer will be n+2.Explanation : Since difference is odd. Target is either odd or even. case 1: n is even (1+2+3+...+n) then adding n+1 makes the difference even. case 2: n is odd then adding n+1 doesn’t makes difference even so we would have to take one more move, so n+2.Example: target = 5. we keep on taking moves until we reach target or we just cross it. sum = 1 + 2 + 3 = 6 > 5, step = 3. Difference = 6 – 5 = 1. Since the difference is an odd value, we will not reach the target by flipping any move from +i to -i. So we increase our step. We need to increase step by 2 to get an even difference (since n is odd and target is also odd). Now that we have an even difference, we can simply switch any move to the left (i.e. change + to -) as long as the summation of the changed value equals to half of the difference. We can switch 1 and 4 or 2 and 3 or 5.
C++
Java
Python 3
C#
PHP
Javascript
// CPP program to find minimum moves to// reach target if we can move i steps in// i-th move.#include <iostream>using namespace std; int reachTarget(int target){ // Handling negatives by symmetry target = abs(target); // Keep moving while sum is smaller or difference // is odd. int sum = 0, step = 0; while (sum < target || (sum - target) % 2 != 0) { step++; sum += step; } return step;} // Driver codeint main(){ int target = 5; cout << reachTarget(target); return 0;}
// Java program to find minimum //moves to reach target if we can// move i steps in i-th move.import java.io.*;import java.math.*; class GFG { static int reachTarget(int target) { // Handling negatives by symmetry target = Math.abs(target); // Keep moving while sum is smaller // or difference is odd. int sum = 0, step = 0; while (sum < target || (sum - target) % 2 != 0) { step++; sum += step; } return step; } // Driver code public static void main(String args[]) { int target = 5; System.out.println(reachTarget(target)); }} // This code is contributed by Nikita tiwari.
# Python 3 program to find minimum # moves to reach target if we can# move i steps in i-th move. def reachTarget(target) : # Handling negatives by symmetry target = abs(target) # Keep moving while sum is # smaller or difference is odd. sum = 0 step = 0 while (sum < target or (sum - target) % 2 != 0) : step = step + 1 sum = sum + step return step # Driver codetarget = 5print(reachTarget(target)) # This code is contributed by Nikita Tiwari
// C# program to find minimum//moves to reach target if we can// move i steps in i-th move.using System; class GFG { static int reachTarget(int target) { // Handling negatives by symmetry target = Math.Abs(target); // Keep moving while sum is smaller // or difference is odd. int sum = 0, step = 0; while (sum < target || (sum - target) % 2!= 0) { step++; sum += step; } return step; } // Driver code public static void Main() { int target = 5; Console.WriteLine(reachTarget(target)); }} // This code is contributed by vt_m.
<?php// PHP program to find // minimum moves to reach// target if we can move i// steps in i-th move. function reachTarget($target){ // Handling negatives // by symmetry $target = abs($target); // Keep moving while sum is // smaller or difference is odd. $sum = 0; $step = 0; while ($sum < $target or ($sum - $target) % 2 != 0) { $step++; $sum += $step; } return $step;} // Driver code$target = 5;echo reachTarget($target); // This code is contributed by anuj_67.?>
<script> // JavaScript program to find minimum //moves to reach target if we can// move i steps in i-th move. function reachTarget(target) { // Handling negatives by symmetry target = Math.abs(target); // Keep moving while sum is smaller // or difference is odd. let sum = 0, step = 0; while (sum < target || (sum - target) % 2 != 0) { step++; sum += step; } return step; } // Driver code let target = 5; document.write(reachTarget(target)); </script>
Output :
5
vt_m
susmitakundugoaldanga
Flipkart
Mathematical
Flipkart
Mathematical
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Merge two sorted arrays
Modulo Operator (%) in C/C++ with Examples
Prime Numbers
Program to find GCD or HCF of two numbers
Print all possible combinations of r elements in a given array of size n
Operators in C / C++
The Knight's tour problem | Backtracking-1
Program for factorial of a number
Program for Decimal to Binary Conversion
Find minimum number of coins that make a given value | [
{
"code": null,
"e": 26225,
"s": 26197,
"text": "\n08 Apr, 2021"
},
{
"code": null,
"e": 26500,
"s": 26225,
"text": "Given a target position on infinite number line, i.e -infinity to +infinity. Starting form 0 you have to reach the target by moving as described : In ith move you can take i steps forward or backward. Find the minimum number of moves require to reach the target.Examples : "
},
{
"code": null,
"e": 26785,
"s": 26500,
"text": "Input : target = 3\nOutput : 2\nExplanation:\nOn the first move we step from 0 to 1.\nOn the second step we step from 1 to 3.\n\nInput: target = 2\nOutput: 3\nExplanation:\nOn the first move we step from 0 to 1.\nOn the second move we step from 1 to -1.\nOn the third move we step from -1 to 2."
},
{
"code": null,
"e": 29084,
"s": 26787,
"text": "We have discussed a naive recursive solution in below post. Minimum steps to reach a destinationIf target is negative, we can take it as positive because we start from 0 in symmetrical way. Idea is to move in one direction as long as possible, this will give minimum moves. Starting at 0 first move takes us to 1, second move takes us to 3 (1+2) position, third move takes us to 6 (1+2+3) position, ans so on; So for finding target we keep on adding moves until we find the nth move such that 1+2+3+...+n>=target. Now if sum (1+2+3+...+n) is equal to target the our job is done, i.e we’ll need n moves to reach target. Now next case where sum is greater than target. Find the difference by how much we are ahead, i.e sum – target. Let the difference be d = sum – target. If we take the i-th move backward then the new sum will become (sum – 2i), i.e 1+2+3+...-x+x+1...+n. Now if sum-2i = target then our job is done. Since, sum – target = 2i, i.e difference should be even as we will get an integer i flipping which will give the answer. So following cases arise. Case 1 : Difference is even then answer is n, (because we will always get a move flipping which will lead to target). Case 2 : Difference is odd, then we take one more step, i.e add n+1 to sum and now again take the difference. If difference is even the n+1 is the answer else we would have to take one more move and this will certainly make the difference even then answer will be n+2.Explanation : Since difference is odd. Target is either odd or even. case 1: n is even (1+2+3+...+n) then adding n+1 makes the difference even. case 2: n is odd then adding n+1 doesn’t makes difference even so we would have to take one more move, so n+2.Example: target = 5. we keep on taking moves until we reach target or we just cross it. sum = 1 + 2 + 3 = 6 > 5, step = 3. Difference = 6 – 5 = 1. Since the difference is an odd value, we will not reach the target by flipping any move from +i to -i. So we increase our step. We need to increase step by 2 to get an even difference (since n is odd and target is also odd). Now that we have an even difference, we can simply switch any move to the left (i.e. change + to -) as long as the summation of the changed value equals to half of the difference. We can switch 1 and 4 or 2 and 3 or 5. "
},
{
"code": null,
"e": 29088,
"s": 29084,
"text": "C++"
},
{
"code": null,
"e": 29093,
"s": 29088,
"text": "Java"
},
{
"code": null,
"e": 29102,
"s": 29093,
"text": "Python 3"
},
{
"code": null,
"e": 29105,
"s": 29102,
"text": "C#"
},
{
"code": null,
"e": 29109,
"s": 29105,
"text": "PHP"
},
{
"code": null,
"e": 29120,
"s": 29109,
"text": "Javascript"
},
{
"code": "// CPP program to find minimum moves to// reach target if we can move i steps in// i-th move.#include <iostream>using namespace std; int reachTarget(int target){ // Handling negatives by symmetry target = abs(target); // Keep moving while sum is smaller or difference // is odd. int sum = 0, step = 0; while (sum < target || (sum - target) % 2 != 0) { step++; sum += step; } return step;} // Driver codeint main(){ int target = 5; cout << reachTarget(target); return 0;}",
"e": 29643,
"s": 29120,
"text": null
},
{
"code": "// Java program to find minimum //moves to reach target if we can// move i steps in i-th move.import java.io.*;import java.math.*; class GFG { static int reachTarget(int target) { // Handling negatives by symmetry target = Math.abs(target); // Keep moving while sum is smaller // or difference is odd. int sum = 0, step = 0; while (sum < target || (sum - target) % 2 != 0) { step++; sum += step; } return step; } // Driver code public static void main(String args[]) { int target = 5; System.out.println(reachTarget(target)); }} // This code is contributed by Nikita tiwari.",
"e": 30396,
"s": 29643,
"text": null
},
{
"code": "# Python 3 program to find minimum # moves to reach target if we can# move i steps in i-th move. def reachTarget(target) : # Handling negatives by symmetry target = abs(target) # Keep moving while sum is # smaller or difference is odd. sum = 0 step = 0 while (sum < target or (sum - target) % 2 != 0) : step = step + 1 sum = sum + step return step # Driver codetarget = 5print(reachTarget(target)) # This code is contributed by Nikita Tiwari",
"e": 30927,
"s": 30396,
"text": null
},
{
"code": "// C# program to find minimum//moves to reach target if we can// move i steps in i-th move.using System; class GFG { static int reachTarget(int target) { // Handling negatives by symmetry target = Math.Abs(target); // Keep moving while sum is smaller // or difference is odd. int sum = 0, step = 0; while (sum < target || (sum - target) % 2!= 0) { step++; sum += step; } return step; } // Driver code public static void Main() { int target = 5; Console.WriteLine(reachTarget(target)); }} // This code is contributed by vt_m.",
"e": 31605,
"s": 30927,
"text": null
},
{
"code": "<?php// PHP program to find // minimum moves to reach// target if we can move i// steps in i-th move. function reachTarget($target){ // Handling negatives // by symmetry $target = abs($target); // Keep moving while sum is // smaller or difference is odd. $sum = 0; $step = 0; while ($sum < $target or ($sum - $target) % 2 != 0) { $step++; $sum += $step; } return $step;} // Driver code$target = 5;echo reachTarget($target); // This code is contributed by anuj_67.?>",
"e": 32149,
"s": 31605,
"text": null
},
{
"code": "<script> // JavaScript program to find minimum //moves to reach target if we can// move i steps in i-th move. function reachTarget(target) { // Handling negatives by symmetry target = Math.abs(target); // Keep moving while sum is smaller // or difference is odd. let sum = 0, step = 0; while (sum < target || (sum - target) % 2 != 0) { step++; sum += step; } return step; } // Driver code let target = 5; document.write(reachTarget(target)); </script>",
"e": 32755,
"s": 32149,
"text": null
},
{
"code": null,
"e": 32765,
"s": 32755,
"text": "Output : "
},
{
"code": null,
"e": 32767,
"s": 32765,
"text": "5"
},
{
"code": null,
"e": 32774,
"s": 32769,
"text": "vt_m"
},
{
"code": null,
"e": 32796,
"s": 32774,
"text": "susmitakundugoaldanga"
},
{
"code": null,
"e": 32805,
"s": 32796,
"text": "Flipkart"
},
{
"code": null,
"e": 32818,
"s": 32805,
"text": "Mathematical"
},
{
"code": null,
"e": 32827,
"s": 32818,
"text": "Flipkart"
},
{
"code": null,
"e": 32840,
"s": 32827,
"text": "Mathematical"
},
{
"code": null,
"e": 32938,
"s": 32840,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 32962,
"s": 32938,
"text": "Merge two sorted arrays"
},
{
"code": null,
"e": 33005,
"s": 32962,
"text": "Modulo Operator (%) in C/C++ with Examples"
},
{
"code": null,
"e": 33019,
"s": 33005,
"text": "Prime Numbers"
},
{
"code": null,
"e": 33061,
"s": 33019,
"text": "Program to find GCD or HCF of two numbers"
},
{
"code": null,
"e": 33134,
"s": 33061,
"text": "Print all possible combinations of r elements in a given array of size n"
},
{
"code": null,
"e": 33155,
"s": 33134,
"text": "Operators in C / C++"
},
{
"code": null,
"e": 33198,
"s": 33155,
"text": "The Knight's tour problem | Backtracking-1"
},
{
"code": null,
"e": 33232,
"s": 33198,
"text": "Program for factorial of a number"
},
{
"code": null,
"e": 33273,
"s": 33232,
"text": "Program for Decimal to Binary Conversion"
}
] |
Ngx-Bootstrap - Tabs | ngx-bootstrap tabs component provides a easy to use and highly configurable Tab component.
tabset
tabset
justified − boolean, if true tabs fill the container and have a consistent width.
justified − boolean, if true tabs fill the container and have a consistent width.
type − string, navigation context class: 'tabs' or 'pills'.
type − string, navigation context class: 'tabs' or 'pills'.
vertical − if true tabs will be placed vertically.
vertical − if true tabs will be placed vertically.
tab, [tab]
tab, [tab]
active − boolean, tab active state toggle.
active − boolean, tab active state toggle.
customClass − string, if set, will be added to the tab's class attribute. Multiple classes are supported.
customClass − string, if set, will be added to the tab's class attribute. Multiple classes are supported.
disabled − boolean, if true tab can not be activated.
disabled − boolean, if true tab can not be activated.
heading − string, tab header text.
heading − string, tab header text.
id − string, tab id. The same id with suffix '-link' will be added to the corresponding
id − string, tab id. The same id with suffix '-link' will be added to the corresponding
element.
removable − boolean, if true tab can be removable, additional button will appear.
removable − boolean, if true tab can be removable, additional button will appear.
deselect − fired when tab became inactive, $event:Tab equals to deselected instance of Tab component.
deselect − fired when tab became inactive, $event:Tab equals to deselected instance of Tab component.
removed − fired before tab will be removed, $event:Tab equals to instance of removed tab.
removed − fired before tab will be removed, $event:Tab equals to instance of removed tab.
selectTab − fired when tab became active, $event:Tab equals to selected instance of Tab component.
selectTab − fired when tab became active, $event:Tab equals to selected instance of Tab component.
As we're going to use a Tab, We've to update app.module.ts used in ngx-bootstrap Sortable chapter to use TabsModule and TabsetConfig.
Update app.module.ts to use the TabsModule and TabsetConfig.
app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { AppComponent } from './app.component';
import { TestComponent } from './test/test.component';
import { AccordionModule } from 'ngx-bootstrap/accordion';
import { AlertModule,AlertConfig } from 'ngx-bootstrap/alert';
import { ButtonsModule } from 'ngx-bootstrap/buttons';
import { FormsModule } from '@angular/forms';
import { CarouselModule } from 'ngx-bootstrap/carousel';
import { CollapseModule } from 'ngx-bootstrap/collapse';
import { BsDatepickerModule, BsDatepickerConfig } from 'ngx-bootstrap/datepicker';
import { BsDropdownModule,BsDropdownConfig } from 'ngx-bootstrap/dropdown';
import { PaginationModule,PaginationConfig } from 'ngx-bootstrap/pagination';
import { PopoverModule, PopoverConfig } from 'ngx-bootstrap/popover';
import { ProgressbarModule,ProgressbarConfig } from 'ngx-bootstrap/progressbar';
import { RatingModule, RatingConfig } from 'ngx-bootstrap/rating';
import { SortableModule, DraggableItemService } from 'ngx-bootstrap/sortable';
import { TabsModule, TabsetConfig } from 'ngx-bootstrap/tabs';
@NgModule({
declarations: [
AppComponent,
TestComponent
],
imports: [
BrowserAnimationsModule,
BrowserModule,
AccordionModule,
AlertModule,
ButtonsModule,
FormsModule,
CarouselModule,
CollapseModule,
BsDatepickerModule.forRoot(),
BsDropdownModule,
ModalModule,
PaginationModule,
PopoverModule,
ProgressbarModule,
RatingModule,
SortableModule,
TabsModule
],
providers: [AlertConfig,
BsDatepickerConfig,
BsDropdownConfig,
BsModalService,
PaginationConfig,
ProgressbarConfig,
RatingConfig,
DraggableItemService,
TabsetConfig],
bootstrap: [AppComponent]
})
export class AppModule { }
Update test.component.html to use the tabs component.
test.component.html
<tabset>
<tab heading="Home">Home</tab>
<tab *ngFor="let tabz of tabs"
[heading]="tabz.title"
[active]="tabz.active"
(selectTab)="tabz.active = true"
[disabled]="tabz.disabled">
{{tabz?.content}}
</tab>
</tabset>
Update test.component.ts for corresponding variables and methods.
test.component.ts
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-test',
templateUrl: './test.component.html',
styleUrls: ['./test.component.css']
})
export class TestComponent implements OnInit {
tabs = [
{ title: 'First', content: 'First Tab Content' },
{ title: 'Second', content: 'Second Tab Content', active: true },
{ title: 'Third', content: 'Third Tab Content', removable: true },
{ title: 'Four', content: 'Fourth Tab Content', disabled: true }
];
constructor() {}
ngOnInit(): void {
}
}
Run the following command to start the angular server.
ng serve
Once server is up and running. Open http://localhost:4200. Click on Open modal button and verify the following output.
Print
Add Notes
Bookmark this page | [
{
"code": null,
"e": 2191,
"s": 2100,
"text": "ngx-bootstrap tabs component provides a easy to use and highly configurable Tab component."
},
{
"code": null,
"e": 2198,
"s": 2191,
"text": "tabset"
},
{
"code": null,
"e": 2205,
"s": 2198,
"text": "tabset"
},
{
"code": null,
"e": 2287,
"s": 2205,
"text": "justified − boolean, if true tabs fill the container and have a consistent width."
},
{
"code": null,
"e": 2369,
"s": 2287,
"text": "justified − boolean, if true tabs fill the container and have a consistent width."
},
{
"code": null,
"e": 2429,
"s": 2369,
"text": "type − string, navigation context class: 'tabs' or 'pills'."
},
{
"code": null,
"e": 2489,
"s": 2429,
"text": "type − string, navigation context class: 'tabs' or 'pills'."
},
{
"code": null,
"e": 2540,
"s": 2489,
"text": "vertical − if true tabs will be placed vertically."
},
{
"code": null,
"e": 2591,
"s": 2540,
"text": "vertical − if true tabs will be placed vertically."
},
{
"code": null,
"e": 2602,
"s": 2591,
"text": "tab, [tab]"
},
{
"code": null,
"e": 2613,
"s": 2602,
"text": "tab, [tab]"
},
{
"code": null,
"e": 2656,
"s": 2613,
"text": "active − boolean, tab active state toggle."
},
{
"code": null,
"e": 2699,
"s": 2656,
"text": "active − boolean, tab active state toggle."
},
{
"code": null,
"e": 2805,
"s": 2699,
"text": "customClass − string, if set, will be added to the tab's class attribute. Multiple classes are supported."
},
{
"code": null,
"e": 2911,
"s": 2805,
"text": "customClass − string, if set, will be added to the tab's class attribute. Multiple classes are supported."
},
{
"code": null,
"e": 2965,
"s": 2911,
"text": "disabled − boolean, if true tab can not be activated."
},
{
"code": null,
"e": 3019,
"s": 2965,
"text": "disabled − boolean, if true tab can not be activated."
},
{
"code": null,
"e": 3054,
"s": 3019,
"text": "heading − string, tab header text."
},
{
"code": null,
"e": 3089,
"s": 3054,
"text": "heading − string, tab header text."
},
{
"code": null,
"e": 3178,
"s": 3089,
"text": "id − string, tab id. The same id with suffix '-link' will be added to the corresponding "
},
{
"code": null,
"e": 3267,
"s": 3178,
"text": "id − string, tab id. The same id with suffix '-link' will be added to the corresponding "
},
{
"code": null,
"e": 3277,
"s": 3267,
"text": " element."
},
{
"code": null,
"e": 3359,
"s": 3277,
"text": "removable − boolean, if true tab can be removable, additional button will appear."
},
{
"code": null,
"e": 3441,
"s": 3359,
"text": "removable − boolean, if true tab can be removable, additional button will appear."
},
{
"code": null,
"e": 3543,
"s": 3441,
"text": "deselect − fired when tab became inactive, $event:Tab equals to deselected instance of Tab component."
},
{
"code": null,
"e": 3645,
"s": 3543,
"text": "deselect − fired when tab became inactive, $event:Tab equals to deselected instance of Tab component."
},
{
"code": null,
"e": 3735,
"s": 3645,
"text": "removed − fired before tab will be removed, $event:Tab equals to instance of removed tab."
},
{
"code": null,
"e": 3825,
"s": 3735,
"text": "removed − fired before tab will be removed, $event:Tab equals to instance of removed tab."
},
{
"code": null,
"e": 3924,
"s": 3825,
"text": "selectTab − fired when tab became active, $event:Tab equals to selected instance of Tab component."
},
{
"code": null,
"e": 4023,
"s": 3924,
"text": "selectTab − fired when tab became active, $event:Tab equals to selected instance of Tab component."
},
{
"code": null,
"e": 4157,
"s": 4023,
"text": "As we're going to use a Tab, We've to update app.module.ts used in ngx-bootstrap Sortable chapter to use TabsModule and TabsetConfig."
},
{
"code": null,
"e": 4218,
"s": 4157,
"text": "Update app.module.ts to use the TabsModule and TabsetConfig."
},
{
"code": null,
"e": 4232,
"s": 4218,
"text": "app.module.ts"
},
{
"code": null,
"e": 6213,
"s": 4232,
"text": "import { BrowserModule } from '@angular/platform-browser';\nimport { NgModule } from '@angular/core';\nimport { BrowserAnimationsModule } from '@angular/platform-browser/animations';\nimport { AppComponent } from './app.component';\nimport { TestComponent } from './test/test.component';\nimport { AccordionModule } from 'ngx-bootstrap/accordion';\nimport { AlertModule,AlertConfig } from 'ngx-bootstrap/alert';\nimport { ButtonsModule } from 'ngx-bootstrap/buttons';\nimport { FormsModule } from '@angular/forms';\nimport { CarouselModule } from 'ngx-bootstrap/carousel';\nimport { CollapseModule } from 'ngx-bootstrap/collapse';\nimport { BsDatepickerModule, BsDatepickerConfig } from 'ngx-bootstrap/datepicker';\nimport { BsDropdownModule,BsDropdownConfig } from 'ngx-bootstrap/dropdown';\nimport { PaginationModule,PaginationConfig } from 'ngx-bootstrap/pagination';\nimport { PopoverModule, PopoverConfig } from 'ngx-bootstrap/popover';\nimport { ProgressbarModule,ProgressbarConfig } from 'ngx-bootstrap/progressbar';\nimport { RatingModule, RatingConfig } from 'ngx-bootstrap/rating';\nimport { SortableModule, DraggableItemService } from 'ngx-bootstrap/sortable';\nimport { TabsModule, TabsetConfig } from 'ngx-bootstrap/tabs';\n\n@NgModule({\n declarations: [\n AppComponent,\n TestComponent\n ],\n imports: [\n BrowserAnimationsModule,\n BrowserModule,\n AccordionModule,\n AlertModule,\n ButtonsModule,\n FormsModule,\n CarouselModule,\n CollapseModule,\n BsDatepickerModule.forRoot(),\n BsDropdownModule,\n ModalModule,\n PaginationModule,\n PopoverModule,\n ProgressbarModule,\n RatingModule,\n SortableModule,\n TabsModule\n ],\n providers: [AlertConfig, \n BsDatepickerConfig, \n BsDropdownConfig,\n BsModalService,\n PaginationConfig,\n ProgressbarConfig,\n RatingConfig,\n DraggableItemService,\n TabsetConfig],\n bootstrap: [AppComponent]\n})\nexport class AppModule { }"
},
{
"code": null,
"e": 6267,
"s": 6213,
"text": "Update test.component.html to use the tabs component."
},
{
"code": null,
"e": 6287,
"s": 6267,
"text": "test.component.html"
},
{
"code": null,
"e": 6547,
"s": 6287,
"text": "<tabset>\n <tab heading=\"Home\">Home</tab>\n <tab *ngFor=\"let tabz of tabs\"\n [heading]=\"tabz.title\"\n [active]=\"tabz.active\"\n (selectTab)=\"tabz.active = true\" \n [disabled]=\"tabz.disabled\">\n {{tabz?.content}}\n </tab>\n</tabset>"
},
{
"code": null,
"e": 6613,
"s": 6547,
"text": "Update test.component.ts for corresponding variables and methods."
},
{
"code": null,
"e": 6631,
"s": 6613,
"text": "test.component.ts"
},
{
"code": null,
"e": 7191,
"s": 6631,
"text": "import { Component, OnInit } from '@angular/core';\n\n@Component({\n selector: 'app-test',\n templateUrl: './test.component.html',\n styleUrls: ['./test.component.css']\n})\nexport class TestComponent implements OnInit {\n tabs = [\n { title: 'First', content: 'First Tab Content' },\n { title: 'Second', content: 'Second Tab Content', active: true },\n { title: 'Third', content: 'Third Tab Content', removable: true },\n { title: 'Four', content: 'Fourth Tab Content', disabled: true }\n ];\n constructor() {}\n ngOnInit(): void {\n } \n}"
},
{
"code": null,
"e": 7246,
"s": 7191,
"text": "Run the following command to start the angular server."
},
{
"code": null,
"e": 7256,
"s": 7246,
"text": "ng serve\n"
},
{
"code": null,
"e": 7375,
"s": 7256,
"text": "Once server is up and running. Open http://localhost:4200. Click on Open modal button and verify the following output."
},
{
"code": null,
"e": 7382,
"s": 7375,
"text": " Print"
},
{
"code": null,
"e": 7393,
"s": 7382,
"text": " Add Notes"
}
] |
When and How to use Weighted Least Squares (WLS) Models | by Jonathan Balaban | Towards Data Science | At Metis, one of the first machine learning models I teach is the Plain Jane Ordinary Least Squares (OLS) model that most everyone learns in high school. Excel has a way of removing the charm from OLS modeling; students often assume there’s a scatterplot, some magic math that draws a best fit line, then an r2 in the corner that we’d like to get close to 1. Truth is, there’s so much more than meets the eye with OLS, and after about a week, students are crying for mercy (disclaimer: no students are actually harmed!) as we plunge into the depths of a domain that initially seemed so simple.
With this widely-applicable model understood, a natural response is to use OLS for anything and everything. Which isn’t a terrible idea: although OLS requires four — some say five or six — assumptions to be met with raw or “massaged” data, the modeling paradigm is quite robust and can often perform well, as long as we regularize and use proper complexity, log transforms, intercepts, etc.
However, OLS is only one of a distinguished family tree:
Weighted Least Squares (WLS) is the quiet Squares cousin, but she has a unique bag of tricks that aligns perfectly with certain datasets!
Another of my students’ favorite terms — and commonly featured during “Data Science Hangman” or other happy hour festivities — is heteroskedasticity. Coming from the ancient Greek hetero, meaning “different”, and skedasis, meaning “dispersion”, it can also be found in the anglicized “Heteroscedasticity” (notice the additional ‘c’) form. In a nutshell, data that is heteroskedastic has variability that changes as a function of the inputs.
The truth of the matter is, lots of data exhibits this “Heteroskedasticity”. Draw up some example feature-response relationships and we can often intuitively explain why:
As age increases, net worths tend to diverge
As company size increases, revenues tend to diverge
Or, as infant height increases, weight tends to diverge
One of OLS’ major assumptions is that the data — and therefore, the residuals — are homeskedastic. Uh-oh! Well, the good news is that OLS can handle a certain level of heteroskedasticity. Search online and you might find different rules-of-thumb, like “the highest variability shouldn’t be greater than four times that of the smallest”. There are also a number of tests to statistically determine the scale of your problem.
Fortunately, OLS’ assumptions are not black and white, binary enforcements. There’s a gray area where the model still works rather well.
“But what if I have terrible — over 4x heteroskedasticity — regression, master?”
“Then we shall turn to WLS, young Padawan!”
Let’s take a look at how WLS is implemented in one of my favorite machine learning environments, scikit-learn.
Let’s generate some fake data:
import numpy as npimport pandas as pdimport seaborn as snsimport statsmodels.api as sm%matplotlib inline# generate random datanp.random.seed(24)x = np.random.uniform(-5,5,25)ε = 2*np.random.randn(25)y = 2*x+ε
# alternate error as a function of xε2 = ε*(x+5)y2 = 2*x+ε2sns.regplot(x,y);sns.regplot(x,y2);
Notice that the sets come from the same ground truth function, but the increasing variance as a function of x causes the orange model to fit a line different than the blue. In another random draw, the slope may be lower than blue, but will be more volatile in general.
# add a strong outlier for high xx_high = np.append(x,5)y_high = np.append(y2,160)# add a strong outlier for low xx_low = np.append(x,-4)y_low = np.append(y2,160)
The first append above mimics a common scenario where an area of high variance (expectedly) sees an extreme observation. This will affect OLS more than WLS, as WLS will de-weight the variance and its“penalty”.
To calculate sample weights, remember that the errors we added varied as a function of (x+5); we can use this to inversely weight the values. As long as the relative weights are consistent, an absolute benchmark isn’t needed.
# calculate weights for sets with low and high outliersample_weights_low = [1/(x+5) for x in x_low]sample_weights_high = [1/(x+5) for x in x_high]
# reshape for compatibilityX_low = x_low.reshape(-1, 1)X_high = x_high.reshape(-1, 1)---------# import and fit an OLS model, check coefficientsfrom sklearn.linear_model import LinearRegressionmodel = LinearRegression()model.fit(X_low, ymod)# fit WLS using sample_weightsWLS = LinearRegression()WLS.fit(X_low, ymod, sample_weight=sample_weights_low)print(model.intercept_, model.coef_)print('WLS')print(WLS.intercept_, WLS.coef_)# run this yourself, don't trust every result you see online =)
Notice how the slope in WLS is MORE affected by the low outlier, as it should. The low region should have low variability, so the outlier is magnified above what OLS does, pushing the slope more negative. Let’s see below how the high outlier is suppressed in WLS.
model = LinearRegression()model.fit(X_high, ymod)WLS.fit(X_high, ymod, sample_weight=sample_weights_high)print(model.intercept_, model.coef_)print('WLS')print(WLS.intercept_, WLS.coef_)
You’ll notice how outliers in areas where variance is expected are reduced in impact on the parameter estimation. Remember, use WLS when outliers are not all considered equal!
There you have it! Implementing WLS can be somewhat tricky;sklearn doesn’t have a distinct WLS model because the argument functionality (that’s also used in Decision Trees and other models) secretly supports our needs.
This was a basic intro to WLS, and there’s plenty more in this space to explore, including the promising Huber-White ‘sandwich’ estimator approach.
And finally, here’s a weighting approach recommended in the book Introduction to Linear Regression Analysis by Douglas C. Montgomery, Elizabeth A. Peck, and G. Geoffrey Vining. For example:
Always seek to use experience or prior information when modeling.Using residuals of the model — for example if var(εi)=σ2x_i*var(εi)=σ2x_i — then we may decide to use w_i=1/x_i.If the responses are the average of n observation, something like var(y_i)=var(ε_i)=σ2/n_i*var(y_i)=var(ε_i)=σ2/n_i, then we may decide to use w_i=n_i.Sometime we know that different observations have been measured by different instruments that have some (known or estimated) accuracy. In this case we may decide to use weights as inversely proportional to the variance of measurement errors.
Always seek to use experience or prior information when modeling.
Using residuals of the model — for example if var(εi)=σ2x_i*var(εi)=σ2x_i — then we may decide to use w_i=1/x_i.
If the responses are the average of n observation, something like var(y_i)=var(ε_i)=σ2/n_i*var(y_i)=var(ε_i)=σ2/n_i, then we may decide to use w_i=n_i.
Sometime we know that different observations have been measured by different instruments that have some (known or estimated) accuracy. In this case we may decide to use weights as inversely proportional to the variance of measurement errors.
As with most data science endeavors, your approach must be flexible to the type of data you have.
Happy modeling! And as always, thanks for reading, connecting, and sharing! | [
{
"code": null,
"e": 766,
"s": 172,
"text": "At Metis, one of the first machine learning models I teach is the Plain Jane Ordinary Least Squares (OLS) model that most everyone learns in high school. Excel has a way of removing the charm from OLS modeling; students often assume there’s a scatterplot, some magic math that draws a best fit line, then an r2 in the corner that we’d like to get close to 1. Truth is, there’s so much more than meets the eye with OLS, and after about a week, students are crying for mercy (disclaimer: no students are actually harmed!) as we plunge into the depths of a domain that initially seemed so simple."
},
{
"code": null,
"e": 1157,
"s": 766,
"text": "With this widely-applicable model understood, a natural response is to use OLS for anything and everything. Which isn’t a terrible idea: although OLS requires four — some say five or six — assumptions to be met with raw or “massaged” data, the modeling paradigm is quite robust and can often perform well, as long as we regularize and use proper complexity, log transforms, intercepts, etc."
},
{
"code": null,
"e": 1214,
"s": 1157,
"text": "However, OLS is only one of a distinguished family tree:"
},
{
"code": null,
"e": 1352,
"s": 1214,
"text": "Weighted Least Squares (WLS) is the quiet Squares cousin, but she has a unique bag of tricks that aligns perfectly with certain datasets!"
},
{
"code": null,
"e": 1793,
"s": 1352,
"text": "Another of my students’ favorite terms — and commonly featured during “Data Science Hangman” or other happy hour festivities — is heteroskedasticity. Coming from the ancient Greek hetero, meaning “different”, and skedasis, meaning “dispersion”, it can also be found in the anglicized “Heteroscedasticity” (notice the additional ‘c’) form. In a nutshell, data that is heteroskedastic has variability that changes as a function of the inputs."
},
{
"code": null,
"e": 1964,
"s": 1793,
"text": "The truth of the matter is, lots of data exhibits this “Heteroskedasticity”. Draw up some example feature-response relationships and we can often intuitively explain why:"
},
{
"code": null,
"e": 2009,
"s": 1964,
"text": "As age increases, net worths tend to diverge"
},
{
"code": null,
"e": 2061,
"s": 2009,
"text": "As company size increases, revenues tend to diverge"
},
{
"code": null,
"e": 2117,
"s": 2061,
"text": "Or, as infant height increases, weight tends to diverge"
},
{
"code": null,
"e": 2541,
"s": 2117,
"text": "One of OLS’ major assumptions is that the data — and therefore, the residuals — are homeskedastic. Uh-oh! Well, the good news is that OLS can handle a certain level of heteroskedasticity. Search online and you might find different rules-of-thumb, like “the highest variability shouldn’t be greater than four times that of the smallest”. There are also a number of tests to statistically determine the scale of your problem."
},
{
"code": null,
"e": 2678,
"s": 2541,
"text": "Fortunately, OLS’ assumptions are not black and white, binary enforcements. There’s a gray area where the model still works rather well."
},
{
"code": null,
"e": 2759,
"s": 2678,
"text": "“But what if I have terrible — over 4x heteroskedasticity — regression, master?”"
},
{
"code": null,
"e": 2803,
"s": 2759,
"text": "“Then we shall turn to WLS, young Padawan!”"
},
{
"code": null,
"e": 2914,
"s": 2803,
"text": "Let’s take a look at how WLS is implemented in one of my favorite machine learning environments, scikit-learn."
},
{
"code": null,
"e": 2945,
"s": 2914,
"text": "Let’s generate some fake data:"
},
{
"code": null,
"e": 3154,
"s": 2945,
"text": "import numpy as npimport pandas as pdimport seaborn as snsimport statsmodels.api as sm%matplotlib inline# generate random datanp.random.seed(24)x = np.random.uniform(-5,5,25)ε = 2*np.random.randn(25)y = 2*x+ε"
},
{
"code": null,
"e": 3249,
"s": 3154,
"text": "# alternate error as a function of xε2 = ε*(x+5)y2 = 2*x+ε2sns.regplot(x,y);sns.regplot(x,y2);"
},
{
"code": null,
"e": 3518,
"s": 3249,
"text": "Notice that the sets come from the same ground truth function, but the increasing variance as a function of x causes the orange model to fit a line different than the blue. In another random draw, the slope may be lower than blue, but will be more volatile in general."
},
{
"code": null,
"e": 3681,
"s": 3518,
"text": "# add a strong outlier for high xx_high = np.append(x,5)y_high = np.append(y2,160)# add a strong outlier for low xx_low = np.append(x,-4)y_low = np.append(y2,160)"
},
{
"code": null,
"e": 3891,
"s": 3681,
"text": "The first append above mimics a common scenario where an area of high variance (expectedly) sees an extreme observation. This will affect OLS more than WLS, as WLS will de-weight the variance and its“penalty”."
},
{
"code": null,
"e": 4117,
"s": 3891,
"text": "To calculate sample weights, remember that the errors we added varied as a function of (x+5); we can use this to inversely weight the values. As long as the relative weights are consistent, an absolute benchmark isn’t needed."
},
{
"code": null,
"e": 4264,
"s": 4117,
"text": "# calculate weights for sets with low and high outliersample_weights_low = [1/(x+5) for x in x_low]sample_weights_high = [1/(x+5) for x in x_high]"
},
{
"code": null,
"e": 4756,
"s": 4264,
"text": "# reshape for compatibilityX_low = x_low.reshape(-1, 1)X_high = x_high.reshape(-1, 1)---------# import and fit an OLS model, check coefficientsfrom sklearn.linear_model import LinearRegressionmodel = LinearRegression()model.fit(X_low, ymod)# fit WLS using sample_weightsWLS = LinearRegression()WLS.fit(X_low, ymod, sample_weight=sample_weights_low)print(model.intercept_, model.coef_)print('WLS')print(WLS.intercept_, WLS.coef_)# run this yourself, don't trust every result you see online =)"
},
{
"code": null,
"e": 5020,
"s": 4756,
"text": "Notice how the slope in WLS is MORE affected by the low outlier, as it should. The low region should have low variability, so the outlier is magnified above what OLS does, pushing the slope more negative. Let’s see below how the high outlier is suppressed in WLS."
},
{
"code": null,
"e": 5206,
"s": 5020,
"text": "model = LinearRegression()model.fit(X_high, ymod)WLS.fit(X_high, ymod, sample_weight=sample_weights_high)print(model.intercept_, model.coef_)print('WLS')print(WLS.intercept_, WLS.coef_)"
},
{
"code": null,
"e": 5382,
"s": 5206,
"text": "You’ll notice how outliers in areas where variance is expected are reduced in impact on the parameter estimation. Remember, use WLS when outliers are not all considered equal!"
},
{
"code": null,
"e": 5601,
"s": 5382,
"text": "There you have it! Implementing WLS can be somewhat tricky;sklearn doesn’t have a distinct WLS model because the argument functionality (that’s also used in Decision Trees and other models) secretly supports our needs."
},
{
"code": null,
"e": 5749,
"s": 5601,
"text": "This was a basic intro to WLS, and there’s plenty more in this space to explore, including the promising Huber-White ‘sandwich’ estimator approach."
},
{
"code": null,
"e": 5939,
"s": 5749,
"text": "And finally, here’s a weighting approach recommended in the book Introduction to Linear Regression Analysis by Douglas C. Montgomery, Elizabeth A. Peck, and G. Geoffrey Vining. For example:"
},
{
"code": null,
"e": 6509,
"s": 5939,
"text": "Always seek to use experience or prior information when modeling.Using residuals of the model — for example if var(εi)=σ2x_i*var(εi)=σ2x_i — then we may decide to use w_i=1/x_i.If the responses are the average of n observation, something like var(y_i)=var(ε_i)=σ2/n_i*var(y_i)=var(ε_i)=σ2/n_i, then we may decide to use w_i=n_i.Sometime we know that different observations have been measured by different instruments that have some (known or estimated) accuracy. In this case we may decide to use weights as inversely proportional to the variance of measurement errors."
},
{
"code": null,
"e": 6575,
"s": 6509,
"text": "Always seek to use experience or prior information when modeling."
},
{
"code": null,
"e": 6688,
"s": 6575,
"text": "Using residuals of the model — for example if var(εi)=σ2x_i*var(εi)=σ2x_i — then we may decide to use w_i=1/x_i."
},
{
"code": null,
"e": 6840,
"s": 6688,
"text": "If the responses are the average of n observation, something like var(y_i)=var(ε_i)=σ2/n_i*var(y_i)=var(ε_i)=σ2/n_i, then we may decide to use w_i=n_i."
},
{
"code": null,
"e": 7082,
"s": 6840,
"text": "Sometime we know that different observations have been measured by different instruments that have some (known or estimated) accuracy. In this case we may decide to use weights as inversely proportional to the variance of measurement errors."
},
{
"code": null,
"e": 7180,
"s": 7082,
"text": "As with most data science endeavors, your approach must be flexible to the type of data you have."
}
] |
cin in C++ - GeeksforGeeks | 29 Jul, 2021
The cin object in C++ is an object of class iostream. It is used to accept the input from the standard input device i.e. keyboard. It is associated with the standard C input stream stdin. The extraction operator(>>) is used along with the object cin for reading inputs. The extraction operator extracts the data from the object cin which is entered using the keyboard.
Program 1:
Below is the C++ program to implement cin object:
C++
// C++ program to demonstrate the// cin object#include <iostream>using namespace std; // Driver Codeint main(){ string s; // Take input using cin cin >> s; // Print output cout << s; return 0;}
Input:
Output:
Program 2:
Multiple inputs using the extraction operators(>>) with cin. Below is the C++ program to take multiple user inputs:
C++
// C++ program to illustrate the take// multiple input#include <iostream>using namespace std; // Driver Codeint main(){ string name; int age; // Take multiple input using cin cin >> name >> age; // Print output cout << "Name : " << name << endl; cout << "Age : " << age << endl; return 0;}
Input:
Output:
The cin can also be used with some member functions which are as follows:
It reads a stream of characters of length N into the string buffer, It stops when it has read (N – 1) characters or it finds the end of the file or newline character(\n). Below is the C++ program to implement cin.getline():
C++
// C++ program to illustrate the use// of cin.getline#include <iostream>using namespace std; // Driver Codeint main(){ char name[5]; // Reads stream of 3 // characters cin.getline(name, 3); // Print output cout << name << endl; return 0;}
Input:
Output:
It reads an input character and stores it in a variable. Below is the C++ program to implement cin.get():
C++
// C++ program to illustrate the use// of cin.get()#include <iostream>using namespace std; // Driver Codeint main(){ char ch; cin.get(ch, 25); // Print ch cout << ch;}
Input:
Output:
Reads a stream of characters of length N. Below is the C++ program to implement cin.read():
C++
// C++ program to illustrate the use// of cin.read()#include <iostream>using namespace std; // Driver Codeint main(){ char gfg[20]; // Reads stream of characters cin.read(gfg, 10); // Print output cout << gfg << endl; return 0;}
Input:
Output:
It ignores or clears one or more characters from the input buffer. Below is the C++ program to implement cin.ignore():
C++
// C++ program to illustrate the use// of cin.ignore()#include <iostream> // used to get stream size#include <ios> // used to get numeric limits#include <limits>using namespace std; // Driver Codeint main(){ int x; char str[80]; cout << "Enter a number andstring:\n"; cin >> x; // clear buffer before taking // new line cin.ignore(numeric_limits<streamsize>::max(), '\n'); // Input a string cin.getline(str, 80); cout << "You have entered:\n"; cout << x << endl; cout << str << endl; return 0;}
Input:
Output:
Explanation: In the above program if cin.ignore() has not been used then after entering the number when the user presses the enter to input the string, the output will be only the number entered. The program will not take the string input. To avoid this problem cin.ignore() is used, this will ignore the newline character.
santhoshsandy0144
cpp-input-output
Input and Output
Input Output Systems
Picked
C++
C++ Programs
CPP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Operator Overloading in C++
Polymorphism in C++
Sorting a vector in C++
Friend class and function in C++
Pair in C++ Standard Template Library (STL)
Header files in C/C++ and its uses
How to return multiple values from a function in C or C++?
C++ Program for QuickSort
Program to print ASCII Value of a character
Sorting a Map by value in C++ STL | [
{
"code": null,
"e": 24098,
"s": 24070,
"text": "\n29 Jul, 2021"
},
{
"code": null,
"e": 24467,
"s": 24098,
"text": "The cin object in C++ is an object of class iostream. It is used to accept the input from the standard input device i.e. keyboard. It is associated with the standard C input stream stdin. The extraction operator(>>) is used along with the object cin for reading inputs. The extraction operator extracts the data from the object cin which is entered using the keyboard."
},
{
"code": null,
"e": 24478,
"s": 24467,
"text": "Program 1:"
},
{
"code": null,
"e": 24528,
"s": 24478,
"text": "Below is the C++ program to implement cin object:"
},
{
"code": null,
"e": 24532,
"s": 24528,
"text": "C++"
},
{
"code": "// C++ program to demonstrate the// cin object#include <iostream>using namespace std; // Driver Codeint main(){ string s; // Take input using cin cin >> s; // Print output cout << s; return 0;}",
"e": 24751,
"s": 24532,
"text": null
},
{
"code": null,
"e": 24762,
"s": 24754,
"text": "Input: "
},
{
"code": null,
"e": 24772,
"s": 24764,
"text": "Output:"
},
{
"code": null,
"e": 24783,
"s": 24772,
"text": "Program 2:"
},
{
"code": null,
"e": 24900,
"s": 24783,
"text": "Multiple inputs using the extraction operators(>>) with cin. Below is the C++ program to take multiple user inputs: "
},
{
"code": null,
"e": 24904,
"s": 24900,
"text": "C++"
},
{
"code": "// C++ program to illustrate the take// multiple input#include <iostream>using namespace std; // Driver Codeint main(){ string name; int age; // Take multiple input using cin cin >> name >> age; // Print output cout << \"Name : \" << name << endl; cout << \"Age : \" << age << endl; return 0;}",
"e": 25225,
"s": 24904,
"text": null
},
{
"code": null,
"e": 25235,
"s": 25228,
"text": "Input:"
},
{
"code": null,
"e": 25245,
"s": 25237,
"text": "Output:"
},
{
"code": null,
"e": 25320,
"s": 25245,
"text": " The cin can also be used with some member functions which are as follows:"
},
{
"code": null,
"e": 25545,
"s": 25320,
"text": "It reads a stream of characters of length N into the string buffer, It stops when it has read (N – 1) characters or it finds the end of the file or newline character(\\n). Below is the C++ program to implement cin.getline(): "
},
{
"code": null,
"e": 25549,
"s": 25545,
"text": "C++"
},
{
"code": "// C++ program to illustrate the use// of cin.getline#include <iostream>using namespace std; // Driver Codeint main(){ char name[5]; // Reads stream of 3 // characters cin.getline(name, 3); // Print output cout << name << endl; return 0;}",
"e": 25816,
"s": 25549,
"text": null
},
{
"code": null,
"e": 25824,
"s": 25816,
"text": "Input: "
},
{
"code": null,
"e": 25834,
"s": 25826,
"text": "Output:"
},
{
"code": null,
"e": 25943,
"s": 25836,
"text": "It reads an input character and stores it in a variable. Below is the C++ program to implement cin.get():"
},
{
"code": null,
"e": 25947,
"s": 25943,
"text": "C++"
},
{
"code": "// C++ program to illustrate the use// of cin.get()#include <iostream>using namespace std; // Driver Codeint main(){ char ch; cin.get(ch, 25); // Print ch cout << ch;}",
"e": 26130,
"s": 25947,
"text": null
},
{
"code": null,
"e": 26137,
"s": 26130,
"text": "Input:"
},
{
"code": null,
"e": 26145,
"s": 26137,
"text": "Output:"
},
{
"code": null,
"e": 26239,
"s": 26147,
"text": "Reads a stream of characters of length N. Below is the C++ program to implement cin.read():"
},
{
"code": null,
"e": 26243,
"s": 26239,
"text": "C++"
},
{
"code": "// C++ program to illustrate the use// of cin.read()#include <iostream>using namespace std; // Driver Codeint main(){ char gfg[20]; // Reads stream of characters cin.read(gfg, 10); // Print output cout << gfg << endl; return 0;}",
"e": 26497,
"s": 26243,
"text": null
},
{
"code": null,
"e": 26504,
"s": 26497,
"text": "Input:"
},
{
"code": null,
"e": 26516,
"s": 26508,
"text": "Output:"
},
{
"code": null,
"e": 26641,
"s": 26522,
"text": "It ignores or clears one or more characters from the input buffer. Below is the C++ program to implement cin.ignore():"
},
{
"code": null,
"e": 26645,
"s": 26641,
"text": "C++"
},
{
"code": "// C++ program to illustrate the use// of cin.ignore()#include <iostream> // used to get stream size#include <ios> // used to get numeric limits#include <limits>using namespace std; // Driver Codeint main(){ int x; char str[80]; cout << \"Enter a number andstring:\\n\"; cin >> x; // clear buffer before taking // new line cin.ignore(numeric_limits<streamsize>::max(), '\\n'); // Input a string cin.getline(str, 80); cout << \"You have entered:\\n\"; cout << x << endl; cout << str << endl; return 0;}",
"e": 27188,
"s": 26645,
"text": null
},
{
"code": null,
"e": 27199,
"s": 27191,
"text": "Input: "
},
{
"code": null,
"e": 27209,
"s": 27201,
"text": "Output:"
},
{
"code": null,
"e": 27537,
"s": 27213,
"text": "Explanation: In the above program if cin.ignore() has not been used then after entering the number when the user presses the enter to input the string, the output will be only the number entered. The program will not take the string input. To avoid this problem cin.ignore() is used, this will ignore the newline character."
},
{
"code": null,
"e": 27555,
"s": 27537,
"text": "santhoshsandy0144"
},
{
"code": null,
"e": 27572,
"s": 27555,
"text": "cpp-input-output"
},
{
"code": null,
"e": 27589,
"s": 27572,
"text": "Input and Output"
},
{
"code": null,
"e": 27610,
"s": 27589,
"text": "Input Output Systems"
},
{
"code": null,
"e": 27617,
"s": 27610,
"text": "Picked"
},
{
"code": null,
"e": 27621,
"s": 27617,
"text": "C++"
},
{
"code": null,
"e": 27634,
"s": 27621,
"text": "C++ Programs"
},
{
"code": null,
"e": 27638,
"s": 27634,
"text": "CPP"
},
{
"code": null,
"e": 27736,
"s": 27638,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 27764,
"s": 27736,
"text": "Operator Overloading in C++"
},
{
"code": null,
"e": 27784,
"s": 27764,
"text": "Polymorphism in C++"
},
{
"code": null,
"e": 27808,
"s": 27784,
"text": "Sorting a vector in C++"
},
{
"code": null,
"e": 27841,
"s": 27808,
"text": "Friend class and function in C++"
},
{
"code": null,
"e": 27885,
"s": 27841,
"text": "Pair in C++ Standard Template Library (STL)"
},
{
"code": null,
"e": 27920,
"s": 27885,
"text": "Header files in C/C++ and its uses"
},
{
"code": null,
"e": 27979,
"s": 27920,
"text": "How to return multiple values from a function in C or C++?"
},
{
"code": null,
"e": 28005,
"s": 27979,
"text": "C++ Program for QuickSort"
},
{
"code": null,
"e": 28049,
"s": 28005,
"text": "Program to print ASCII Value of a character"
}
] |
deque::begin() and deque::end in C++ STL - GeeksforGeeks | 21 Nov, 2018
Deque or Double ended queues are sequence containers with the feature of expansion and contraction on both the ends. They are similar to vectors, but are more efficient in case of insertion and deletion of elements at the end, and also the beginning. Unlike vectors, contiguous storage allocation may not be guaranteed.
begin() function is used to return an iterator pointing to the first element of the deque container. begin() function returns a bidirectional iterator to the first element of the container.
Syntax :
dequename.begin()
Parameters :
No parameters are passed.
Returns :
This function returns a bidirectional
iterator pointing to the first element.
Examples:
Input : mydeque{1, 2, 3, 4, 5};
mydeque.begin();
Output : returns an iterator to the element 1
Input : mydeque{8, 7};
mydeque.begin();
Output : returns an iterator to the element 8
Errors and Exceptions
1. It has a no exception throw guarantee.2. Shows error when a parameter is passed.
// CPP program to illustrate// Implementation of begin() function#include <deque>#include <iostream>using namespace std; int main(){ // declaration of deque container deque<int> mydeque{ 1, 2, 3, 4, 5 }; // using begin() to print deque for (auto it = mydeque.begin(); it != mydeque.end(); ++it) cout << ' ' << *it; return 0;}
Output:
1 2 3 4 5
Time Complexity : O(1)
end() function is used to return an iterator pointing to the last element of the deque container. end() function returns a bidirectional iterator to the last element of the container.Note : The last element of any container is considered as the theoretical element next to the last value stored in the container.
Syntax :
dequename.end()
Parameters :
No parameters are passed.
Returns :
This function returns a bidirectional
iterator pointing to the last element.
Examples:
Input : mydeque{1, 2, 3, 4, 5};
mydeque.end();
Output : returns an iterator to the element next to the element 5
Input : mydeque{8, 7};
mydeque.end();
Output : returns an iterator to the element next to the element 7
Errors and Exceptions
1. It has a no exception throw guarantee.2. Shows error when a parameter is passed.
// CPP program to illustrate// Implementation of end() function#include <deque>#include <iostream>using namespace std; int main(){ // declaration of deque container deque<int> mydeque{ 1, 2, 3, 4, 5 }; // using end() to print deque for (auto it = mydeque.begin(); it != mydeque.end(); ++it) cout << ' ' << *it; return 0;}
Output:
1 2 3 4 5
Time Complexity : O(1)
Harshit Singhal 2
cpp-deque
STL
C++
STL
CPP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Inheritance in C++
Map in C++ Standard Template Library (STL)
C++ Classes and Objects
Bitwise Operators in C/C++
Operator Overloading in C++
Constructors in C++
Socket Programming in C/C++
Virtual Function in C++
Multidimensional Arrays in C / C++
Templates in C++ with Examples | [
{
"code": null,
"e": 25193,
"s": 25165,
"text": "\n21 Nov, 2018"
},
{
"code": null,
"e": 25513,
"s": 25193,
"text": "Deque or Double ended queues are sequence containers with the feature of expansion and contraction on both the ends. They are similar to vectors, but are more efficient in case of insertion and deletion of elements at the end, and also the beginning. Unlike vectors, contiguous storage allocation may not be guaranteed."
},
{
"code": null,
"e": 25703,
"s": 25513,
"text": "begin() function is used to return an iterator pointing to the first element of the deque container. begin() function returns a bidirectional iterator to the first element of the container."
},
{
"code": null,
"e": 25712,
"s": 25703,
"text": "Syntax :"
},
{
"code": null,
"e": 25858,
"s": 25712,
"text": "dequename.begin()\nParameters :\nNo parameters are passed.\nReturns :\nThis function returns a bidirectional\niterator pointing to the first element.\n"
},
{
"code": null,
"e": 25868,
"s": 25858,
"text": "Examples:"
},
{
"code": null,
"e": 26071,
"s": 25868,
"text": "Input : mydeque{1, 2, 3, 4, 5};\n mydeque.begin();\nOutput : returns an iterator to the element 1\n\nInput : mydeque{8, 7};\n mydeque.begin();\nOutput : returns an iterator to the element 8\n"
},
{
"code": null,
"e": 26093,
"s": 26071,
"text": "Errors and Exceptions"
},
{
"code": null,
"e": 26177,
"s": 26093,
"text": "1. It has a no exception throw guarantee.2. Shows error when a parameter is passed."
},
{
"code": "// CPP program to illustrate// Implementation of begin() function#include <deque>#include <iostream>using namespace std; int main(){ // declaration of deque container deque<int> mydeque{ 1, 2, 3, 4, 5 }; // using begin() to print deque for (auto it = mydeque.begin(); it != mydeque.end(); ++it) cout << ' ' << *it; return 0;}",
"e": 26528,
"s": 26177,
"text": null
},
{
"code": null,
"e": 26536,
"s": 26528,
"text": "Output:"
},
{
"code": null,
"e": 26547,
"s": 26536,
"text": "1 2 3 4 5\n"
},
{
"code": null,
"e": 26570,
"s": 26547,
"text": "Time Complexity : O(1)"
},
{
"code": null,
"e": 26883,
"s": 26570,
"text": "end() function is used to return an iterator pointing to the last element of the deque container. end() function returns a bidirectional iterator to the last element of the container.Note : The last element of any container is considered as the theoretical element next to the last value stored in the container."
},
{
"code": null,
"e": 26892,
"s": 26883,
"text": "Syntax :"
},
{
"code": null,
"e": 27035,
"s": 26892,
"text": "dequename.end()\nParameters :\nNo parameters are passed.\nReturns :\nThis function returns a bidirectional\niterator pointing to the last element.\n"
},
{
"code": null,
"e": 27045,
"s": 27035,
"text": "Examples:"
},
{
"code": null,
"e": 27284,
"s": 27045,
"text": "Input : mydeque{1, 2, 3, 4, 5};\n mydeque.end();\nOutput : returns an iterator to the element next to the element 5\n\nInput : mydeque{8, 7};\n mydeque.end();\nOutput : returns an iterator to the element next to the element 7\n"
},
{
"code": null,
"e": 27306,
"s": 27284,
"text": "Errors and Exceptions"
},
{
"code": null,
"e": 27390,
"s": 27306,
"text": "1. It has a no exception throw guarantee.2. Shows error when a parameter is passed."
},
{
"code": "// CPP program to illustrate// Implementation of end() function#include <deque>#include <iostream>using namespace std; int main(){ // declaration of deque container deque<int> mydeque{ 1, 2, 3, 4, 5 }; // using end() to print deque for (auto it = mydeque.begin(); it != mydeque.end(); ++it) cout << ' ' << *it; return 0;}",
"e": 27737,
"s": 27390,
"text": null
},
{
"code": null,
"e": 27745,
"s": 27737,
"text": "Output:"
},
{
"code": null,
"e": 27756,
"s": 27745,
"text": "1 2 3 4 5\n"
},
{
"code": null,
"e": 27779,
"s": 27756,
"text": "Time Complexity : O(1)"
},
{
"code": null,
"e": 27797,
"s": 27779,
"text": "Harshit Singhal 2"
},
{
"code": null,
"e": 27807,
"s": 27797,
"text": "cpp-deque"
},
{
"code": null,
"e": 27811,
"s": 27807,
"text": "STL"
},
{
"code": null,
"e": 27815,
"s": 27811,
"text": "C++"
},
{
"code": null,
"e": 27819,
"s": 27815,
"text": "STL"
},
{
"code": null,
"e": 27823,
"s": 27819,
"text": "CPP"
},
{
"code": null,
"e": 27921,
"s": 27823,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 27940,
"s": 27921,
"text": "Inheritance in C++"
},
{
"code": null,
"e": 27983,
"s": 27940,
"text": "Map in C++ Standard Template Library (STL)"
},
{
"code": null,
"e": 28007,
"s": 27983,
"text": "C++ Classes and Objects"
},
{
"code": null,
"e": 28034,
"s": 28007,
"text": "Bitwise Operators in C/C++"
},
{
"code": null,
"e": 28062,
"s": 28034,
"text": "Operator Overloading in C++"
},
{
"code": null,
"e": 28082,
"s": 28062,
"text": "Constructors in C++"
},
{
"code": null,
"e": 28110,
"s": 28082,
"text": "Socket Programming in C/C++"
},
{
"code": null,
"e": 28134,
"s": 28110,
"text": "Virtual Function in C++"
},
{
"code": null,
"e": 28169,
"s": 28134,
"text": "Multidimensional Arrays in C / C++"
}
] |
Scikit Learn - Extended Linear Modeling | This chapter focusses on the polynomial features and pipelining tools in Sklearn.
Linear models trained on non-linear functions of data generally maintains the fast performance of linear methods. It also allows them to fit a much wider range of data. That’s the reason in machine learning such linear models, that are trained on nonlinear functions, are used.
One such example is that a simple linear regression can be extended by constructing polynomial features from the coefficients.
Mathematically, suppose we have standard linear regression model then for 2-D data it would look like this −
Now, we can combine the features in second-order polynomials and our model will look like as follows −
The above is still a linear model. Here, we saw that the resulting polynomial regression is in the same class of linear models and can be solved similarly.
To do so, scikit-learn provides a module named PolynomialFeatures. This module transforms an input data matrix into a new data matrix of given degree.
Followings table consist the parameters used by PolynomialFeatures module
degree − integer, default = 2
It represents the degree of the polynomial features.
interaction_only − Boolean, default = false
By default, it is false but if set as true, the features that are products of most degree distinct input features, are produced. Such features are called interaction features.
include_bias − Boolean, default = true
It includes a bias column i.e. the feature in which all polynomials powers are zero.
order − str in {‘C’, ‘F’}, default = ‘C’
This parameter represents the order of output array in the dense case. ‘F’ order means faster to compute but on the other hand, it may slow down subsequent estimators.
Followings table consist the attributes used by PolynomialFeatures module
powers_ − array, shape (n_output_features, n_input_features)
It shows powers_ [i,j] is the exponent of the jth input in the ith output.
n_input_features _ − int
As name suggests, it gives the total number of input features.
n_output_features _ − int
As name suggests, it gives the total number of polynomial output features.
Following Python script uses PolynomialFeatures transformer to transform array of 8 into shape (4,2) −
from sklearn.preprocessing import PolynomialFeatures
import numpy as np
Y = np.arange(8).reshape(4, 2)
poly = PolynomialFeatures(degree=2)
poly.fit_transform(Y)
array(
[
[ 1., 0., 1., 0., 0., 1.],
[ 1., 2., 3., 4., 6., 9.],
[ 1., 4., 5., 16., 20., 25.],
[ 1., 6., 7., 36., 42., 49.]
]
)
The above sort of preprocessing i.e. transforming an input data matrix into a new data matrix of a given degree, can be streamlined with the Pipeline tools, which are basically used to chain multiple estimators into one.
The below python scripts using Scikit-learn’s Pipeline tools to streamline the preprocessing (will fit to an order-3 polynomial data).
#First, import the necessary packages.
from sklearn.preprocessing import PolynomialFeatures
from sklearn.linear_model import LinearRegression
from sklearn.pipeline import Pipeline
import numpy as np
#Next, create an object of Pipeline tool
Stream_model = Pipeline([('poly', PolynomialFeatures(degree=3)), ('linear', LinearRegression(fit_intercept=False))])
#Provide the size of array and order of polynomial data to fit the model.
x = np.arange(5)
y = 3 - 2 * x + x ** 2 - x ** 3
Stream_model = model.fit(x[:, np.newaxis], y)
#Calculate the input polynomial coefficients.
Stream_model.named_steps['linear'].coef_
array([ 3., -2., 1., -1.])
The above output shows that the linear model trained on polynomial features is able to recover the exact input polynomial coefficients.
11 Lectures
2 hours
PARTHA MAJUMDAR
Print
Add Notes
Bookmark this page | [
{
"code": null,
"e": 2303,
"s": 2221,
"text": "This chapter focusses on the polynomial features and pipelining tools in Sklearn."
},
{
"code": null,
"e": 2581,
"s": 2303,
"text": "Linear models trained on non-linear functions of data generally maintains the fast performance of linear methods. It also allows them to fit a much wider range of data. That’s the reason in machine learning such linear models, that are trained on nonlinear functions, are used."
},
{
"code": null,
"e": 2708,
"s": 2581,
"text": "One such example is that a simple linear regression can be extended by constructing polynomial features from the coefficients."
},
{
"code": null,
"e": 2817,
"s": 2708,
"text": "Mathematically, suppose we have standard linear regression model then for 2-D data it would look like this −"
},
{
"code": null,
"e": 2920,
"s": 2817,
"text": "Now, we can combine the features in second-order polynomials and our model will look like as follows −"
},
{
"code": null,
"e": 3076,
"s": 2920,
"text": "The above is still a linear model. Here, we saw that the resulting polynomial regression is in the same class of linear models and can be solved similarly."
},
{
"code": null,
"e": 3227,
"s": 3076,
"text": "To do so, scikit-learn provides a module named PolynomialFeatures. This module transforms an input data matrix into a new data matrix of given degree."
},
{
"code": null,
"e": 3301,
"s": 3227,
"text": "Followings table consist the parameters used by PolynomialFeatures module"
},
{
"code": null,
"e": 3331,
"s": 3301,
"text": "degree − integer, default = 2"
},
{
"code": null,
"e": 3384,
"s": 3331,
"text": "It represents the degree of the polynomial features."
},
{
"code": null,
"e": 3428,
"s": 3384,
"text": "interaction_only − Boolean, default = false"
},
{
"code": null,
"e": 3604,
"s": 3428,
"text": "By default, it is false but if set as true, the features that are products of most degree distinct input features, are produced. Such features are called interaction features."
},
{
"code": null,
"e": 3643,
"s": 3604,
"text": "include_bias − Boolean, default = true"
},
{
"code": null,
"e": 3728,
"s": 3643,
"text": "It includes a bias column i.e. the feature in which all polynomials powers are zero."
},
{
"code": null,
"e": 3769,
"s": 3728,
"text": "order − str in {‘C’, ‘F’}, default = ‘C’"
},
{
"code": null,
"e": 3937,
"s": 3769,
"text": "This parameter represents the order of output array in the dense case. ‘F’ order means faster to compute but on the other hand, it may slow down subsequent estimators."
},
{
"code": null,
"e": 4011,
"s": 3937,
"text": "Followings table consist the attributes used by PolynomialFeatures module"
},
{
"code": null,
"e": 4072,
"s": 4011,
"text": "powers_ − array, shape (n_output_features, n_input_features)"
},
{
"code": null,
"e": 4147,
"s": 4072,
"text": "It shows powers_ [i,j] is the exponent of the jth input in the ith output."
},
{
"code": null,
"e": 4172,
"s": 4147,
"text": "n_input_features _ − int"
},
{
"code": null,
"e": 4235,
"s": 4172,
"text": "As name suggests, it gives the total number of input features."
},
{
"code": null,
"e": 4261,
"s": 4235,
"text": "n_output_features _ − int"
},
{
"code": null,
"e": 4336,
"s": 4261,
"text": "As name suggests, it gives the total number of polynomial output features."
},
{
"code": null,
"e": 4439,
"s": 4336,
"text": "Following Python script uses PolynomialFeatures transformer to transform array of 8 into shape (4,2) −"
},
{
"code": null,
"e": 4600,
"s": 4439,
"text": "from sklearn.preprocessing import PolynomialFeatures\nimport numpy as np\nY = np.arange(8).reshape(4, 2)\npoly = PolynomialFeatures(degree=2)\npoly.fit_transform(Y)"
},
{
"code": null,
"e": 4757,
"s": 4600,
"text": "array(\n [\n [ 1., 0., 1., 0., 0., 1.],\n [ 1., 2., 3., 4., 6., 9.],\n [ 1., 4., 5., 16., 20., 25.],\n [ 1., 6., 7., 36., 42., 49.]\n ]\n)\n"
},
{
"code": null,
"e": 4978,
"s": 4757,
"text": "The above sort of preprocessing i.e. transforming an input data matrix into a new data matrix of a given degree, can be streamlined with the Pipeline tools, which are basically used to chain multiple estimators into one."
},
{
"code": null,
"e": 5113,
"s": 4978,
"text": "The below python scripts using Scikit-learn’s Pipeline tools to streamline the preprocessing (will fit to an order-3 polynomial data)."
},
{
"code": null,
"e": 5729,
"s": 5113,
"text": "#First, import the necessary packages.\nfrom sklearn.preprocessing import PolynomialFeatures\nfrom sklearn.linear_model import LinearRegression\nfrom sklearn.pipeline import Pipeline\nimport numpy as np\n\n#Next, create an object of Pipeline tool\nStream_model = Pipeline([('poly', PolynomialFeatures(degree=3)), ('linear', LinearRegression(fit_intercept=False))])\n\n#Provide the size of array and order of polynomial data to fit the model.\nx = np.arange(5)\ny = 3 - 2 * x + x ** 2 - x ** 3\nStream_model = model.fit(x[:, np.newaxis], y)\n\n#Calculate the input polynomial coefficients.\nStream_model.named_steps['linear'].coef_"
},
{
"code": null,
"e": 5757,
"s": 5729,
"text": "array([ 3., -2., 1., -1.])\n"
},
{
"code": null,
"e": 5893,
"s": 5757,
"text": "The above output shows that the linear model trained on polynomial features is able to recover the exact input polynomial coefficients."
},
{
"code": null,
"e": 5926,
"s": 5893,
"text": "\n 11 Lectures \n 2 hours \n"
},
{
"code": null,
"e": 5943,
"s": 5926,
"text": " PARTHA MAJUMDAR"
},
{
"code": null,
"e": 5950,
"s": 5943,
"text": " Print"
},
{
"code": null,
"e": 5961,
"s": 5950,
"text": " Add Notes"
}
] |
Git Branch Merge | We have the emergency fix ready, and so let's merge the master and emergency-fix branches.
First, we need to change to the master branch:
git checkout master
Switched to branch 'master'
Now we merge the current branch (master) with emergency-fix:
git merge emergency-fix
Updating 09f4acd..dfa79db
Fast-forward
index.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Since the emergency-fix branch came directly from master, and no other changes had been made to master while we were working, Git sees this as a continuation of master. So it can "Fast-forward", just pointing both master and emergency-fix to the same commit.
As master and emergency-fix are essentially the same now, we can delete emergency-fix, as it is no longer needed:
git branch -d emergency-fix
Deleted branch emergency-fix (was dfa79db).
Now we can move over to hello-world-images and keep working. Add another image file (img_hello_git.jpg) and change index.html, so it shows it:
git checkout hello-world-images
Switched to branch 'hello-world-images'
Now, we are done with our work here and can stage and commit for this branch:
git add --all
git commit -m "added new image"
[hello-world-images 1f1584e] added new image
2 files changed, 1 insertion(+)
create mode 100644 img_hello_git.jpg
We see that index.html has been changed in both branches. Now we are ready to merge hello-world-images into master. But what will
happen to the changes we recently made in master?
git checkout master
git merge hello-world-images
Auto-merging index.html
CONFLICT (content): Merge conflict in index.html
Automatic merge failed; fix conflicts and then commit the result.
The merge failed, as there is conflict between the versions for index.html. Let us check the status:
git status
On branch master
You have unmerged paths.
(fix conflicts and run "git commit")
(use "git merge --abort" to abort the merge)
Changes to be committed:
new file: img_hello_git.jpg
new file: img_hello_world.jpg
Unmerged paths:
(use "git add ..." to mark resolution)
both modified: index.html
This confirms there is a conflict in index.html, but the image files are ready and stagedto be committed.
So we need to fix that conflict. Open the file in our editor:
We can see the differences between the versions and edit it like we want:
Now we can stage index.html and check the status:
git add index.html
git status
On branch master
All conflicts fixed but you are still merging.
(use "git commit" to conclude merge)
Changes to be committed:
new file: img_hello_git.jpg
new file: img_hello_world.jpg
modified: index.html
The conflict has been fixed, and we can use commit to conclude the merge:
git commit -m "merged with hello-world-images after fixing conflicts"
[master e0b6038] merged with hello-world-images after fixing conflicts
And delete the hello-world-images branch:
git branch -d hello-world-images
Deleted branch hello-world-images (was 1f1584e).
Now you have a better understanding of how branches and merging works. Time to start working with a remote repository!
Merge the hello-you branch with the current branch:
git hello-you
Start the Exercise
We just launchedW3Schools videos
Get certifiedby completinga course today!
If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:
[email protected]
Your message has been sent to W3Schools. | [
{
"code": null,
"e": 91,
"s": 0,
"text": "We have the emergency fix ready, and so let's merge the master and emergency-fix branches."
},
{
"code": null,
"e": 138,
"s": 91,
"text": "First, we need to change to the master branch:"
},
{
"code": null,
"e": 186,
"s": 138,
"text": "git checkout master\nSwitched to branch 'master'"
},
{
"code": null,
"e": 247,
"s": 186,
"text": "Now we merge the current branch (master) with emergency-fix:"
},
{
"code": null,
"e": 376,
"s": 247,
"text": "git merge emergency-fix\nUpdating 09f4acd..dfa79db\nFast-forward\n index.html | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)"
},
{
"code": null,
"e": 635,
"s": 376,
"text": "Since the emergency-fix branch came directly from master, and no other changes had been made to master while we were working, Git sees this as a continuation of master. So it can \"Fast-forward\", just pointing both master and emergency-fix to the same commit."
},
{
"code": null,
"e": 749,
"s": 635,
"text": "As master and emergency-fix are essentially the same now, we can delete emergency-fix, as it is no longer needed:"
},
{
"code": null,
"e": 821,
"s": 749,
"text": "git branch -d emergency-fix\nDeleted branch emergency-fix (was dfa79db)."
},
{
"code": null,
"e": 964,
"s": 821,
"text": "Now we can move over to hello-world-images and keep working. Add another image file (img_hello_git.jpg) and change index.html, so it shows it:"
},
{
"code": null,
"e": 1036,
"s": 964,
"text": "git checkout hello-world-images\nSwitched to branch 'hello-world-images'"
},
{
"code": null,
"e": 1114,
"s": 1036,
"text": "Now, we are done with our work here and can stage and commit for this branch:"
},
{
"code": null,
"e": 1276,
"s": 1114,
"text": "git add --all\ngit commit -m \"added new image\"\n[hello-world-images 1f1584e] added new image\n 2 files changed, 1 insertion(+)\n create mode 100644 img_hello_git.jpg"
},
{
"code": null,
"e": 1457,
"s": 1276,
"text": "We see that index.html has been changed in both branches. Now we are ready to merge hello-world-images into master. But what will \nhappen to the changes we recently made in master?"
},
{
"code": null,
"e": 1645,
"s": 1457,
"text": "git checkout master\ngit merge hello-world-images\nAuto-merging index.html\nCONFLICT (content): Merge conflict in index.html\nAutomatic merge failed; fix conflicts and then commit the result."
},
{
"code": null,
"e": 1746,
"s": 1645,
"text": "The merge failed, as there is conflict between the versions for index.html. Let us check the status:"
},
{
"code": null,
"e": 2083,
"s": 1746,
"text": "git status\nOn branch master\nYou have unmerged paths.\n (fix conflicts and run \"git commit\")\n (use \"git merge --abort\" to abort the merge)\n\nChanges to be committed:\n new file: img_hello_git.jpg\n new file: img_hello_world.jpg\n\nUnmerged paths:\n (use \"git add ...\" to mark resolution)\n both modified: index.html"
},
{
"code": null,
"e": 2189,
"s": 2083,
"text": "This confirms there is a conflict in index.html, but the image files are ready and stagedto be committed."
},
{
"code": null,
"e": 2251,
"s": 2189,
"text": "So we need to fix that conflict. Open the file in our editor:"
},
{
"code": null,
"e": 2325,
"s": 2251,
"text": "We can see the differences between the versions and edit it like we want:"
},
{
"code": null,
"e": 2375,
"s": 2325,
"text": "Now we can stage index.html and check the status:"
},
{
"code": null,
"e": 2643,
"s": 2375,
"text": "git add index.html\ngit status\nOn branch master\nAll conflicts fixed but you are still merging.\n (use \"git commit\" to conclude merge)\n\nChanges to be committed:\n new file: img_hello_git.jpg\n new file: img_hello_world.jpg\n modified: index.html"
},
{
"code": null,
"e": 2717,
"s": 2643,
"text": "The conflict has been fixed, and we can use commit to conclude the merge:"
},
{
"code": null,
"e": 2858,
"s": 2717,
"text": "git commit -m \"merged with hello-world-images after fixing conflicts\"\n[master e0b6038] merged with hello-world-images after fixing conflicts"
},
{
"code": null,
"e": 2900,
"s": 2858,
"text": "And delete the hello-world-images branch:"
},
{
"code": null,
"e": 2982,
"s": 2900,
"text": "git branch -d hello-world-images\nDeleted branch hello-world-images (was 1f1584e)."
},
{
"code": null,
"e": 3101,
"s": 2982,
"text": "Now you have a better understanding of how branches and merging works. Time to start working with a remote repository!"
},
{
"code": null,
"e": 3153,
"s": 3101,
"text": "Merge the hello-you branch with the current branch:"
},
{
"code": null,
"e": 3168,
"s": 3153,
"text": "git hello-you"
},
{
"code": null,
"e": 3188,
"s": 3168,
"text": "\nStart the Exercise"
},
{
"code": null,
"e": 3221,
"s": 3188,
"text": "We just launchedW3Schools videos"
},
{
"code": null,
"e": 3263,
"s": 3221,
"text": "Get certifiedby completinga course today!"
},
{
"code": null,
"e": 3370,
"s": 3263,
"text": "If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:"
},
{
"code": null,
"e": 3389,
"s": 3370,
"text": "[email protected]"
}
] |
Precedence Graph in Operating System - GeeksforGeeks | 05 Jun, 2020
Prerequisite – Process SynchronizationPrecedence Graph is a directed acyclic graph which is used to show the execution level of several processes in operating system. It consists of nodes and edges. Nodes represent the processes and the edges represent the flow of execution.
Properties of Precedence Graph :Following are the properties of Precedence Graph:
It is a directed graph.
It is an acyclic graph.
Nodes of graph correspond to individual statements of program code.
Edge between two nodes represents the execution order.
A directed edge from node A to node B shows that statement A executes first and then Statement B executes.
Consider he following code:
S1 : a = x + y;
S2 : b = z + 1;
S3 : c = a - b;
S4 : w = c + 1;
If above code is executed concurrently, the following precedence relations exist:
c = a – b cannot be executed before both a and b have been assigned values.
w = c + 1 cannot be executed before the new values of c has been computed.
The statements a = x + y and b = z + 1 could be executed concurrently.
Example:Consider the following precedence relations of a program:
S2 and S3 can be executed after S1 completes.S4 can be executed after S2 completes.S5 and S6 can be executed after S4 completes.S7 can be executed after S5, S6 and S3 complete.
S2 and S3 can be executed after S1 completes.
S4 can be executed after S2 completes.
S5 and S6 can be executed after S4 completes.
S7 can be executed after S5, S6 and S3 complete.
Solution:
Process Synchronization
GATE CS
Operating Systems
Operating Systems
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Difference between Clustered and Non-clustered index
Phases of a Compiler
Preemptive and Non-Preemptive Scheduling
Differences between IPv4 and IPv6
Introduction of Process Synchronization
Banker's Algorithm in Operating System
Program for FCFS CPU Scheduling | Set 1
Program for Round Robin scheduling | Set 1
Paging in Operating System
Program for Shortest Job First (or SJF) CPU Scheduling | Set 1 (Non- preemptive) | [
{
"code": null,
"e": 24377,
"s": 24349,
"text": "\n05 Jun, 2020"
},
{
"code": null,
"e": 24653,
"s": 24377,
"text": "Prerequisite – Process SynchronizationPrecedence Graph is a directed acyclic graph which is used to show the execution level of several processes in operating system. It consists of nodes and edges. Nodes represent the processes and the edges represent the flow of execution."
},
{
"code": null,
"e": 24735,
"s": 24653,
"text": "Properties of Precedence Graph :Following are the properties of Precedence Graph:"
},
{
"code": null,
"e": 24759,
"s": 24735,
"text": "It is a directed graph."
},
{
"code": null,
"e": 24783,
"s": 24759,
"text": "It is an acyclic graph."
},
{
"code": null,
"e": 24851,
"s": 24783,
"text": "Nodes of graph correspond to individual statements of program code."
},
{
"code": null,
"e": 24906,
"s": 24851,
"text": "Edge between two nodes represents the execution order."
},
{
"code": null,
"e": 25013,
"s": 24906,
"text": "A directed edge from node A to node B shows that statement A executes first and then Statement B executes."
},
{
"code": null,
"e": 25041,
"s": 25013,
"text": "Consider he following code:"
},
{
"code": null,
"e": 25106,
"s": 25041,
"text": "S1 : a = x + y;\nS2 : b = z + 1;\nS3 : c = a - b;\nS4 : w = c + 1;\n"
},
{
"code": null,
"e": 25188,
"s": 25106,
"text": "If above code is executed concurrently, the following precedence relations exist:"
},
{
"code": null,
"e": 25264,
"s": 25188,
"text": "c = a – b cannot be executed before both a and b have been assigned values."
},
{
"code": null,
"e": 25339,
"s": 25264,
"text": "w = c + 1 cannot be executed before the new values of c has been computed."
},
{
"code": null,
"e": 25410,
"s": 25339,
"text": "The statements a = x + y and b = z + 1 could be executed concurrently."
},
{
"code": null,
"e": 25476,
"s": 25410,
"text": "Example:Consider the following precedence relations of a program:"
},
{
"code": null,
"e": 25653,
"s": 25476,
"text": "S2 and S3 can be executed after S1 completes.S4 can be executed after S2 completes.S5 and S6 can be executed after S4 completes.S7 can be executed after S5, S6 and S3 complete."
},
{
"code": null,
"e": 25699,
"s": 25653,
"text": "S2 and S3 can be executed after S1 completes."
},
{
"code": null,
"e": 25738,
"s": 25699,
"text": "S4 can be executed after S2 completes."
},
{
"code": null,
"e": 25784,
"s": 25738,
"text": "S5 and S6 can be executed after S4 completes."
},
{
"code": null,
"e": 25833,
"s": 25784,
"text": "S7 can be executed after S5, S6 and S3 complete."
},
{
"code": null,
"e": 25843,
"s": 25833,
"text": "Solution:"
},
{
"code": null,
"e": 25867,
"s": 25843,
"text": "Process Synchronization"
},
{
"code": null,
"e": 25875,
"s": 25867,
"text": "GATE CS"
},
{
"code": null,
"e": 25893,
"s": 25875,
"text": "Operating Systems"
},
{
"code": null,
"e": 25911,
"s": 25893,
"text": "Operating Systems"
},
{
"code": null,
"e": 26009,
"s": 25911,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 26062,
"s": 26009,
"text": "Difference between Clustered and Non-clustered index"
},
{
"code": null,
"e": 26083,
"s": 26062,
"text": "Phases of a Compiler"
},
{
"code": null,
"e": 26124,
"s": 26083,
"text": "Preemptive and Non-Preemptive Scheduling"
},
{
"code": null,
"e": 26158,
"s": 26124,
"text": "Differences between IPv4 and IPv6"
},
{
"code": null,
"e": 26198,
"s": 26158,
"text": "Introduction of Process Synchronization"
},
{
"code": null,
"e": 26237,
"s": 26198,
"text": "Banker's Algorithm in Operating System"
},
{
"code": null,
"e": 26277,
"s": 26237,
"text": "Program for FCFS CPU Scheduling | Set 1"
},
{
"code": null,
"e": 26320,
"s": 26277,
"text": "Program for Round Robin scheduling | Set 1"
},
{
"code": null,
"e": 26347,
"s": 26320,
"text": "Paging in Operating System"
}
] |
A Neanderthal’s Guide to Apache Spark in Python | by Evan Heitman | Towards Data Science | If you’re anything like me, you heard about a fancy-sounding technology called Spark and wanted to test your coding mettle to see if you could add another tool to your data-science toolkit. Hopefully you’re not exactly like me because in my case I promptly hit an installation wall, and then a terminology wall, and then a conceptual wall, and four hours later, I hadn’t written a single line of code. And so, after hours of scouring the internet, and more so-called “beginner’s guides” than I care to mention, I decided to write a “neanderthal’s guide” to hopefully spare you some of the hassle that I endured.
Even a quick search online for learning material on Spark will leave you swimming in documentation, online courses (many of which are not cheap), and a menagerie of other resources. From my experience, the majority of these either assumed I knew too much about distributed computing (like assuming I knew what distributed computing meant for example), or they gave high-level or background information without helping me understand how to actually implement anything in Spark.
With that in mind, in this guide I try to do my best to either explain a concept, or direct you somewhere else with an explanation, all with the goal of getting you writing Spark code as quickly as possible. Because I try to do this for as many topics pertaining to Spark as I can, feel free to jump around if you already have a decent grasp of a particular topic. I’ll also try to leave you with links to resources that I found helpful as I was diving into Spark.
This is the structure of the guide: I start by explaining some key terminology (i.e. jargon) and concepts so we can be on the same page for the rest of the material and also to lower the barrier to entry to the external resources on Spark you’ll find here and elsewhere. Next, I walk through getting a working version of Spark running on your machine using Google Colab. And finally I go through a use case to demonstrate how PySpark is actually implemented and what a first pass through an example problem looks like.
Enough terminology and concepts to be able to read other Spark resources without being perpetually confused
A relatively painless way to get PySpark running on your computer
How to get started with data exploration in PySpark
Building and evaluating a basic linear regression model in PySpark
Helpful external resources for the majority of material covered here
Here is a list of various terms and concepts that will be helpful to know as you delve into the world of Spark.
If you’ve Googled “what is Spark”, there’s a chance you’ve run into the following description, or something like it: “Spark is a general-purpose distributed data processing engine”. Without a background in Spark or any familiarity with what those terms mean, that definition is rather unhelpful. So let’s break it down:
Distributed Data/Distributed Computing — Apache Spark operates in a world that is slightly different from run-of-the-mill computer science. When datasets get too big, or when new data comes in too fast, it can become too much for a single computer to handle. This is where distributed computing comes in. Instead of trying to process a huge dataset or run super computationally-expensive programs on one computer, these tasks can be divided between multiple computers that communicate with each other to produce an output. This technology has some serious benefits, but allocating processing tasks across multiple computers has its own set of challenges and can’t be structured the same way as normal processing. When Spark says it has to do with distributed data, this means that it is designed to deal with very large datasets and to process them on a distributed computing system.
NOTE: In a distributed computing system, each individual computer is called a node and the collection of all of them is called a cluster
Further Reading — Introduction to distributed computing (8 min read)
Processing Engine/Processing Framework — A processing engine, sometimes called a processing framework, is responsible for performing data processing tasks (an illuminating explanation, I know). A comparison is probably the best way to understand this. Apache Hadoop is an open source software platform that also deals with “Big Data” and distributed computing. Hadoop has a processing engine, distinct from Spark, called MapReduce. MapReduce has its own particular way of optimizing tasks to be processed on multiple nodes and Spark has a different way. One of Sparks strengths is that it is a processing engine that can be used on its own, or used in place of Hadoop MapReduce, taking advantage of the other features of Hadoop.
Further Reading — Processing Engines explained and compared (~10 min read)
General-Purpose — One of the main advantages of Spark is how flexible it is, and how many application domains it has. It supports Scala, Python, Java, R, and SQL. It has a dedicated SQL module, it is able to process streamed data in real-time, and it has both a machine learning library and graph computation engine built on top of it. All these reasons contribute to why Spark has become one of the most popular processing engines in the realm of Big Data.
Further Reading — 5 minute guide to understanding the significance of Spark (probably more like ~10 min read)
Partitioned Data — When working with a computer cluster, you can’t just throw in a vanilla dataframe and expect it to know what to do. Because the processing tasks will be divided across multiple nodes, the data also has to be able to be divided across multiple nodes. Partitioned data refers to data that has been optimized to be able to be processed on multiple nodes.
Further Reading — Explanation of Data Partitioning (2 min read)
Fault Tolerance — In short, fault tolerance refers to a distributed system’s ability to continue working properly even when a failure occurs. A failure could be a node bursting into flames for example, or just a communication breakdown between nodes. Fault tolerance in Spark revolves around Spark’s RDDs (which will be discussed later). Basically, the way data storage is handled in Spark allows Spark programs to function properly despite occurences of failure.
Further Reading — How is Spark fault tolerant (~1 min read)
Lazy Evaluation — Lazy evaluation, or lazy computing, has to do with how code is compiled. When a compiler that is not lazy (which is called strict evaluation) compiles code, it sequentially evaluates each expression it comes across. A lazy compiler on the other hand, doesn’t continually evaluate expressions, but rather, waits until it is actually told to generate a result, and then performs all the evaluation all at once. So as it compiles code, it keeps track of everything it will eventually have to evaluate (in Spark this kind of evaluation log, so to speak, is called a lineage graph), and then whenever it is prompted to return something, it performs evaluations according to what it has in its evaluation log. This is useful because it makes programs more efficient as the compiler doesn’t have to evaluate anything that isn’t actually used.
Further Reading — What is Lazy Evaluation (4 min read)
RDDs, DataFrames, DataSets, Oh My! — Spark RDDs (Resilient Distributed Datasets) are data structures that are the core building blocks of Spark. A RDD is an immutable, partitioned collection of records, which means that it can hold values, tuples, or other objects, these records are partitioned so as to be processed on a distributed system, and that once an RDD has been made, it is impossible to alter it. That basically sums up its acronym: they are resilient due to their immutability and lineage graphs (which will be discussed shortly), they can be distributed due to their partitions, and they are datasets because, well, they hold data. A crucial thing to note is that RDDs do not have a schema, which means that they do not have a columnar structure. Records are just recorded row-by-row, and are displayed similar to a list. Enter Spark DataFrames. Not to be confused with Pandas DataFrames, as they are distinct, Spark DataFrame have all of the features of RDDs but also have a schema. This will make them our data structure of choice for getting started with PySpark.Spark has another data structure, Spark DataSets. These are similar to DataFrames but are strongly-typed, meaning that the type is specified upon the creation of the DataSet and is not inferred from the type of records stored in it. This means DataSets are not used in PySpark because Python is a dynamically-typed language. For the rest of these explanations I’ll be referring to RDDs but know that what is true for an RDD is also true for a DataFrame, DataFrames are just organized into a columnar structure.
Further Reading — RDDs, DataFrames, & DataSets compared (~5 min read)Further Reading — Pandas v. Spark DataFrames (4 min read)Further Reading — Helpful RDD Documentation (~5 min read)
Transformations — Transformations are one of the things you can do to an RDD in Spark. They are lazy operations that create one or more new RDDs. It’s important to note that Transformations create new RDDs because, remember, RDDs are immutable so they can’t be altered in any way once they’ve been created. So, in essence, Transformations take an RDD as an input and perform some function on them based on what Transformation is being called, and outputs one or more RDDs. Recalling the section on lazy evaluation, as a compiler comes across each Transformation, it doesn’t actually build any new RDDs, but rather constructs a chain of hypothetical RDDs that would result from those Transformations which will only be evaluated once an Action is called. This chain of hypothetical, or “child”, RDDs, all connected logically back to the original “parent” RDD, is what a lineage graph is.
Further Reading — Helpful Transformation Documentation (~2 min read) Further Reading — More in-depth Documentation (5–10 min read; Transformations in first half)
Actions — An Action is any RDD operation that does not produce an RDD as an output. Some examples of common Actions are doing a count of the data, or finding the max or min, or returning the first element of an RDD, etc. As was mentioned before, an Action is the cue to the compiler to evaluate the lineage graph and return the value specified by the Action.
Further Reading — Helpful Action Documentation (~1 min read)Further Reading — More in-depth Documentation (~5 min read; Actions in second half)
Lineage Graph — Most of what a lineage graph is was described in the Transformations and Actions sections, but to summarize, a lineage graph outlines what is called a “logical execution plan”. What that means is that the compiler begins with the earliest RDDs that aren’t dependent on any other RDDs, and follows a logical chain of Transformations until it ends with the RDD that an Action is called on. This feature is primarily what drives Spark’s fault tolerance. If a node fails for some reason, all the information about what that node was supposed to be doing is stored in the lineage graph, which can be replicated elsewhere.
Further Reading — Helpful Lineage Documentation (~2 min read)
Spark Applications and Jobs — There is a lot of nitty gritty when it comes to how a processing engine like Spark actually executes processing tasks on a distributed system. The following is just as much as you’ll need to know in order to have a working understanding of what certain snippets of Spark code do. In Spark, when an item of processing has to be done, there is a “driver” process that is in charge of taking the user’s code and converting it into a set of multiple tasks. There are also “executor” processes, each operating on a separate node in the cluster, that are in charge of running the tasks, as delegated by the driver. Each driver process has a set of executors that it has access to in order to run tasks. A Spark application is a user built program that consists of a driver and that driver’s associated executors. A Spark job is task or set of tasks to be executed with executor processes, as directed by the driver. A job is triggered by the calling of an RDD Action. This stuff can be rather confusing, so don’t sweat it if it doesn’t make total sense at first, it’s just helpful to be familiar with these terms when they are implemented in code later on. I’ve included extra resources on this topic if you want more information.
Further Reading — Cluster Mode Overview from Spark API (~3 min read)Further Reading — Helpful Answer on StackOverflow (~2 min read)Further Reading — Spark Application Overview on Cloudera (~2 min read)
Phew you made it through all the terminology and concepts! Now let’s get into implementation!
That heading might be a bit of a misnomer, because, strictly speaking, this guide won’t show you how to install Apache Spark. Installing Spark can be a pain in the butt. For one, writing Spark applications can be done in multiple languages and each one is installed slightly differently. The underlying API for Spark is written in Scala but PySpark is an overlying API for implementation in Python. For data science applications, using PySpark and Python is widely recommended over Scala, because it is relatively easier to implement. And so instead of installing PySpark, this guide will show you how to run it in Google Colab.
When I was trying to get PySpark running on my computer, I kept getting conflicting instructions on where to download it from (it can be downloaded from spark.apache.org or pip installed for example), what to run it in (it can be run in Jupyter Notebooks or in the native pyspark shell in the command line), and there were numerous obscure bash commands sprinkled throughout. As a data scientist, my reaction to bash commands that aren’t pip installs is generally a mix of disgust and despair, and so I turned to Google Colab.
Google Colab is a really powerful interactive python notebook (.ipynb) tool that has a lot data science libraries pre-installed. For more information on what it is and how to run it check out this super helpful article (8 min read).
Once you’ve got a Colab notebook up, to get Spark running you have to run the following block of code (I know it’s not my fault, but I apologize for how ugly it is).
!apt-get install openjdk-8-jdk-headless -qq > /dev/null!wget -q https://www-us.apache.org/dist/spark/spark-2.4.3/spark-2.4.3-bin-hadoop2.7.tgz!tar xf spark-2.4.3-bin-hadoop2.7.tgz!pip install -q findsparkimport osos.environ["JAVA_HOME"] = "/usr/lib/jvm/java-8-openjdk-amd64"os.environ["SPARK_HOME"] = "/content/spark-2.4.3-bin-hadoop2.7"import findsparkfindspark.init()
NOTE: When I first ran this block of code it did not run. It was because there had been a new version of Spark released since the code I found was written and I was trying to access an older version of Spark that couldn’t be found. So if the above code doesn’t run, double check this website to see what the latest version of Spark is and replace everywhere you see “2.4.3” in the above snippet to whatever the newest version is.
Basically what this block of code does is download the right versions of Java (Spark uses some Java) and Spark, set the PATH to those versions, and to initialize Spark in your notebook.
If you want to use Spark on another platform besides Colab, here are the most helpful guides I found (in order of helpfulness), hopefully one of them is able to get you going:
Installation Resource— Getting Started with PySpark and JupyterInstallation Resource — How to use PySpark on your computerInstallation Resource — How to install PySpark locallyInstallation Resource — How to Get Started with PySpark
Because we want to be working with columnar data, we’ll be using DataFrames which are a part of Spark SQL.
NOTE: To avoid possible confusion, despite the fact that we will be working with Spark SQL, none of this will be SQL code. You can write SQL queries when working with Spark DataFrames but you don’t have to.
The entry point to using Spark SQL is an object called SparkSession. It initiates a Spark Application which all the code for that Session will run on.
from pyspark.sql import SparkSessionspark = SparkSession.builder \ .master("local[*]") \ .appName("Learning_Spark") \ .getOrCreate()
NOTE: the “ \” character is this context is called a continuation character which is just a helpful wrapping tool for making long lines of code more readable.
.builder — gives access to Builder API which is used to configure the session .
.master() — determines where the program will run; "local[*]" sets it to run locally on all cores but you can use "local[1]" to run on one core for example. In this case, our programs will be run on Google’s servers.
.appName() — optional method to name the Spark Application
.getOrCreate() — gets an existing SparkSession or creates new one if none exists
Check the Builder API for more options when building a SparkSession.
To open a local file on Google Colab you need to run the following code which will prompt you to select a file from your computer:
from google.colab import filesfiles.upload()
For this guide we’ll be working with a dataset on video game sales from Kaggle. It can be found here.
Now load our data into a Spark DataFrame using the .read.csv() function: (I shortened the file name for brevity’s sake)
data = spark.read.csv('Video_Games_Sales.csv',inferSchema=True, header=True)
NOTE: This function is specifically for reading CSV files into a DataFrame in PySparkSQL. It won’t work for loading data into an RDD and different languages (besides Python) have different syntax. Exercise caution when searching online for help because many resources do not assume Spark SQL or Python.
Now let’s move into understanding how we can get more familiar with our data!
The first thing we can do is check the shape of of our DataFrame. Unlike Pandas, there is no dedicated method for this but we can use the .count() and .columns() to retrieve the information ourselves.
data.count(), len(data.columns)>>> (16719, 16)
The .count() method returns the number of rows in the DataFrame and .columns returns a list of column names.
NOTE: We don’t have to actually print them because Colab will automatically display the last output of each cell. If you want to show more than one output you will have to print them (unless you use this workaround, which is super nice and works in Jupyter Notebooks as well)
Viewing DataFramesTo view a DataFrame, use the .show() method:
data.show(5)
As you can see, running data.show(5) displayed the first 5 rows of our DataFrame, along with the header. Calling .show() with no parameters will return the first 20 records.
Let’s see what our data is comprised of using the .printSchema() method (alternatively you can use .dtypes):
data.printSchema()
Some takeaways from this output is that Year_of_Release and User_Score have a type of string, despite them being numbers. It also tells us that each of the columns allows null values which can be seen in the first 5 rows.
We can also selectively choose which columns we want to display with the .select() method. Let’s view only Name, Platform, User_Score, and User_Count:
data.select("Name","Platform","User_Score","User_Count") \.show(15, truncate=False)
Included is the truncate=False parameter that adjusts the size of columns to prevent values from being cut off.
Summary Statistics/InformationWe can use the .describe() method to get summary statistics on columns of our choosing:
data.describe(["User_Score","User_Count"]).show()
Some takeaways from this output is that there sees to a strange “tbd” value in the User_Score column. The count for User_Score is also higher than User_Count but it’s hard to tell if that’s because there are actually more values in User_Score or if “tbd” values are artificially raising the count. We’ll learn how to filter those values out later on.
We might also want to get some information on what kinds of platforms are in the Platform column and how they are distributed. We can use a groupBy() for this and sort it using .orderBy():
data.groupBy("Platform") \.count() \.orderBy("count", ascending=False) \.show(10)
Here we’re looking at the top 10 most frequent platforms. We can tell this dataset is pretty old because I don’t see PS4 anywhere 🤔
Filtering DataFramesLets create a new DataFrame that has the null values for User_Score and User_Count, and the “tbd” values filtered out using the .filter() method:
condition1 = (data.User_Score.isNotNull()) | (data.User_Count.isNotNull())condition2 = data.User_Score != "tbd"data = data.filter(condition1).filter(condition2)
condition1 returns True for any record that does not have a null value in User_Score or in User_Count. condition2 returns True for any record that does not have “tbd” in User_Score.
We can double check to see if our filtering worked by reconstructing our earlier visualizations
That’s enough Data Exploration to get started, now lets build a model!
Building models in PySpark looks a little different than you might be used to, and you’ll see terms like Transformer, Estimator, and Param. This guide won’t go in-depth into what those terms mean but below is a link to a brief description of what they mean.
Further Reading — Machine Learning in Spark (~5–10 min read)
SetupFor an example of linear regression, let’s see if we can predict User_Score from Year_of_Release, Global_Sales, Critic_Score, and User_Count.
First let’s recode all of our predictors to be Doubles (I found that this got rid of some really gnarly errors later on).
from pyspark.sql.types import DoubleTypedata2 = data2.withColumn("Year_of_Release", data2["Year_of_Release"].cast(DoubleType()))data2 = data2.withColumn("User_Score", data2["User_Score"].cast(DoubleType()))data2 = data2.withColumn("User_Count", data2["User_Count"].cast(DoubleType()))data2 = data2.withColumn("Critic_Score", data2["Critic_Score"].cast(DoubleType()))
We use the method withColumn(), which either creates a new column or replaces one that already exists. So, for example, the Year_of_Release column is replaced with a version of itself that has been cast as doubles .
VectorAssemblerThe next step is to get our data into a form that PySpark can create a model with. To do this we use something called a VectorAssembler.
from pyspark.ml.feature import VectorAssemblerinputcols = ["Year_of_Release", "Global_Sales", "Critic_Score", "User_Count"]assembler = VectorAssembler(inputCols= inputcols, outputCol = "predictors")
Here we’ve delineated what features we want our model to use as predictors so that VectorAssembler can take those columns and transform them into a single column (named “predictors”) that contains all the data we want to predict with.
predictors = assembler.transform(data)predictors.columns
What VectorAssembler.transform() does is create a new DataFrame with a new column at the end where each row contains a list of all the features we included in the inputCols parameter when we created the assembler.
The final step to getting our data ready to be used in a model is to collect the new predictions column we just made and User_Score (our target variable) by themselves in a DataFrame.
model_data = predictors.select("predictors", "User_Score")model_data.show(5,truncate=False)
Next is to split model_data into a training and testing set:
train_data,test_data = model_data.randomSplit([0.8,0.2])
Model TrainingNow to train the model!
from pyspark.ml.regression import LinearRegressionlr = LinearRegression( featuresCol = 'predictors', labelCol = 'User_Score')lrModel = lr.fit(train_data)pred = lrModel.evaluate(test_data)
After importing LinearRegression from pyspark.ml.regression, we construct a regressor and we specify that it should look for a column named “predictors” as the features of the model and a column named “User_Score” as the labels of the model. Next we train it with .fit() and finally produce predictions with .evaluate().
We can access the parameters of our model with the following code
lrModel.coefficients>>>[-0.07872176891379576,-0.0350439561719371,0.06376305861102288,-0.0002156086537632538]lrModel.intercept>>> 160.7985254457876
We can also view the final predictions our model made:
pred.predictions.show(5)
The object named “pred” is a LinearRegressionSummary object and so to retrieve the DataFrame with predictions we call .predictions.show()
Model EvaluatingTo get more detailed information on how our model performed, we can use RegressionEvaluator which is constructed like this:
from pyspark.ml.evaluation import RegressionEvaluatoreval = RegressionEvaluator( labelCol="User_Score", predictionCol="prediction", metricName="rmse")
Let’s compute some statistics for the model:
rmse = eval.evaluate(pred.predictions)mse = eval.evaluate(pred.predictions, {eval.metricName: "mse"})mae = eval.evaluate(pred.predictions, {eval.metricName: "mae"})r2 = eval.evaluate(pred.predictions, {eval.metricName: "r2"})
Which returns
rmse>>> 1.125mse>>> 1.266mae>>> 0.843r2>>> 0.386
From this we can interpret that our model tended to be about 1.125 rating points off from the actual User_Score (according to rmse). The r2 value for tells us that the predictors in our model are able to account for a little under 40% of the total variability in User_Score. This was just a first pass look, and I recommend playing around with the model parameters and features for more practice!
Further Reading — Detailed Code example of Linear Regression (~20+ min to go through the whole thing)Further Reading — Detailed Code example of Logistic Regression using SQL (~10 minutes)Further Reading — Example of Linear Regression, Decision Tree, and Gradient-Boosted Tree Regression (6 min read)
This is just the tip of the iceberg as far as the kind of modeling you can do in PySpark, but I hope this guide has equipped you with enough to get your foot into the door of Big Data!
Wow. Props to you if you made it all the way to the end. You were exposed to a ton of new concepts, from the terminology of distributed computing and Spark, to implementing data exploration and data modeling techniques in PySpark. My hope is that this guide can be a resource for you as you continue working with Spark!
All the code used in this article can be found on GitHub here. | [
{
"code": null,
"e": 784,
"s": 172,
"text": "If you’re anything like me, you heard about a fancy-sounding technology called Spark and wanted to test your coding mettle to see if you could add another tool to your data-science toolkit. Hopefully you’re not exactly like me because in my case I promptly hit an installation wall, and then a terminology wall, and then a conceptual wall, and four hours later, I hadn’t written a single line of code. And so, after hours of scouring the internet, and more so-called “beginner’s guides” than I care to mention, I decided to write a “neanderthal’s guide” to hopefully spare you some of the hassle that I endured."
},
{
"code": null,
"e": 1261,
"s": 784,
"text": "Even a quick search online for learning material on Spark will leave you swimming in documentation, online courses (many of which are not cheap), and a menagerie of other resources. From my experience, the majority of these either assumed I knew too much about distributed computing (like assuming I knew what distributed computing meant for example), or they gave high-level or background information without helping me understand how to actually implement anything in Spark."
},
{
"code": null,
"e": 1726,
"s": 1261,
"text": "With that in mind, in this guide I try to do my best to either explain a concept, or direct you somewhere else with an explanation, all with the goal of getting you writing Spark code as quickly as possible. Because I try to do this for as many topics pertaining to Spark as I can, feel free to jump around if you already have a decent grasp of a particular topic. I’ll also try to leave you with links to resources that I found helpful as I was diving into Spark."
},
{
"code": null,
"e": 2245,
"s": 1726,
"text": "This is the structure of the guide: I start by explaining some key terminology (i.e. jargon) and concepts so we can be on the same page for the rest of the material and also to lower the barrier to entry to the external resources on Spark you’ll find here and elsewhere. Next, I walk through getting a working version of Spark running on your machine using Google Colab. And finally I go through a use case to demonstrate how PySpark is actually implemented and what a first pass through an example problem looks like."
},
{
"code": null,
"e": 2353,
"s": 2245,
"text": "Enough terminology and concepts to be able to read other Spark resources without being perpetually confused"
},
{
"code": null,
"e": 2419,
"s": 2353,
"text": "A relatively painless way to get PySpark running on your computer"
},
{
"code": null,
"e": 2471,
"s": 2419,
"text": "How to get started with data exploration in PySpark"
},
{
"code": null,
"e": 2538,
"s": 2471,
"text": "Building and evaluating a basic linear regression model in PySpark"
},
{
"code": null,
"e": 2607,
"s": 2538,
"text": "Helpful external resources for the majority of material covered here"
},
{
"code": null,
"e": 2719,
"s": 2607,
"text": "Here is a list of various terms and concepts that will be helpful to know as you delve into the world of Spark."
},
{
"code": null,
"e": 3039,
"s": 2719,
"text": "If you’ve Googled “what is Spark”, there’s a chance you’ve run into the following description, or something like it: “Spark is a general-purpose distributed data processing engine”. Without a background in Spark or any familiarity with what those terms mean, that definition is rather unhelpful. So let’s break it down:"
},
{
"code": null,
"e": 3923,
"s": 3039,
"text": "Distributed Data/Distributed Computing — Apache Spark operates in a world that is slightly different from run-of-the-mill computer science. When datasets get too big, or when new data comes in too fast, it can become too much for a single computer to handle. This is where distributed computing comes in. Instead of trying to process a huge dataset or run super computationally-expensive programs on one computer, these tasks can be divided between multiple computers that communicate with each other to produce an output. This technology has some serious benefits, but allocating processing tasks across multiple computers has its own set of challenges and can’t be structured the same way as normal processing. When Spark says it has to do with distributed data, this means that it is designed to deal with very large datasets and to process them on a distributed computing system."
},
{
"code": null,
"e": 4060,
"s": 3923,
"text": "NOTE: In a distributed computing system, each individual computer is called a node and the collection of all of them is called a cluster"
},
{
"code": null,
"e": 4129,
"s": 4060,
"text": "Further Reading — Introduction to distributed computing (8 min read)"
},
{
"code": null,
"e": 4858,
"s": 4129,
"text": "Processing Engine/Processing Framework — A processing engine, sometimes called a processing framework, is responsible for performing data processing tasks (an illuminating explanation, I know). A comparison is probably the best way to understand this. Apache Hadoop is an open source software platform that also deals with “Big Data” and distributed computing. Hadoop has a processing engine, distinct from Spark, called MapReduce. MapReduce has its own particular way of optimizing tasks to be processed on multiple nodes and Spark has a different way. One of Sparks strengths is that it is a processing engine that can be used on its own, or used in place of Hadoop MapReduce, taking advantage of the other features of Hadoop."
},
{
"code": null,
"e": 4933,
"s": 4858,
"text": "Further Reading — Processing Engines explained and compared (~10 min read)"
},
{
"code": null,
"e": 5391,
"s": 4933,
"text": "General-Purpose — One of the main advantages of Spark is how flexible it is, and how many application domains it has. It supports Scala, Python, Java, R, and SQL. It has a dedicated SQL module, it is able to process streamed data in real-time, and it has both a machine learning library and graph computation engine built on top of it. All these reasons contribute to why Spark has become one of the most popular processing engines in the realm of Big Data."
},
{
"code": null,
"e": 5501,
"s": 5391,
"text": "Further Reading — 5 minute guide to understanding the significance of Spark (probably more like ~10 min read)"
},
{
"code": null,
"e": 5872,
"s": 5501,
"text": "Partitioned Data — When working with a computer cluster, you can’t just throw in a vanilla dataframe and expect it to know what to do. Because the processing tasks will be divided across multiple nodes, the data also has to be able to be divided across multiple nodes. Partitioned data refers to data that has been optimized to be able to be processed on multiple nodes."
},
{
"code": null,
"e": 5936,
"s": 5872,
"text": "Further Reading — Explanation of Data Partitioning (2 min read)"
},
{
"code": null,
"e": 6400,
"s": 5936,
"text": "Fault Tolerance — In short, fault tolerance refers to a distributed system’s ability to continue working properly even when a failure occurs. A failure could be a node bursting into flames for example, or just a communication breakdown between nodes. Fault tolerance in Spark revolves around Spark’s RDDs (which will be discussed later). Basically, the way data storage is handled in Spark allows Spark programs to function properly despite occurences of failure."
},
{
"code": null,
"e": 6460,
"s": 6400,
"text": "Further Reading — How is Spark fault tolerant (~1 min read)"
},
{
"code": null,
"e": 7314,
"s": 6460,
"text": "Lazy Evaluation — Lazy evaluation, or lazy computing, has to do with how code is compiled. When a compiler that is not lazy (which is called strict evaluation) compiles code, it sequentially evaluates each expression it comes across. A lazy compiler on the other hand, doesn’t continually evaluate expressions, but rather, waits until it is actually told to generate a result, and then performs all the evaluation all at once. So as it compiles code, it keeps track of everything it will eventually have to evaluate (in Spark this kind of evaluation log, so to speak, is called a lineage graph), and then whenever it is prompted to return something, it performs evaluations according to what it has in its evaluation log. This is useful because it makes programs more efficient as the compiler doesn’t have to evaluate anything that isn’t actually used."
},
{
"code": null,
"e": 7369,
"s": 7314,
"text": "Further Reading — What is Lazy Evaluation (4 min read)"
},
{
"code": null,
"e": 8960,
"s": 7369,
"text": "RDDs, DataFrames, DataSets, Oh My! — Spark RDDs (Resilient Distributed Datasets) are data structures that are the core building blocks of Spark. A RDD is an immutable, partitioned collection of records, which means that it can hold values, tuples, or other objects, these records are partitioned so as to be processed on a distributed system, and that once an RDD has been made, it is impossible to alter it. That basically sums up its acronym: they are resilient due to their immutability and lineage graphs (which will be discussed shortly), they can be distributed due to their partitions, and they are datasets because, well, they hold data. A crucial thing to note is that RDDs do not have a schema, which means that they do not have a columnar structure. Records are just recorded row-by-row, and are displayed similar to a list. Enter Spark DataFrames. Not to be confused with Pandas DataFrames, as they are distinct, Spark DataFrame have all of the features of RDDs but also have a schema. This will make them our data structure of choice for getting started with PySpark.Spark has another data structure, Spark DataSets. These are similar to DataFrames but are strongly-typed, meaning that the type is specified upon the creation of the DataSet and is not inferred from the type of records stored in it. This means DataSets are not used in PySpark because Python is a dynamically-typed language. For the rest of these explanations I’ll be referring to RDDs but know that what is true for an RDD is also true for a DataFrame, DataFrames are just organized into a columnar structure."
},
{
"code": null,
"e": 9144,
"s": 8960,
"text": "Further Reading — RDDs, DataFrames, & DataSets compared (~5 min read)Further Reading — Pandas v. Spark DataFrames (4 min read)Further Reading — Helpful RDD Documentation (~5 min read)"
},
{
"code": null,
"e": 10031,
"s": 9144,
"text": "Transformations — Transformations are one of the things you can do to an RDD in Spark. They are lazy operations that create one or more new RDDs. It’s important to note that Transformations create new RDDs because, remember, RDDs are immutable so they can’t be altered in any way once they’ve been created. So, in essence, Transformations take an RDD as an input and perform some function on them based on what Transformation is being called, and outputs one or more RDDs. Recalling the section on lazy evaluation, as a compiler comes across each Transformation, it doesn’t actually build any new RDDs, but rather constructs a chain of hypothetical RDDs that would result from those Transformations which will only be evaluated once an Action is called. This chain of hypothetical, or “child”, RDDs, all connected logically back to the original “parent” RDD, is what a lineage graph is."
},
{
"code": null,
"e": 10193,
"s": 10031,
"text": "Further Reading — Helpful Transformation Documentation (~2 min read) Further Reading — More in-depth Documentation (5–10 min read; Transformations in first half)"
},
{
"code": null,
"e": 10552,
"s": 10193,
"text": "Actions — An Action is any RDD operation that does not produce an RDD as an output. Some examples of common Actions are doing a count of the data, or finding the max or min, or returning the first element of an RDD, etc. As was mentioned before, an Action is the cue to the compiler to evaluate the lineage graph and return the value specified by the Action."
},
{
"code": null,
"e": 10696,
"s": 10552,
"text": "Further Reading — Helpful Action Documentation (~1 min read)Further Reading — More in-depth Documentation (~5 min read; Actions in second half)"
},
{
"code": null,
"e": 11329,
"s": 10696,
"text": "Lineage Graph — Most of what a lineage graph is was described in the Transformations and Actions sections, but to summarize, a lineage graph outlines what is called a “logical execution plan”. What that means is that the compiler begins with the earliest RDDs that aren’t dependent on any other RDDs, and follows a logical chain of Transformations until it ends with the RDD that an Action is called on. This feature is primarily what drives Spark’s fault tolerance. If a node fails for some reason, all the information about what that node was supposed to be doing is stored in the lineage graph, which can be replicated elsewhere."
},
{
"code": null,
"e": 11391,
"s": 11329,
"text": "Further Reading — Helpful Lineage Documentation (~2 min read)"
},
{
"code": null,
"e": 12646,
"s": 11391,
"text": "Spark Applications and Jobs — There is a lot of nitty gritty when it comes to how a processing engine like Spark actually executes processing tasks on a distributed system. The following is just as much as you’ll need to know in order to have a working understanding of what certain snippets of Spark code do. In Spark, when an item of processing has to be done, there is a “driver” process that is in charge of taking the user’s code and converting it into a set of multiple tasks. There are also “executor” processes, each operating on a separate node in the cluster, that are in charge of running the tasks, as delegated by the driver. Each driver process has a set of executors that it has access to in order to run tasks. A Spark application is a user built program that consists of a driver and that driver’s associated executors. A Spark job is task or set of tasks to be executed with executor processes, as directed by the driver. A job is triggered by the calling of an RDD Action. This stuff can be rather confusing, so don’t sweat it if it doesn’t make total sense at first, it’s just helpful to be familiar with these terms when they are implemented in code later on. I’ve included extra resources on this topic if you want more information."
},
{
"code": null,
"e": 12848,
"s": 12646,
"text": "Further Reading — Cluster Mode Overview from Spark API (~3 min read)Further Reading — Helpful Answer on StackOverflow (~2 min read)Further Reading — Spark Application Overview on Cloudera (~2 min read)"
},
{
"code": null,
"e": 12942,
"s": 12848,
"text": "Phew you made it through all the terminology and concepts! Now let’s get into implementation!"
},
{
"code": null,
"e": 13571,
"s": 12942,
"text": "That heading might be a bit of a misnomer, because, strictly speaking, this guide won’t show you how to install Apache Spark. Installing Spark can be a pain in the butt. For one, writing Spark applications can be done in multiple languages and each one is installed slightly differently. The underlying API for Spark is written in Scala but PySpark is an overlying API for implementation in Python. For data science applications, using PySpark and Python is widely recommended over Scala, because it is relatively easier to implement. And so instead of installing PySpark, this guide will show you how to run it in Google Colab."
},
{
"code": null,
"e": 14098,
"s": 13571,
"text": "When I was trying to get PySpark running on my computer, I kept getting conflicting instructions on where to download it from (it can be downloaded from spark.apache.org or pip installed for example), what to run it in (it can be run in Jupyter Notebooks or in the native pyspark shell in the command line), and there were numerous obscure bash commands sprinkled throughout. As a data scientist, my reaction to bash commands that aren’t pip installs is generally a mix of disgust and despair, and so I turned to Google Colab."
},
{
"code": null,
"e": 14331,
"s": 14098,
"text": "Google Colab is a really powerful interactive python notebook (.ipynb) tool that has a lot data science libraries pre-installed. For more information on what it is and how to run it check out this super helpful article (8 min read)."
},
{
"code": null,
"e": 14497,
"s": 14331,
"text": "Once you’ve got a Colab notebook up, to get Spark running you have to run the following block of code (I know it’s not my fault, but I apologize for how ugly it is)."
},
{
"code": null,
"e": 14867,
"s": 14497,
"text": "!apt-get install openjdk-8-jdk-headless -qq > /dev/null!wget -q https://www-us.apache.org/dist/spark/spark-2.4.3/spark-2.4.3-bin-hadoop2.7.tgz!tar xf spark-2.4.3-bin-hadoop2.7.tgz!pip install -q findsparkimport osos.environ[\"JAVA_HOME\"] = \"/usr/lib/jvm/java-8-openjdk-amd64\"os.environ[\"SPARK_HOME\"] = \"/content/spark-2.4.3-bin-hadoop2.7\"import findsparkfindspark.init()"
},
{
"code": null,
"e": 15297,
"s": 14867,
"text": "NOTE: When I first ran this block of code it did not run. It was because there had been a new version of Spark released since the code I found was written and I was trying to access an older version of Spark that couldn’t be found. So if the above code doesn’t run, double check this website to see what the latest version of Spark is and replace everywhere you see “2.4.3” in the above snippet to whatever the newest version is."
},
{
"code": null,
"e": 15483,
"s": 15297,
"text": "Basically what this block of code does is download the right versions of Java (Spark uses some Java) and Spark, set the PATH to those versions, and to initialize Spark in your notebook."
},
{
"code": null,
"e": 15659,
"s": 15483,
"text": "If you want to use Spark on another platform besides Colab, here are the most helpful guides I found (in order of helpfulness), hopefully one of them is able to get you going:"
},
{
"code": null,
"e": 15891,
"s": 15659,
"text": "Installation Resource— Getting Started with PySpark and JupyterInstallation Resource — How to use PySpark on your computerInstallation Resource — How to install PySpark locallyInstallation Resource — How to Get Started with PySpark"
},
{
"code": null,
"e": 15998,
"s": 15891,
"text": "Because we want to be working with columnar data, we’ll be using DataFrames which are a part of Spark SQL."
},
{
"code": null,
"e": 16205,
"s": 15998,
"text": "NOTE: To avoid possible confusion, despite the fact that we will be working with Spark SQL, none of this will be SQL code. You can write SQL queries when working with Spark DataFrames but you don’t have to."
},
{
"code": null,
"e": 16356,
"s": 16205,
"text": "The entry point to using Spark SQL is an object called SparkSession. It initiates a Spark Application which all the code for that Session will run on."
},
{
"code": null,
"e": 16498,
"s": 16356,
"text": "from pyspark.sql import SparkSessionspark = SparkSession.builder \\ .master(\"local[*]\") \\ .appName(\"Learning_Spark\") \\ .getOrCreate()"
},
{
"code": null,
"e": 16657,
"s": 16498,
"text": "NOTE: the “ \\” character is this context is called a continuation character which is just a helpful wrapping tool for making long lines of code more readable."
},
{
"code": null,
"e": 16737,
"s": 16657,
"text": ".builder — gives access to Builder API which is used to configure the session ."
},
{
"code": null,
"e": 16954,
"s": 16737,
"text": ".master() — determines where the program will run; \"local[*]\" sets it to run locally on all cores but you can use \"local[1]\" to run on one core for example. In this case, our programs will be run on Google’s servers."
},
{
"code": null,
"e": 17013,
"s": 16954,
"text": ".appName() — optional method to name the Spark Application"
},
{
"code": null,
"e": 17094,
"s": 17013,
"text": ".getOrCreate() — gets an existing SparkSession or creates new one if none exists"
},
{
"code": null,
"e": 17163,
"s": 17094,
"text": "Check the Builder API for more options when building a SparkSession."
},
{
"code": null,
"e": 17294,
"s": 17163,
"text": "To open a local file on Google Colab you need to run the following code which will prompt you to select a file from your computer:"
},
{
"code": null,
"e": 17339,
"s": 17294,
"text": "from google.colab import filesfiles.upload()"
},
{
"code": null,
"e": 17441,
"s": 17339,
"text": "For this guide we’ll be working with a dataset on video game sales from Kaggle. It can be found here."
},
{
"code": null,
"e": 17561,
"s": 17441,
"text": "Now load our data into a Spark DataFrame using the .read.csv() function: (I shortened the file name for brevity’s sake)"
},
{
"code": null,
"e": 17638,
"s": 17561,
"text": "data = spark.read.csv('Video_Games_Sales.csv',inferSchema=True, header=True)"
},
{
"code": null,
"e": 17941,
"s": 17638,
"text": "NOTE: This function is specifically for reading CSV files into a DataFrame in PySparkSQL. It won’t work for loading data into an RDD and different languages (besides Python) have different syntax. Exercise caution when searching online for help because many resources do not assume Spark SQL or Python."
},
{
"code": null,
"e": 18019,
"s": 17941,
"text": "Now let’s move into understanding how we can get more familiar with our data!"
},
{
"code": null,
"e": 18220,
"s": 18019,
"text": "The first thing we can do is check the shape of of our DataFrame. Unlike Pandas, there is no dedicated method for this but we can use the .count() and .columns() to retrieve the information ourselves."
},
{
"code": null,
"e": 18267,
"s": 18220,
"text": "data.count(), len(data.columns)>>> (16719, 16)"
},
{
"code": null,
"e": 18376,
"s": 18267,
"text": "The .count() method returns the number of rows in the DataFrame and .columns returns a list of column names."
},
{
"code": null,
"e": 18652,
"s": 18376,
"text": "NOTE: We don’t have to actually print them because Colab will automatically display the last output of each cell. If you want to show more than one output you will have to print them (unless you use this workaround, which is super nice and works in Jupyter Notebooks as well)"
},
{
"code": null,
"e": 18715,
"s": 18652,
"text": "Viewing DataFramesTo view a DataFrame, use the .show() method:"
},
{
"code": null,
"e": 18728,
"s": 18715,
"text": "data.show(5)"
},
{
"code": null,
"e": 18902,
"s": 18728,
"text": "As you can see, running data.show(5) displayed the first 5 rows of our DataFrame, along with the header. Calling .show() with no parameters will return the first 20 records."
},
{
"code": null,
"e": 19011,
"s": 18902,
"text": "Let’s see what our data is comprised of using the .printSchema() method (alternatively you can use .dtypes):"
},
{
"code": null,
"e": 19030,
"s": 19011,
"text": "data.printSchema()"
},
{
"code": null,
"e": 19252,
"s": 19030,
"text": "Some takeaways from this output is that Year_of_Release and User_Score have a type of string, despite them being numbers. It also tells us that each of the columns allows null values which can be seen in the first 5 rows."
},
{
"code": null,
"e": 19403,
"s": 19252,
"text": "We can also selectively choose which columns we want to display with the .select() method. Let’s view only Name, Platform, User_Score, and User_Count:"
},
{
"code": null,
"e": 19487,
"s": 19403,
"text": "data.select(\"Name\",\"Platform\",\"User_Score\",\"User_Count\") \\.show(15, truncate=False)"
},
{
"code": null,
"e": 19599,
"s": 19487,
"text": "Included is the truncate=False parameter that adjusts the size of columns to prevent values from being cut off."
},
{
"code": null,
"e": 19717,
"s": 19599,
"text": "Summary Statistics/InformationWe can use the .describe() method to get summary statistics on columns of our choosing:"
},
{
"code": null,
"e": 19767,
"s": 19717,
"text": "data.describe([\"User_Score\",\"User_Count\"]).show()"
},
{
"code": null,
"e": 20118,
"s": 19767,
"text": "Some takeaways from this output is that there sees to a strange “tbd” value in the User_Score column. The count for User_Score is also higher than User_Count but it’s hard to tell if that’s because there are actually more values in User_Score or if “tbd” values are artificially raising the count. We’ll learn how to filter those values out later on."
},
{
"code": null,
"e": 20307,
"s": 20118,
"text": "We might also want to get some information on what kinds of platforms are in the Platform column and how they are distributed. We can use a groupBy() for this and sort it using .orderBy():"
},
{
"code": null,
"e": 20389,
"s": 20307,
"text": "data.groupBy(\"Platform\") \\.count() \\.orderBy(\"count\", ascending=False) \\.show(10)"
},
{
"code": null,
"e": 20521,
"s": 20389,
"text": "Here we’re looking at the top 10 most frequent platforms. We can tell this dataset is pretty old because I don’t see PS4 anywhere 🤔"
},
{
"code": null,
"e": 20687,
"s": 20521,
"text": "Filtering DataFramesLets create a new DataFrame that has the null values for User_Score and User_Count, and the “tbd” values filtered out using the .filter() method:"
},
{
"code": null,
"e": 20848,
"s": 20687,
"text": "condition1 = (data.User_Score.isNotNull()) | (data.User_Count.isNotNull())condition2 = data.User_Score != \"tbd\"data = data.filter(condition1).filter(condition2)"
},
{
"code": null,
"e": 21030,
"s": 20848,
"text": "condition1 returns True for any record that does not have a null value in User_Score or in User_Count. condition2 returns True for any record that does not have “tbd” in User_Score."
},
{
"code": null,
"e": 21126,
"s": 21030,
"text": "We can double check to see if our filtering worked by reconstructing our earlier visualizations"
},
{
"code": null,
"e": 21197,
"s": 21126,
"text": "That’s enough Data Exploration to get started, now lets build a model!"
},
{
"code": null,
"e": 21455,
"s": 21197,
"text": "Building models in PySpark looks a little different than you might be used to, and you’ll see terms like Transformer, Estimator, and Param. This guide won’t go in-depth into what those terms mean but below is a link to a brief description of what they mean."
},
{
"code": null,
"e": 21516,
"s": 21455,
"text": "Further Reading — Machine Learning in Spark (~5–10 min read)"
},
{
"code": null,
"e": 21663,
"s": 21516,
"text": "SetupFor an example of linear regression, let’s see if we can predict User_Score from Year_of_Release, Global_Sales, Critic_Score, and User_Count."
},
{
"code": null,
"e": 21785,
"s": 21663,
"text": "First let’s recode all of our predictors to be Doubles (I found that this got rid of some really gnarly errors later on)."
},
{
"code": null,
"e": 22152,
"s": 21785,
"text": "from pyspark.sql.types import DoubleTypedata2 = data2.withColumn(\"Year_of_Release\", data2[\"Year_of_Release\"].cast(DoubleType()))data2 = data2.withColumn(\"User_Score\", data2[\"User_Score\"].cast(DoubleType()))data2 = data2.withColumn(\"User_Count\", data2[\"User_Count\"].cast(DoubleType()))data2 = data2.withColumn(\"Critic_Score\", data2[\"Critic_Score\"].cast(DoubleType()))"
},
{
"code": null,
"e": 22368,
"s": 22152,
"text": "We use the method withColumn(), which either creates a new column or replaces one that already exists. So, for example, the Year_of_Release column is replaced with a version of itself that has been cast as doubles ."
},
{
"code": null,
"e": 22520,
"s": 22368,
"text": "VectorAssemblerThe next step is to get our data into a form that PySpark can create a model with. To do this we use something called a VectorAssembler."
},
{
"code": null,
"e": 22747,
"s": 22520,
"text": "from pyspark.ml.feature import VectorAssemblerinputcols = [\"Year_of_Release\", \"Global_Sales\", \"Critic_Score\", \"User_Count\"]assembler = VectorAssembler(inputCols= inputcols, outputCol = \"predictors\")"
},
{
"code": null,
"e": 22982,
"s": 22747,
"text": "Here we’ve delineated what features we want our model to use as predictors so that VectorAssembler can take those columns and transform them into a single column (named “predictors”) that contains all the data we want to predict with."
},
{
"code": null,
"e": 23039,
"s": 22982,
"text": "predictors = assembler.transform(data)predictors.columns"
},
{
"code": null,
"e": 23253,
"s": 23039,
"text": "What VectorAssembler.transform() does is create a new DataFrame with a new column at the end where each row contains a list of all the features we included in the inputCols parameter when we created the assembler."
},
{
"code": null,
"e": 23437,
"s": 23253,
"text": "The final step to getting our data ready to be used in a model is to collect the new predictions column we just made and User_Score (our target variable) by themselves in a DataFrame."
},
{
"code": null,
"e": 23529,
"s": 23437,
"text": "model_data = predictors.select(\"predictors\", \"User_Score\")model_data.show(5,truncate=False)"
},
{
"code": null,
"e": 23590,
"s": 23529,
"text": "Next is to split model_data into a training and testing set:"
},
{
"code": null,
"e": 23647,
"s": 23590,
"text": "train_data,test_data = model_data.randomSplit([0.8,0.2])"
},
{
"code": null,
"e": 23685,
"s": 23647,
"text": "Model TrainingNow to train the model!"
},
{
"code": null,
"e": 23880,
"s": 23685,
"text": "from pyspark.ml.regression import LinearRegressionlr = LinearRegression( featuresCol = 'predictors', labelCol = 'User_Score')lrModel = lr.fit(train_data)pred = lrModel.evaluate(test_data)"
},
{
"code": null,
"e": 24201,
"s": 23880,
"text": "After importing LinearRegression from pyspark.ml.regression, we construct a regressor and we specify that it should look for a column named “predictors” as the features of the model and a column named “User_Score” as the labels of the model. Next we train it with .fit() and finally produce predictions with .evaluate()."
},
{
"code": null,
"e": 24267,
"s": 24201,
"text": "We can access the parameters of our model with the following code"
},
{
"code": null,
"e": 24414,
"s": 24267,
"text": "lrModel.coefficients>>>[-0.07872176891379576,-0.0350439561719371,0.06376305861102288,-0.0002156086537632538]lrModel.intercept>>> 160.7985254457876"
},
{
"code": null,
"e": 24469,
"s": 24414,
"text": "We can also view the final predictions our model made:"
},
{
"code": null,
"e": 24494,
"s": 24469,
"text": "pred.predictions.show(5)"
},
{
"code": null,
"e": 24632,
"s": 24494,
"text": "The object named “pred” is a LinearRegressionSummary object and so to retrieve the DataFrame with predictions we call .predictions.show()"
},
{
"code": null,
"e": 24772,
"s": 24632,
"text": "Model EvaluatingTo get more detailed information on how our model performed, we can use RegressionEvaluator which is constructed like this:"
},
{
"code": null,
"e": 24934,
"s": 24772,
"text": "from pyspark.ml.evaluation import RegressionEvaluatoreval = RegressionEvaluator( labelCol=\"User_Score\", predictionCol=\"prediction\", metricName=\"rmse\")"
},
{
"code": null,
"e": 24979,
"s": 24934,
"text": "Let’s compute some statistics for the model:"
},
{
"code": null,
"e": 25205,
"s": 24979,
"text": "rmse = eval.evaluate(pred.predictions)mse = eval.evaluate(pred.predictions, {eval.metricName: \"mse\"})mae = eval.evaluate(pred.predictions, {eval.metricName: \"mae\"})r2 = eval.evaluate(pred.predictions, {eval.metricName: \"r2\"})"
},
{
"code": null,
"e": 25219,
"s": 25205,
"text": "Which returns"
},
{
"code": null,
"e": 25268,
"s": 25219,
"text": "rmse>>> 1.125mse>>> 1.266mae>>> 0.843r2>>> 0.386"
},
{
"code": null,
"e": 25665,
"s": 25268,
"text": "From this we can interpret that our model tended to be about 1.125 rating points off from the actual User_Score (according to rmse). The r2 value for tells us that the predictors in our model are able to account for a little under 40% of the total variability in User_Score. This was just a first pass look, and I recommend playing around with the model parameters and features for more practice!"
},
{
"code": null,
"e": 25965,
"s": 25665,
"text": "Further Reading — Detailed Code example of Linear Regression (~20+ min to go through the whole thing)Further Reading — Detailed Code example of Logistic Regression using SQL (~10 minutes)Further Reading — Example of Linear Regression, Decision Tree, and Gradient-Boosted Tree Regression (6 min read)"
},
{
"code": null,
"e": 26150,
"s": 25965,
"text": "This is just the tip of the iceberg as far as the kind of modeling you can do in PySpark, but I hope this guide has equipped you with enough to get your foot into the door of Big Data!"
},
{
"code": null,
"e": 26470,
"s": 26150,
"text": "Wow. Props to you if you made it all the way to the end. You were exposed to a ton of new concepts, from the terminology of distributed computing and Spark, to implementing data exploration and data modeling techniques in PySpark. My hope is that this guide can be a resource for you as you continue working with Spark!"
}
] |
Class with a constructor to initialize instance variables in Java | A class contains a constructor to initialize instance variables in Java. This constructor is called when the class object is created.
A program that demonstrates this is given as follows −
Live Demo
class Student {
private int rno;
private String name;
public Student(int r, String n) {
rno = r;
name = n;
}
public void display() {
System.out.println("Roll Number: " + rno);
System.out.println("Name: " + name);
}
}
public class Demo {
public static void main(String[] args) {
Student s = new Student(173, "Susan");
s.display();
}
}
The output of the above program is as follows −
Roll Number: 173
Name: Susan
Now let us understand the above program.
The Student class is created with data members rno, name. The constructor Student() initializes rno and name. The member function display() displays the values of rno and name. A code snippet which demonstrates this is as follows:
class Student {
private int rno;
private String name;
public Student(int r, String n) {
rno = r;
name = n;
}
public void display() {
System.out.println("Roll Number: " + rno);
System.out.println("Name: " + name);
}
}
In the main() method, an object s of class Student is created with values 101 and “John”. Then the display() method is called. A code snippet which demonstrates this is as follows:
public class Demo {
public static void main(String[] args) {
Student s = new Student(173, "Susan");
s.display();
}
} | [
{
"code": null,
"e": 1196,
"s": 1062,
"text": "A class contains a constructor to initialize instance variables in Java. This constructor is called when the class object is created."
},
{
"code": null,
"e": 1251,
"s": 1196,
"text": "A program that demonstrates this is given as follows −"
},
{
"code": null,
"e": 1262,
"s": 1251,
"text": " Live Demo"
},
{
"code": null,
"e": 1656,
"s": 1262,
"text": "class Student {\n private int rno;\n private String name;\n public Student(int r, String n) {\n rno = r;\n name = n;\n }\n public void display() {\n System.out.println(\"Roll Number: \" + rno);\n System.out.println(\"Name: \" + name);\n }\n}\npublic class Demo {\n public static void main(String[] args) {\n Student s = new Student(173, \"Susan\");\n s.display();\n }\n}"
},
{
"code": null,
"e": 1704,
"s": 1656,
"text": "The output of the above program is as follows −"
},
{
"code": null,
"e": 1733,
"s": 1704,
"text": "Roll Number: 173\nName: Susan"
},
{
"code": null,
"e": 1774,
"s": 1733,
"text": "Now let us understand the above program."
},
{
"code": null,
"e": 2005,
"s": 1774,
"text": "The Student class is created with data members rno, name. The constructor Student() initializes rno and name. The member function display() displays the values of rno and name. A code snippet which demonstrates this is as follows:"
},
{
"code": null,
"e": 2264,
"s": 2005,
"text": "class Student {\n private int rno;\n private String name;\n public Student(int r, String n) {\n rno = r;\n name = n;\n }\n public void display() {\n System.out.println(\"Roll Number: \" + rno);\n System.out.println(\"Name: \" + name);\n }\n}"
},
{
"code": null,
"e": 2445,
"s": 2264,
"text": "In the main() method, an object s of class Student is created with values 101 and “John”. Then the display() method is called. A code snippet which demonstrates this is as follows:"
},
{
"code": null,
"e": 2580,
"s": 2445,
"text": "public class Demo {\n public static void main(String[] args) {\n Student s = new Student(173, \"Susan\");\n s.display();\n }\n}"
}
] |
Fixing data files — adding a missing date column | by Dawn Moyer | Towards Data Science | You have an entire folder of files ready for analysis. Looking closer, you see that each file name has a date, but there is no corresponding date on the records. To load the data into a data frame or table, you will need some date or timestamp to maintain the records' order. Inwardly, you groan. What to do?
You can use python to read in the file and add a new column based on the filename date.
You need to create a visualization of the candy sales for the first week of October 2020.
The files are created daily and contain different candies and the amount sold.
The files are found within a single folder. The file names vary by sale date.
4 Steps to add the date columns to all the files if missing
Using the same python glob as I did for a text scraping task earlier, I create a list of all of the files in the folder.Iterate through that list of files. Get the date from the filename.Next, open the file and read it into a data frame. Add (or update if it already exists) a date column.Write the updated data back to the file.
Using the same python glob as I did for a text scraping task earlier, I create a list of all of the files in the folder.
Iterate through that list of files. Get the date from the filename.
Next, open the file and read it into a data frame. Add (or update if it already exists) a date column.
Write the updated data back to the file.
After running this simple script, the files are now updated:
Now it is much easier to pull those files into a single file. I have included that in the script as well.
# import required packagesimport pandas as pdimport globimport osimport reimport sys# where is your folder?folderPath = '<path to your top folder>'# Find the candy sales filesfiles = glob.glob(folderPath + '/**/*candy_sales*',recursive=True)viz_df = pd.DataFrame()"""Loop through all the files , remove punctuationn, split each line into elements and match the elements to the list of words"""for file in files: basic_file_name = file.replace(folderPath,'') basic_file_date = basic_file_name[14:22] # yyyy-mm-dd #file_date = str(basic_file_name[14:18]) + '-' + str(basic_file_name[18:20]) + '-' + str(basic_file_name[20:22]) # mm/dd/yyyy file_date = str(basic_file_name[18:20]) + '-' + str(basic_file_name[20:22]) + '-' + str(basic_file_name[14:18])df = pd.DataFrame() df = pd.read_excel(file, header=0) df['date'] = file_datedf.to_excel(file, header=True, index=False) print('Done updating files')# Create a viz filefor file in files: df = pd.DataFrame() df = pd.read_excel(file, header=0) viz_df = viz_df.append(df) viz_df.to_excel(folderPath + '/viz_file.xlsx', header=True, index=False)print('Done printing viz file')
Once you have the final file, pull it into a Viz tool — such as Tableau Public.
In just minutes, you’ve gone from an unusable pile of undated records to a file of timestamped rows ready for analysis. | [
{
"code": null,
"e": 481,
"s": 172,
"text": "You have an entire folder of files ready for analysis. Looking closer, you see that each file name has a date, but there is no corresponding date on the records. To load the data into a data frame or table, you will need some date or timestamp to maintain the records' order. Inwardly, you groan. What to do?"
},
{
"code": null,
"e": 569,
"s": 481,
"text": "You can use python to read in the file and add a new column based on the filename date."
},
{
"code": null,
"e": 659,
"s": 569,
"text": "You need to create a visualization of the candy sales for the first week of October 2020."
},
{
"code": null,
"e": 738,
"s": 659,
"text": "The files are created daily and contain different candies and the amount sold."
},
{
"code": null,
"e": 816,
"s": 738,
"text": "The files are found within a single folder. The file names vary by sale date."
},
{
"code": null,
"e": 876,
"s": 816,
"text": "4 Steps to add the date columns to all the files if missing"
},
{
"code": null,
"e": 1206,
"s": 876,
"text": "Using the same python glob as I did for a text scraping task earlier, I create a list of all of the files in the folder.Iterate through that list of files. Get the date from the filename.Next, open the file and read it into a data frame. Add (or update if it already exists) a date column.Write the updated data back to the file."
},
{
"code": null,
"e": 1327,
"s": 1206,
"text": "Using the same python glob as I did for a text scraping task earlier, I create a list of all of the files in the folder."
},
{
"code": null,
"e": 1395,
"s": 1327,
"text": "Iterate through that list of files. Get the date from the filename."
},
{
"code": null,
"e": 1498,
"s": 1395,
"text": "Next, open the file and read it into a data frame. Add (or update if it already exists) a date column."
},
{
"code": null,
"e": 1539,
"s": 1498,
"text": "Write the updated data back to the file."
},
{
"code": null,
"e": 1600,
"s": 1539,
"text": "After running this simple script, the files are now updated:"
},
{
"code": null,
"e": 1706,
"s": 1600,
"text": "Now it is much easier to pull those files into a single file. I have included that in the script as well."
},
{
"code": null,
"e": 2896,
"s": 1706,
"text": "# import required packagesimport pandas as pdimport globimport osimport reimport sys# where is your folder?folderPath = '<path to your top folder>'# Find the candy sales filesfiles = glob.glob(folderPath + '/**/*candy_sales*',recursive=True)viz_df = pd.DataFrame()\"\"\"Loop through all the files , remove punctuationn, split each line into elements and match the elements to the list of words\"\"\"for file in files: basic_file_name = file.replace(folderPath,'') basic_file_date = basic_file_name[14:22] # yyyy-mm-dd #file_date = str(basic_file_name[14:18]) + '-' + str(basic_file_name[18:20]) + '-' + str(basic_file_name[20:22]) # mm/dd/yyyy file_date = str(basic_file_name[18:20]) + '-' + str(basic_file_name[20:22]) + '-' + str(basic_file_name[14:18])df = pd.DataFrame() df = pd.read_excel(file, header=0) df['date'] = file_datedf.to_excel(file, header=True, index=False) print('Done updating files')# Create a viz filefor file in files: df = pd.DataFrame() df = pd.read_excel(file, header=0) viz_df = viz_df.append(df) viz_df.to_excel(folderPath + '/viz_file.xlsx', header=True, index=False)print('Done printing viz file')"
},
{
"code": null,
"e": 2976,
"s": 2896,
"text": "Once you have the final file, pull it into a Viz tool — such as Tableau Public."
}
] |
Select query with regular expression in MySQL | Let us first create a table −
mysql> create table DemoTable1573
-> (
-> StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY,
-> StudentCode varchar(20)
-> );
Query OK, 0 rows affected (0.63 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable1573(StudentCode) values('STU_774');
Query OK, 1 row affected (0.14 sec)
mysql> insert into DemoTable1573(StudentCode) values('909_Sam');
Query OK, 1 row affected (0.17 sec)
mysql> insert into DemoTable1573(StudentCode) values('3_Carol_455');
Query OK, 1 row affected (0.11 sec)
mysql> insert into DemoTable1573(StudentCode) values('David_903');
Query OK, 1 row affected (0.14 sec)
Display all records from the table using select statement −
mysql> select * from DemoTable1573;
This will produce the following output −
+-----------+-------------+
| StudentId | StudentCode |
+-----------+-------------+
| 1 | STU_774 |
| 2 | 909_Sam |
| 3 | 3_Carol_455 |
| 4 | David_903 |
+-----------+-------------+
4 rows in set (0.00 sec)
Here is the query to implement select query with regular expression −
mysql> select * from DemoTable1573 where StudentCode regexp '\land[0-9]';
This will produce the following output −
+-----------+-------------+
| StudentId | StudentCode |
+-----------+-------------+
| 2 | 909_Sam |
| 3 | 3_Carol_455 |
+-----------+-------------+
2 rows in set (0.14 sec) | [
{
"code": null,
"e": 1092,
"s": 1062,
"text": "Let us first create a table −"
},
{
"code": null,
"e": 1267,
"s": 1092,
"text": "mysql> create table DemoTable1573\n -> (\n -> StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY,\n -> StudentCode varchar(20)\n -> );\nQuery OK, 0 rows affected (0.63 sec)"
},
{
"code": null,
"e": 1323,
"s": 1267,
"text": "Insert some records in the table using insert command −"
},
{
"code": null,
"e": 1733,
"s": 1323,
"text": "mysql> insert into DemoTable1573(StudentCode) values('STU_774');\nQuery OK, 1 row affected (0.14 sec)\nmysql> insert into DemoTable1573(StudentCode) values('909_Sam');\nQuery OK, 1 row affected (0.17 sec)\nmysql> insert into DemoTable1573(StudentCode) values('3_Carol_455');\nQuery OK, 1 row affected (0.11 sec)\nmysql> insert into DemoTable1573(StudentCode) values('David_903');\nQuery OK, 1 row affected (0.14 sec)"
},
{
"code": null,
"e": 1793,
"s": 1733,
"text": "Display all records from the table using select statement −"
},
{
"code": null,
"e": 1829,
"s": 1793,
"text": "mysql> select * from DemoTable1573;"
},
{
"code": null,
"e": 1870,
"s": 1829,
"text": "This will produce the following output −"
},
{
"code": null,
"e": 2119,
"s": 1870,
"text": "+-----------+-------------+\n| StudentId | StudentCode |\n+-----------+-------------+\n| 1 | STU_774 |\n| 2 | 909_Sam |\n| 3 | 3_Carol_455 |\n| 4 | David_903 |\n+-----------+-------------+\n4 rows in set (0.00 sec)"
},
{
"code": null,
"e": 2189,
"s": 2119,
"text": "Here is the query to implement select query with regular expression −"
},
{
"code": null,
"e": 2263,
"s": 2189,
"text": "mysql> select * from DemoTable1573 where StudentCode regexp '\\land[0-9]';"
},
{
"code": null,
"e": 2304,
"s": 2263,
"text": "This will produce the following output −"
},
{
"code": null,
"e": 2497,
"s": 2304,
"text": "+-----------+-------------+\n| StudentId | StudentCode |\n+-----------+-------------+\n| 2 | 909_Sam |\n| 3 | 3_Carol_455 |\n+-----------+-------------+\n2 rows in set (0.14 sec)"
}
] |
9 Examples to Master Seaborn Grids | by Soner Yıldırım | Towards Data Science | Data visualization is a fundamental piece of data analysis. It helps us better understand the relationships in the data and explore the underlying structure.
We can create more informative visualizations by combining multiple plots in the same figure. There are many ways to create multi-plot visualizations. Seaborn library makes it simple and straightforward to generate such plots using the FacetGrid and PairGrid classes.
In this article, we will go over 9 examples to practice how to use these function. We will start with very basic ones and steadily increase the complexity. For the examples, we will be using a customer churn dataset available on Kaggle.
We start with importing the necessary libraries.
import numpy as npimport pandas as pdimport matplotlib.pyplot as pltimport seaborn as snssns.set(style='darkgrid')
The next step is to read the dataset into a Pandas dataframe.
cols = [ 'Attrition_Flag','Gender','Education_Level', 'Marital_Status','Customer_Age','Credit_Limit', 'Total_Trans_Amt','Avg_Open_To_Buy' ]churn = pd.read_csv( "/content/BankChurners.csv", usecols=cols ).sample(n=1000)churn = churn[churn.Marital_Status.isin(['Married','Single'])]churn = churn[churn.Education_Level.isin(['Graduate','High School', 'Unknown'])]churn.head()
I have selected some of the columns in the original dataset and also done some filtering and sampling for demonstration purposes.
FacetGrid is a grid of subplots which allows for transferring the structure of the dataset to the subplots. Row, col, and hue parameters can be considered as the three dimensions of FacetGrid objects.
We first create a FacetGrid object and then map the data. Let’s start with a very simple example of creating the structure of a FacetGrid.
g = sns.FacetGrid(churn, col='Attrition_Flag', height=4, aspect=1.2)
We now have an empty plot that only represents the structure. Seaborn generates the structure based on the values in the columns passed to the col and row parameters. Since the attrition flag column has two unique values, a grid with two columns is returned.
The height and aspect parameters adjust the size of subplots.
Once we have a FacetGrid object, we can map data to it.
g = sns.FacetGrid(churn, col='Attrition_Flag', height=4, aspect=1.2)g.map(sns.histplot, 'Customer_Age')
The map method takes a plotting function and variables to plot as argument. The grid above shows the distribution of the customer age column using a histogram. The data points are separated according to the categories in attrition flag column.
The plotting function passed to the map method does not have to be a Seaborn function. We can also use matplotlib functions. For instance, the plot above can be created with “plt.hist”.
g = sns.FacetGrid(churn, col='Attrition_Flag', height=4, aspect=1.2)g.map(plt.hist, 'Customer_Age')
Note: Seaborn also accepts custom functions to use for mapping. However, there are certain rules you must follow when creating them.
We have only used the col parameter so far. We can use the row and hue parameters to add more dimensions.
g = sns.FacetGrid( churn, row='Attrition_Flag', col='Gender', hue='Marital_Status', height=4, aspect=1.4)g.map(sns.scatterplot, 'Total_Trans_Amt', 'Avg_Open_To_Buy')g.add_legend()
We have a grid of scatter plots that show the relationship between two numerical columns. We are able to demonstrate relationship separately for categories in the attrition flag, gender, and marital status columns.
When we use the hue parameter, the legend should also be added using the add_legend function.
We can specify the order of the categories represented by the subplots. The row_order and col_order parameters can be used to order.
col_order = churn.Education_Level.value_counts().indexg = sns.FacetGrid( churn, col='Education_Level', height=4, col_order = col_order)g.map(sns.histplot, 'Total_Trans_Amt')
As you can also notice from the plots, the categories are sorted by size. We have used the value_counts function of Pandas to generate an order for the categories.
PairGrid generates a grid of plots that visualize the pairwise relationships of variables. For instance, we can create a grid of scatter plots between some numerical variables.
cols = ['Credit_Limit','Total_Trans_Amt','Customer_Age']g = sns.PairGrid(churn[cols], height=3.5)g.map(sns.scatterplot)
In the previous example, the plots on the diagonal are useless because they show a scatter plot of a variable with itself. In order to make the grid more informative, we can plot histograms of variables on the diagonal.
We pass separate functions by using the map_diag and map_offdiag methods.
g = sns.PairGrid(churn[cols], height=3)g.map_diag(sns.histplot)g.map_offdiag(sns.scatterplot)
It is better than the previous one as we also get an overview of the distribution of each variable.
The PairGrid also supports the hue parameter so we can separate the data points in the scatter plot based on a categorical variable.
Another useful parameter is the var parameter. In the previous examples for PairGrid, we used a subset of the dataframe so it only included the columns to be plotted. We can also pass a list of columns to be plotted to the var parameter.
g = sns.PairGrid(churn, vars=cols, hue='Attrition_Flag', height=3)g.map_diag(sns.histplot)g.map_offdiag(sns.scatterplot)g.add_legend()
In a PairGrid, the plots on the upper and lower side of diagonal are mirror images. Thus, we have the same plot from a different perspective.
We have the option to have different kind of plots on the upper and lower side of the diagonal. The map_upper and map_lower functions are used to generate different kinds of plots for the upper and lower side.
g = sns.PairGrid(churn, vars=cols, height=3)g.map_diag(sns.histplot)g.map_upper(sns.scatterplot)g.map_lower(sns.histplot)
On the upper side, we have the scatter plots. The diagonal contains the histograms of each variable. On the lower side, we have two-dimensional histograms.
We have practiced how to create multi-plot visualizations with the FacetGrid and PairGrid of Seaborn. They are very useful tools for exploratory data analysis. The way Seaborn generates these plots makes them simple and easy to understand.
It is important to understand the differences between a FacetGrid and PairGrid. In a FacetGrid, each subplot represents the same relationship but under different conditions. For instance, we can have a scatter plot of two variables in a FacetGrid and separate the data points based on the categories of another variables.
In the PairGrid, each plot shows a different relationship. For instance, when we create a PairGrid of scatter plots with three variables, each subplot represents a different pairwise relationship.
There are many more features that can be added on FacetGrid and PairGrid objects in order to enrich both the functionality and appearance. Once you are comfortable with the basic ones, you can create more detailed grids.
Thank you for reading. Please let me know if you have any feedback. | [
{
"code": null,
"e": 329,
"s": 171,
"text": "Data visualization is a fundamental piece of data analysis. It helps us better understand the relationships in the data and explore the underlying structure."
},
{
"code": null,
"e": 597,
"s": 329,
"text": "We can create more informative visualizations by combining multiple plots in the same figure. There are many ways to create multi-plot visualizations. Seaborn library makes it simple and straightforward to generate such plots using the FacetGrid and PairGrid classes."
},
{
"code": null,
"e": 834,
"s": 597,
"text": "In this article, we will go over 9 examples to practice how to use these function. We will start with very basic ones and steadily increase the complexity. For the examples, we will be using a customer churn dataset available on Kaggle."
},
{
"code": null,
"e": 883,
"s": 834,
"text": "We start with importing the necessary libraries."
},
{
"code": null,
"e": 998,
"s": 883,
"text": "import numpy as npimport pandas as pdimport matplotlib.pyplot as pltimport seaborn as snssns.set(style='darkgrid')"
},
{
"code": null,
"e": 1060,
"s": 998,
"text": "The next step is to read the dataset into a Pandas dataframe."
},
{
"code": null,
"e": 1466,
"s": 1060,
"text": "cols = [ 'Attrition_Flag','Gender','Education_Level', 'Marital_Status','Customer_Age','Credit_Limit', 'Total_Trans_Amt','Avg_Open_To_Buy' ]churn = pd.read_csv( \"/content/BankChurners.csv\", usecols=cols ).sample(n=1000)churn = churn[churn.Marital_Status.isin(['Married','Single'])]churn = churn[churn.Education_Level.isin(['Graduate','High School', 'Unknown'])]churn.head()"
},
{
"code": null,
"e": 1596,
"s": 1466,
"text": "I have selected some of the columns in the original dataset and also done some filtering and sampling for demonstration purposes."
},
{
"code": null,
"e": 1797,
"s": 1596,
"text": "FacetGrid is a grid of subplots which allows for transferring the structure of the dataset to the subplots. Row, col, and hue parameters can be considered as the three dimensions of FacetGrid objects."
},
{
"code": null,
"e": 1936,
"s": 1797,
"text": "We first create a FacetGrid object and then map the data. Let’s start with a very simple example of creating the structure of a FacetGrid."
},
{
"code": null,
"e": 2005,
"s": 1936,
"text": "g = sns.FacetGrid(churn, col='Attrition_Flag', height=4, aspect=1.2)"
},
{
"code": null,
"e": 2264,
"s": 2005,
"text": "We now have an empty plot that only represents the structure. Seaborn generates the structure based on the values in the columns passed to the col and row parameters. Since the attrition flag column has two unique values, a grid with two columns is returned."
},
{
"code": null,
"e": 2326,
"s": 2264,
"text": "The height and aspect parameters adjust the size of subplots."
},
{
"code": null,
"e": 2382,
"s": 2326,
"text": "Once we have a FacetGrid object, we can map data to it."
},
{
"code": null,
"e": 2486,
"s": 2382,
"text": "g = sns.FacetGrid(churn, col='Attrition_Flag', height=4, aspect=1.2)g.map(sns.histplot, 'Customer_Age')"
},
{
"code": null,
"e": 2730,
"s": 2486,
"text": "The map method takes a plotting function and variables to plot as argument. The grid above shows the distribution of the customer age column using a histogram. The data points are separated according to the categories in attrition flag column."
},
{
"code": null,
"e": 2916,
"s": 2730,
"text": "The plotting function passed to the map method does not have to be a Seaborn function. We can also use matplotlib functions. For instance, the plot above can be created with “plt.hist”."
},
{
"code": null,
"e": 3016,
"s": 2916,
"text": "g = sns.FacetGrid(churn, col='Attrition_Flag', height=4, aspect=1.2)g.map(plt.hist, 'Customer_Age')"
},
{
"code": null,
"e": 3149,
"s": 3016,
"text": "Note: Seaborn also accepts custom functions to use for mapping. However, there are certain rules you must follow when creating them."
},
{
"code": null,
"e": 3255,
"s": 3149,
"text": "We have only used the col parameter so far. We can use the row and hue parameters to add more dimensions."
},
{
"code": null,
"e": 3440,
"s": 3255,
"text": "g = sns.FacetGrid( churn, row='Attrition_Flag', col='Gender', hue='Marital_Status', height=4, aspect=1.4)g.map(sns.scatterplot, 'Total_Trans_Amt', 'Avg_Open_To_Buy')g.add_legend()"
},
{
"code": null,
"e": 3655,
"s": 3440,
"text": "We have a grid of scatter plots that show the relationship between two numerical columns. We are able to demonstrate relationship separately for categories in the attrition flag, gender, and marital status columns."
},
{
"code": null,
"e": 3749,
"s": 3655,
"text": "When we use the hue parameter, the legend should also be added using the add_legend function."
},
{
"code": null,
"e": 3882,
"s": 3749,
"text": "We can specify the order of the categories represented by the subplots. The row_order and col_order parameters can be used to order."
},
{
"code": null,
"e": 4060,
"s": 3882,
"text": "col_order = churn.Education_Level.value_counts().indexg = sns.FacetGrid( churn, col='Education_Level', height=4, col_order = col_order)g.map(sns.histplot, 'Total_Trans_Amt')"
},
{
"code": null,
"e": 4224,
"s": 4060,
"text": "As you can also notice from the plots, the categories are sorted by size. We have used the value_counts function of Pandas to generate an order for the categories."
},
{
"code": null,
"e": 4401,
"s": 4224,
"text": "PairGrid generates a grid of plots that visualize the pairwise relationships of variables. For instance, we can create a grid of scatter plots between some numerical variables."
},
{
"code": null,
"e": 4521,
"s": 4401,
"text": "cols = ['Credit_Limit','Total_Trans_Amt','Customer_Age']g = sns.PairGrid(churn[cols], height=3.5)g.map(sns.scatterplot)"
},
{
"code": null,
"e": 4741,
"s": 4521,
"text": "In the previous example, the plots on the diagonal are useless because they show a scatter plot of a variable with itself. In order to make the grid more informative, we can plot histograms of variables on the diagonal."
},
{
"code": null,
"e": 4815,
"s": 4741,
"text": "We pass separate functions by using the map_diag and map_offdiag methods."
},
{
"code": null,
"e": 4909,
"s": 4815,
"text": "g = sns.PairGrid(churn[cols], height=3)g.map_diag(sns.histplot)g.map_offdiag(sns.scatterplot)"
},
{
"code": null,
"e": 5009,
"s": 4909,
"text": "It is better than the previous one as we also get an overview of the distribution of each variable."
},
{
"code": null,
"e": 5142,
"s": 5009,
"text": "The PairGrid also supports the hue parameter so we can separate the data points in the scatter plot based on a categorical variable."
},
{
"code": null,
"e": 5380,
"s": 5142,
"text": "Another useful parameter is the var parameter. In the previous examples for PairGrid, we used a subset of the dataframe so it only included the columns to be plotted. We can also pass a list of columns to be plotted to the var parameter."
},
{
"code": null,
"e": 5515,
"s": 5380,
"text": "g = sns.PairGrid(churn, vars=cols, hue='Attrition_Flag', height=3)g.map_diag(sns.histplot)g.map_offdiag(sns.scatterplot)g.add_legend()"
},
{
"code": null,
"e": 5657,
"s": 5515,
"text": "In a PairGrid, the plots on the upper and lower side of diagonal are mirror images. Thus, we have the same plot from a different perspective."
},
{
"code": null,
"e": 5867,
"s": 5657,
"text": "We have the option to have different kind of plots on the upper and lower side of the diagonal. The map_upper and map_lower functions are used to generate different kinds of plots for the upper and lower side."
},
{
"code": null,
"e": 5989,
"s": 5867,
"text": "g = sns.PairGrid(churn, vars=cols, height=3)g.map_diag(sns.histplot)g.map_upper(sns.scatterplot)g.map_lower(sns.histplot)"
},
{
"code": null,
"e": 6145,
"s": 5989,
"text": "On the upper side, we have the scatter plots. The diagonal contains the histograms of each variable. On the lower side, we have two-dimensional histograms."
},
{
"code": null,
"e": 6385,
"s": 6145,
"text": "We have practiced how to create multi-plot visualizations with the FacetGrid and PairGrid of Seaborn. They are very useful tools for exploratory data analysis. The way Seaborn generates these plots makes them simple and easy to understand."
},
{
"code": null,
"e": 6707,
"s": 6385,
"text": "It is important to understand the differences between a FacetGrid and PairGrid. In a FacetGrid, each subplot represents the same relationship but under different conditions. For instance, we can have a scatter plot of two variables in a FacetGrid and separate the data points based on the categories of another variables."
},
{
"code": null,
"e": 6904,
"s": 6707,
"text": "In the PairGrid, each plot shows a different relationship. For instance, when we create a PairGrid of scatter plots with three variables, each subplot represents a different pairwise relationship."
},
{
"code": null,
"e": 7125,
"s": 6904,
"text": "There are many more features that can be added on FacetGrid and PairGrid objects in order to enrich both the functionality and appearance. Once you are comfortable with the basic ones, you can create more detailed grids."
}
] |
Handling multiple clients on server with multithreading using Socket Programming in C/C++ - GeeksforGeeks | 08 Nov, 2021
This tutorial assumes that the reader has a basic knowledge of socket programming, i.e has a familiarity with basic server and client models. In the basic model, the server handles only one client at a time, which is a big assumption if one wants to develop any scalable server model. The simple way to handle multiple clients would be to spawn a new thread for every new client connected to the server.
Semaphores: Semaphore is simply a variable that is non-negative and shared between threads. This variable is used to solve the critical section problem and to achieve process synchronization in the multiprocessing environment.
sem_post: sem_post() increments (unlocks) the semaphore pointed to by sem. If the semaphore’s value consequently becomes greater than zero, then another process or thread blocked in a sem_wait(3) call will be woken up and proceed to lock the semaphore.
#include <semaphore.h>
int sem_post(sem_t *sem);
sem_wait: sem_wait() decrements (locks) the semaphore pointed to by sem. If the semaphore’s value is greater than zero, then the decrement proceeds and the function returns, immediately. If the semaphore currently has the value zero, then the call blocks until either it becomes possible to perform the decrement (i.e., the semaphore value rises above zero), or a signal handler interrupts the call.
#include <semaphore.h>
int sem_wait(sem_t *sem);
In this article, the Reader-Writers algorithm is implemented on the server-side.
Implementation: For the server-side, create two different threads; a reader thread, and a writer thread. First, declare a serverSocket, an integer, a variable to hold the return of socket function.
int serverSocket = socket(domain, type, protocol);
serverSocket: Socket descriptor, an integer (like a file-handle).
domain: Integer, communication domain e.g., AF_INET (IPv4 protocol), AF_INET6 (IPv6 protocol).
type: Communication type.
SOCK_STREAM: TCP(reliable, connection-oriented).
SOCK_DGRAM: UDP(unreliable, connectionless).
protocol: Protocol value for Internet Protocol(IP), which is 0. This is the same number that appears on the protocol field in the IP header of a packet.(man protocols for more details).
Then, after initializing all the necessary variables bind the socket.
bind: After the creation of the socket, the bind function binds the socket to the address and port number specified in addr(custom data structure). In the example code, we bind the server to the local host, hence INADDR_ANY is used to specify the IP address.
int bind(int sockfd, const struct sockaddr *addr,
socklen_t addrlen);
listen: It puts the server socket in a passive mode, where it waits for the client to approach the server to make a connection. The backlog defines the maximum length to which the queue of pending connections for sockfd may grow. If a connection request arrives when the queue is full, the client may receive an error with an indication of ECONNREFUSED.
int listen(int sockfd, int backlog);
For more connection functions used in this article, please refer to this article for socket programming in C.
Approach:
After accepting the connection to the desired port, receive an integer from the client that defines the choice for reading or writing. Choice 1 indicates reader, while choice 2 indicates writer.
After successfully receiving data, call for pthread_create to create reader threads and writer threads.
After making successful connections to the server-client asks the user for input on the choice variable.
After getting the choice from the user, the client then sends this choice to the server to call the reader or writer thread by creating a client thread for the request.
Below is the implementation of the above approach:
Code for Server Side:
C
// C program for the Server Side // inet_addr#include <arpa/inet.h> // For threading, link with lpthread#include <pthread.h>#include <semaphore.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <sys/socket.h>#include <unistd.h> // Semaphore variablessem_t x, y;pthread_t tid;pthread_t writerthreads[100];pthread_t readerthreads[100];int readercount = 0; // Reader Functionvoid* reader(void* param){ // Lock the semaphore sem_wait(&x); readercount++; if (readercount == 1) sem_wait(&y); // Unlock the semaphore sem_post(&x); printf("\n%d reader is inside", readercount); sleep(5); // Lock the semaphore sem_wait(&x); readercount--; if (readercount == 0) { sem_post(&y); } // Lock the semaphore sem_post(&x); printf("\n%d Reader is leaving", readercount + 1); pthread_exit(NULL);} // Writer Functionvoid* writer(void* param){ printf("\nWriter is trying to enter"); // Lock the semaphore sem_wait(&y); printf("\nWriter has entered"); // Unlock the semaphore sem_post(&y); printf("\nWriter is leaving"); pthread_exit(NULL);} // Driver Codeint main(){ // Initialize variables int serverSocket, newSocket; struct sockaddr_in serverAddr; struct sockaddr_storage serverStorage; socklen_t addr_size; sem_init(&x, 0, 1); sem_init(&y, 0, 1); serverSocket = socket(AF_INET, SOCK_STREAM, 0); serverAddr.sin_addr.s_addr = INADDR_ANY; serverAddr.sin_family = AF_INET; serverAddr.sin_port = htons(8989); // Bind the socket to the // address and port number. bind(serverSocket, (struct sockaddr*)&serverAddr, sizeof(serverAddr)); // Listen on the socket, // with 40 max connection // requests queued if (listen(serverSocket, 50) == 0) printf("Listening\n"); else printf("Error\n"); // Array for thread pthread_t tid[60]; int i = 0; while (1) { addr_size = sizeof(serverStorage); // Extract the first // connection in the queue newSocket = accept(serverSocket, (struct sockaddr*)&serverStorage, &addr_size); int choice = 0; recv(newSocket, &choice, sizeof(choice), 0); if (choice == 1) { // Creater readers thread if (pthread_create(&readerthreads[i++], NULL, reader, &newSocket) != 0) // Error in creating thread printf("Failed to create thread\n"); } else if (choice == 2) { // Create writers thread if (pthread_create(&writerthreads[i++], NULL, writer, &newSocket) != 0) // Error in creating thread printf("Failed to create thread\n"); } if (i >= 50) { // Update i i = 0; while (i < 50) { // Suspend execution of // the calling thread // until the target // thread terminates pthread_join(writerthreads[i++], NULL); pthread_join(readerthreads[i++], NULL); } // Update i i = 0; } } return 0;}
Code for Client Side:
C
// C program for the Client Side#include <stdio.h>#include <stdlib.h>#include <string.h>#include <sys/socket.h> // inet_addr#include <arpa/inet.h>#include <unistd.h> // For threading, link with lpthread#include <pthread.h>#include <semaphore.h> // Function to send data to// server socket.void* clienthread(void* args){ int client_request = *((int*)args); int network_socket; // Create a stream socket network_socket = socket(AF_INET, SOCK_STREAM, 0); // Initialise port number and address struct sockaddr_in server_address; server_address.sin_family = AF_INET; server_address.sin_addr.s_addr = INADDR_ANY; server_address.sin_port = htons(8989); // Initiate a socket connection int connection_status = connect(network_socket, (struct sockaddr*)&server_address, sizeof(server_address)); // Check for connection error if (connection_status < 0) { puts("Error\n"); return 0; } printf("Connection established\n"); // Send data to the socket send(network_socket, &client_request, sizeof(client_request), 0); // Close the connection close(network_socket); pthread_exit(NULL); return 0;} // Driver Codeint main(){ printf("1. Read\n"); printf("2. Write\n"); // Input int choice; scanf("%d", &choice); pthread_t tid; // Create connection // depending on the input switch (choice) { case 1: { int client_request = 1; // Create thread pthread_create(&tid, NULL, clienthread, &client_request); sleep(20); break; } case 2: { int client_request = 2; // Create thread pthread_create(&tid, NULL, clienthread, &client_request); sleep(20); break; } default: printf("Invalid Input\n"); break; } // Suspend execution of // calling thread pthread_join(tid, NULL);}
Output:
sweetyty
sagartomar9927
anikakapoor
saurabh1990aror
Operating Systems-Process Management
Socket-programming
C Language
C Programs
Operating Systems
Operating Systems
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
TCP Server-Client implementation in C
Multithreading in C
Exception Handling in C++
'this' pointer in C++
UDP Server-Client implementation in C
Strings in C
UDP Server-Client implementation in C
Arrow operator -> in C/C++ with Examples
C Program to read contents of Whole File
Header files in C/C++ and its uses | [
{
"code": null,
"e": 24234,
"s": 24206,
"text": "\n08 Nov, 2021"
},
{
"code": null,
"e": 24639,
"s": 24234,
"text": "This tutorial assumes that the reader has a basic knowledge of socket programming, i.e has a familiarity with basic server and client models. In the basic model, the server handles only one client at a time, which is a big assumption if one wants to develop any scalable server model. The simple way to handle multiple clients would be to spawn a new thread for every new client connected to the server. "
},
{
"code": null,
"e": 24866,
"s": 24639,
"text": "Semaphores: Semaphore is simply a variable that is non-negative and shared between threads. This variable is used to solve the critical section problem and to achieve process synchronization in the multiprocessing environment."
},
{
"code": null,
"e": 25119,
"s": 24866,
"text": "sem_post: sem_post() increments (unlocks) the semaphore pointed to by sem. If the semaphore’s value consequently becomes greater than zero, then another process or thread blocked in a sem_wait(3) call will be woken up and proceed to lock the semaphore."
},
{
"code": null,
"e": 25168,
"s": 25119,
"text": "#include <semaphore.h>\nint sem_post(sem_t *sem);"
},
{
"code": null,
"e": 25568,
"s": 25168,
"text": "sem_wait: sem_wait() decrements (locks) the semaphore pointed to by sem. If the semaphore’s value is greater than zero, then the decrement proceeds and the function returns, immediately. If the semaphore currently has the value zero, then the call blocks until either it becomes possible to perform the decrement (i.e., the semaphore value rises above zero), or a signal handler interrupts the call."
},
{
"code": null,
"e": 25617,
"s": 25568,
"text": "#include <semaphore.h>\nint sem_wait(sem_t *sem);"
},
{
"code": null,
"e": 25698,
"s": 25617,
"text": "In this article, the Reader-Writers algorithm is implemented on the server-side."
},
{
"code": null,
"e": 25896,
"s": 25698,
"text": "Implementation: For the server-side, create two different threads; a reader thread, and a writer thread. First, declare a serverSocket, an integer, a variable to hold the return of socket function."
},
{
"code": null,
"e": 25947,
"s": 25896,
"text": "int serverSocket = socket(domain, type, protocol);"
},
{
"code": null,
"e": 26013,
"s": 25947,
"text": "serverSocket: Socket descriptor, an integer (like a file-handle)."
},
{
"code": null,
"e": 26108,
"s": 26013,
"text": "domain: Integer, communication domain e.g., AF_INET (IPv4 protocol), AF_INET6 (IPv6 protocol)."
},
{
"code": null,
"e": 26134,
"s": 26108,
"text": "type: Communication type."
},
{
"code": null,
"e": 26183,
"s": 26134,
"text": "SOCK_STREAM: TCP(reliable, connection-oriented)."
},
{
"code": null,
"e": 26228,
"s": 26183,
"text": "SOCK_DGRAM: UDP(unreliable, connectionless)."
},
{
"code": null,
"e": 26414,
"s": 26228,
"text": "protocol: Protocol value for Internet Protocol(IP), which is 0. This is the same number that appears on the protocol field in the IP header of a packet.(man protocols for more details)."
},
{
"code": null,
"e": 26484,
"s": 26414,
"text": "Then, after initializing all the necessary variables bind the socket."
},
{
"code": null,
"e": 26743,
"s": 26484,
"text": "bind: After the creation of the socket, the bind function binds the socket to the address and port number specified in addr(custom data structure). In the example code, we bind the server to the local host, hence INADDR_ANY is used to specify the IP address."
},
{
"code": null,
"e": 26823,
"s": 26743,
"text": "int bind(int sockfd, const struct sockaddr *addr, \n socklen_t addrlen);"
},
{
"code": null,
"e": 27177,
"s": 26823,
"text": "listen: It puts the server socket in a passive mode, where it waits for the client to approach the server to make a connection. The backlog defines the maximum length to which the queue of pending connections for sockfd may grow. If a connection request arrives when the queue is full, the client may receive an error with an indication of ECONNREFUSED."
},
{
"code": null,
"e": 27214,
"s": 27177,
"text": "int listen(int sockfd, int backlog);"
},
{
"code": null,
"e": 27324,
"s": 27214,
"text": "For more connection functions used in this article, please refer to this article for socket programming in C."
},
{
"code": null,
"e": 27334,
"s": 27324,
"text": "Approach:"
},
{
"code": null,
"e": 27529,
"s": 27334,
"text": "After accepting the connection to the desired port, receive an integer from the client that defines the choice for reading or writing. Choice 1 indicates reader, while choice 2 indicates writer."
},
{
"code": null,
"e": 27633,
"s": 27529,
"text": "After successfully receiving data, call for pthread_create to create reader threads and writer threads."
},
{
"code": null,
"e": 27738,
"s": 27633,
"text": "After making successful connections to the server-client asks the user for input on the choice variable."
},
{
"code": null,
"e": 27907,
"s": 27738,
"text": "After getting the choice from the user, the client then sends this choice to the server to call the reader or writer thread by creating a client thread for the request."
},
{
"code": null,
"e": 27958,
"s": 27907,
"text": "Below is the implementation of the above approach:"
},
{
"code": null,
"e": 27980,
"s": 27958,
"text": "Code for Server Side:"
},
{
"code": null,
"e": 27982,
"s": 27980,
"text": "C"
},
{
"code": "// C program for the Server Side // inet_addr#include <arpa/inet.h> // For threading, link with lpthread#include <pthread.h>#include <semaphore.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <sys/socket.h>#include <unistd.h> // Semaphore variablessem_t x, y;pthread_t tid;pthread_t writerthreads[100];pthread_t readerthreads[100];int readercount = 0; // Reader Functionvoid* reader(void* param){ // Lock the semaphore sem_wait(&x); readercount++; if (readercount == 1) sem_wait(&y); // Unlock the semaphore sem_post(&x); printf(\"\\n%d reader is inside\", readercount); sleep(5); // Lock the semaphore sem_wait(&x); readercount--; if (readercount == 0) { sem_post(&y); } // Lock the semaphore sem_post(&x); printf(\"\\n%d Reader is leaving\", readercount + 1); pthread_exit(NULL);} // Writer Functionvoid* writer(void* param){ printf(\"\\nWriter is trying to enter\"); // Lock the semaphore sem_wait(&y); printf(\"\\nWriter has entered\"); // Unlock the semaphore sem_post(&y); printf(\"\\nWriter is leaving\"); pthread_exit(NULL);} // Driver Codeint main(){ // Initialize variables int serverSocket, newSocket; struct sockaddr_in serverAddr; struct sockaddr_storage serverStorage; socklen_t addr_size; sem_init(&x, 0, 1); sem_init(&y, 0, 1); serverSocket = socket(AF_INET, SOCK_STREAM, 0); serverAddr.sin_addr.s_addr = INADDR_ANY; serverAddr.sin_family = AF_INET; serverAddr.sin_port = htons(8989); // Bind the socket to the // address and port number. bind(serverSocket, (struct sockaddr*)&serverAddr, sizeof(serverAddr)); // Listen on the socket, // with 40 max connection // requests queued if (listen(serverSocket, 50) == 0) printf(\"Listening\\n\"); else printf(\"Error\\n\"); // Array for thread pthread_t tid[60]; int i = 0; while (1) { addr_size = sizeof(serverStorage); // Extract the first // connection in the queue newSocket = accept(serverSocket, (struct sockaddr*)&serverStorage, &addr_size); int choice = 0; recv(newSocket, &choice, sizeof(choice), 0); if (choice == 1) { // Creater readers thread if (pthread_create(&readerthreads[i++], NULL, reader, &newSocket) != 0) // Error in creating thread printf(\"Failed to create thread\\n\"); } else if (choice == 2) { // Create writers thread if (pthread_create(&writerthreads[i++], NULL, writer, &newSocket) != 0) // Error in creating thread printf(\"Failed to create thread\\n\"); } if (i >= 50) { // Update i i = 0; while (i < 50) { // Suspend execution of // the calling thread // until the target // thread terminates pthread_join(writerthreads[i++], NULL); pthread_join(readerthreads[i++], NULL); } // Update i i = 0; } } return 0;}",
"e": 31371,
"s": 27982,
"text": null
},
{
"code": null,
"e": 31396,
"s": 31374,
"text": "Code for Client Side:"
},
{
"code": null,
"e": 31400,
"s": 31398,
"text": "C"
},
{
"code": "// C program for the Client Side#include <stdio.h>#include <stdlib.h>#include <string.h>#include <sys/socket.h> // inet_addr#include <arpa/inet.h>#include <unistd.h> // For threading, link with lpthread#include <pthread.h>#include <semaphore.h> // Function to send data to// server socket.void* clienthread(void* args){ int client_request = *((int*)args); int network_socket; // Create a stream socket network_socket = socket(AF_INET, SOCK_STREAM, 0); // Initialise port number and address struct sockaddr_in server_address; server_address.sin_family = AF_INET; server_address.sin_addr.s_addr = INADDR_ANY; server_address.sin_port = htons(8989); // Initiate a socket connection int connection_status = connect(network_socket, (struct sockaddr*)&server_address, sizeof(server_address)); // Check for connection error if (connection_status < 0) { puts(\"Error\\n\"); return 0; } printf(\"Connection established\\n\"); // Send data to the socket send(network_socket, &client_request, sizeof(client_request), 0); // Close the connection close(network_socket); pthread_exit(NULL); return 0;} // Driver Codeint main(){ printf(\"1. Read\\n\"); printf(\"2. Write\\n\"); // Input int choice; scanf(\"%d\", &choice); pthread_t tid; // Create connection // depending on the input switch (choice) { case 1: { int client_request = 1; // Create thread pthread_create(&tid, NULL, clienthread, &client_request); sleep(20); break; } case 2: { int client_request = 2; // Create thread pthread_create(&tid, NULL, clienthread, &client_request); sleep(20); break; } default: printf(\"Invalid Input\\n\"); break; } // Suspend execution of // calling thread pthread_join(tid, NULL);}",
"e": 33466,
"s": 31400,
"text": null
},
{
"code": null,
"e": 33477,
"s": 33469,
"text": "Output:"
},
{
"code": null,
"e": 33490,
"s": 33481,
"text": "sweetyty"
},
{
"code": null,
"e": 33505,
"s": 33490,
"text": "sagartomar9927"
},
{
"code": null,
"e": 33517,
"s": 33505,
"text": "anikakapoor"
},
{
"code": null,
"e": 33533,
"s": 33517,
"text": "saurabh1990aror"
},
{
"code": null,
"e": 33570,
"s": 33533,
"text": "Operating Systems-Process Management"
},
{
"code": null,
"e": 33589,
"s": 33570,
"text": "Socket-programming"
},
{
"code": null,
"e": 33600,
"s": 33589,
"text": "C Language"
},
{
"code": null,
"e": 33611,
"s": 33600,
"text": "C Programs"
},
{
"code": null,
"e": 33629,
"s": 33611,
"text": "Operating Systems"
},
{
"code": null,
"e": 33647,
"s": 33629,
"text": "Operating Systems"
},
{
"code": null,
"e": 33745,
"s": 33647,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 33754,
"s": 33745,
"text": "Comments"
},
{
"code": null,
"e": 33767,
"s": 33754,
"text": "Old Comments"
},
{
"code": null,
"e": 33805,
"s": 33767,
"text": "TCP Server-Client implementation in C"
},
{
"code": null,
"e": 33825,
"s": 33805,
"text": "Multithreading in C"
},
{
"code": null,
"e": 33851,
"s": 33825,
"text": "Exception Handling in C++"
},
{
"code": null,
"e": 33873,
"s": 33851,
"text": "'this' pointer in C++"
},
{
"code": null,
"e": 33911,
"s": 33873,
"text": "UDP Server-Client implementation in C"
},
{
"code": null,
"e": 33924,
"s": 33911,
"text": "Strings in C"
},
{
"code": null,
"e": 33962,
"s": 33924,
"text": "UDP Server-Client implementation in C"
},
{
"code": null,
"e": 34003,
"s": 33962,
"text": "Arrow operator -> in C/C++ with Examples"
},
{
"code": null,
"e": 34044,
"s": 34003,
"text": "C Program to read contents of Whole File"
}
] |
Spatial Cross-Validation Using scikit-learn | by Chiara Ledesma | Towards Data Science | If you’d like to skip straight to the code, jump ahead to the section Spatial cross-validation implementation on scikit-learn.
A typical and useful assumption for statistical inference is that the data is independently and identically distributed (IID). We can take a random subset of patients and predict their likelihood for diabetes with a normal train-test split, no problem. In practice, however, there are some types of datasets where this assumption doesn’t hold, and a typical train-test split can introduce data leakage. When the distribution of the variable of interest is not random, the data is said to be autocorrelated — and this has implications on machine learning models.
We can find spatial autocorrelation on many datasets with a geospatial component. Consider the maps below:
If data were IID, it would look like the map on the right. But in real life, we have maps like on the left where we can easily observe patterns. The first law of geography states that nearer things are more related to each other than distant things. Attributes usually aren’t randomly distributed across a location – it’s more likely that an area is very similar to its neighbors. In the example above, the population level of a single area is likely to be similar of an adjacent area, as opposed to a distant one.
When data is autocorrelated, we might want to be extra wary about overfitting. In this case, if we use random samples for train-test splits or cross-validation, we violate the IID assumption since the samples are not statistically independent. Area A could be in the training set, but an Area Z in the validation set happens to be only a kilometer away from Area A while also sharing very similar features. The model would have a more accurate prediction for Area Z since it saw a very similar example in the training set. To fix this, grouping the data by area would prevent the model from peeking into data it shouldn’t be seeing. Here’s how spatial cross-validation would look like:
A good question to ask here: do we always want to prevent overfitting? Intuitively, yes. But as with most machine learning techniques, it depends. If it fits your use case, overfitting may even be beneficial!
Let’s say we had a randomly sampled national survey on wealth. We have wealth values of a distributed set of households across the country, and we’d like to infer the wealth levels for unsurveyed areas to get complete wealth data for the entire country. Here, the goal is only to fill in spatial gaps. Training with the data of the nearest areas would certainly help fill in the gaps more accurately!
It’s a different story if we were trying to build a generalizable model — say, one that we would apply to another country altogether. [2] In this case, exploiting the spatial autocorrelation property during training will likely inflate the accuracy of a potentially poor model. This is especially concerning if we use this seemingly-good model on an area where there is no ground truth for verifying.
To address this, we’d have to split areas between training and testing. If this were a normal train-test split, we could easily filter out a few areas out for our test data. In other cases, however, we would want to utilize all of the available data by using cross-validation. Unfortunately, scikit-learn’s built-in CV functions split the data randomly or by target variable, not by chosen columns. A workaround can be implemented, taking into consideration that our dataset includes geocoded elements.
The code below assumes that we have a column with administrative boundaries (e.g. city, state, province). If you only have coordinates, you could technically cluster the data first (e.g. with KMeans), but you might be better off mapping them first to a dataset with their administrative boundaries using a library like GeoPandas. (Assigning them a meaningful value like “city” makes the results more interpretable.)
from sklearn.model_selection import GroupKFold, cross_val_predictcities = df['city'].valuesgroup_kfold = GroupKFold(n_splits=5) # Generator for the train/test indicescity_kfold = group_kfold.split(X, y, cities) # Create a nested list of train and test indices for each foldtrain_indices, test_indices = [list(traintest) for traintest in zip(*city_kfold)]city_cv = [*zip(train_indices,test_indices)]predictions = cross_val_predict(model, X, y, cv=city_cv)
Now we have a CV or KFold object that we can plug in to many of Scikit-learn’s cross-validated fitting functions, like cross_val_predict as shown above or even for nested cross-validation with parameter grid search like RandomizedSearchCV. It’s only a few lines of code, but hopefully it helps anyone Googling spatial autocorrelation for the first time. Happy modeling!
I highly appreciate feedback on implementation, writing, or intuition. Any suggestions for how this could have been better? Please feel free to reach out at [email protected] or on my LinkedIn.
[1] R. Lovelace, J. Nowosad, and J. Muenchow. Statistical Learning: Spatial CV (2021), Geocomputation with R.
[2] P. Deville et al. Dynamic population mapping using mobile phone data (2014), Proceedings of the National Academy of Sciences of the United States of America. | [
{
"code": null,
"e": 299,
"s": 172,
"text": "If you’d like to skip straight to the code, jump ahead to the section Spatial cross-validation implementation on scikit-learn."
},
{
"code": null,
"e": 861,
"s": 299,
"text": "A typical and useful assumption for statistical inference is that the data is independently and identically distributed (IID). We can take a random subset of patients and predict their likelihood for diabetes with a normal train-test split, no problem. In practice, however, there are some types of datasets where this assumption doesn’t hold, and a typical train-test split can introduce data leakage. When the distribution of the variable of interest is not random, the data is said to be autocorrelated — and this has implications on machine learning models."
},
{
"code": null,
"e": 968,
"s": 861,
"text": "We can find spatial autocorrelation on many datasets with a geospatial component. Consider the maps below:"
},
{
"code": null,
"e": 1483,
"s": 968,
"text": "If data were IID, it would look like the map on the right. But in real life, we have maps like on the left where we can easily observe patterns. The first law of geography states that nearer things are more related to each other than distant things. Attributes usually aren’t randomly distributed across a location – it’s more likely that an area is very similar to its neighbors. In the example above, the population level of a single area is likely to be similar of an adjacent area, as opposed to a distant one."
},
{
"code": null,
"e": 2169,
"s": 1483,
"text": "When data is autocorrelated, we might want to be extra wary about overfitting. In this case, if we use random samples for train-test splits or cross-validation, we violate the IID assumption since the samples are not statistically independent. Area A could be in the training set, but an Area Z in the validation set happens to be only a kilometer away from Area A while also sharing very similar features. The model would have a more accurate prediction for Area Z since it saw a very similar example in the training set. To fix this, grouping the data by area would prevent the model from peeking into data it shouldn’t be seeing. Here’s how spatial cross-validation would look like:"
},
{
"code": null,
"e": 2378,
"s": 2169,
"text": "A good question to ask here: do we always want to prevent overfitting? Intuitively, yes. But as with most machine learning techniques, it depends. If it fits your use case, overfitting may even be beneficial!"
},
{
"code": null,
"e": 2779,
"s": 2378,
"text": "Let’s say we had a randomly sampled national survey on wealth. We have wealth values of a distributed set of households across the country, and we’d like to infer the wealth levels for unsurveyed areas to get complete wealth data for the entire country. Here, the goal is only to fill in spatial gaps. Training with the data of the nearest areas would certainly help fill in the gaps more accurately!"
},
{
"code": null,
"e": 3180,
"s": 2779,
"text": "It’s a different story if we were trying to build a generalizable model — say, one that we would apply to another country altogether. [2] In this case, exploiting the spatial autocorrelation property during training will likely inflate the accuracy of a potentially poor model. This is especially concerning if we use this seemingly-good model on an area where there is no ground truth for verifying."
},
{
"code": null,
"e": 3683,
"s": 3180,
"text": "To address this, we’d have to split areas between training and testing. If this were a normal train-test split, we could easily filter out a few areas out for our test data. In other cases, however, we would want to utilize all of the available data by using cross-validation. Unfortunately, scikit-learn’s built-in CV functions split the data randomly or by target variable, not by chosen columns. A workaround can be implemented, taking into consideration that our dataset includes geocoded elements."
},
{
"code": null,
"e": 4099,
"s": 3683,
"text": "The code below assumes that we have a column with administrative boundaries (e.g. city, state, province). If you only have coordinates, you could technically cluster the data first (e.g. with KMeans), but you might be better off mapping them first to a dataset with their administrative boundaries using a library like GeoPandas. (Assigning them a meaningful value like “city” makes the results more interpretable.)"
},
{
"code": null,
"e": 4555,
"s": 4099,
"text": "from sklearn.model_selection import GroupKFold, cross_val_predictcities = df['city'].valuesgroup_kfold = GroupKFold(n_splits=5) # Generator for the train/test indicescity_kfold = group_kfold.split(X, y, cities) # Create a nested list of train and test indices for each foldtrain_indices, test_indices = [list(traintest) for traintest in zip(*city_kfold)]city_cv = [*zip(train_indices,test_indices)]predictions = cross_val_predict(model, X, y, cv=city_cv)"
},
{
"code": null,
"e": 4925,
"s": 4555,
"text": "Now we have a CV or KFold object that we can plug in to many of Scikit-learn’s cross-validated fitting functions, like cross_val_predict as shown above or even for nested cross-validation with parameter grid search like RandomizedSearchCV. It’s only a few lines of code, but hopefully it helps anyone Googling spatial autocorrelation for the first time. Happy modeling!"
},
{
"code": null,
"e": 5125,
"s": 4925,
"text": "I highly appreciate feedback on implementation, writing, or intuition. Any suggestions for how this could have been better? Please feel free to reach out at [email protected] or on my LinkedIn."
},
{
"code": null,
"e": 5235,
"s": 5125,
"text": "[1] R. Lovelace, J. Nowosad, and J. Muenchow. Statistical Learning: Spatial CV (2021), Geocomputation with R."
}
] |
CNN application on structured data-Automated Feature Extraction | by Sourish Dey | Towards Data Science | Written: 13th Aug 2018 by Sourish Dey
https://www.linkedin.com/in/sourish-dey-03420b1a/
Importance Feature Engineering:
In my previous article, I discussed the importance of the creation of rich features from the limited number of features. Indeed, the real quality of machine learning/deep learning model comes from extensive feature engineering than from the modeling technique itself. While specific machine learning technique may work best for particular business problem/dataset, features are the universal drivers/critical components for any modeling project. Extracting as much information as possible from the available data sets is crucial to creating an effective solution.
In this article I will discuss about a not so popular method of feature engineering in industry(at least for structured data) — generating features from structured data using CNN(yes you heard it correct, Convolutional Neural Network), a family of modern deep learning model, extensively used in the area of computer vision problem. We will also test this method on a small data to create features, hands-on- as if It’s Not Run, It’s Not Done.
Traditionally analysts/data scientists used to create features using a manual process from domain/business knowledge. Often it’s called handcrafted feature engineering. While in data science we can’t deny the importance of domain knowledge, this type of feature engineering has some drawbacks:
1. Tedious: Manual feature engineering can be a tedious process. How many can new features be created from a list of parent variables? For example from the date variable, a data scientist can create 4 new features (month, year, hour, and day in the week) can be created. However, another data scientist can create 5 additional features(weekend indicator, festive season indicator, X-mass month indicator, seasonality index, week no in a month and so on). Is there any relationship/interaction with any other variable? So manual feature engineering is limited both by human time constraints and imagination: we simply cannot conceive of every possible feature that will be useful.
2. Influence of Human Bias: More often than not any human being working on a particular domain/ modeling project, builds up deep bias for some features(especially if it’s created by that analyst earlier!), irrespective of it adds value to the model or not.
Here it comes the power of automated feature engineering. Here no of features can be created is practically infinite and without any human bias. Also, this captures all possible complex non-linear interactions among features. Off course we can apply dimension reduction/feature selection technique at any point in time to get rid of redundant/zero importance features.
Here the business objective is to predict the probability of credit default based on credit card owner’s payment status, balance and payment history monitored for past few vintages(last 6 months from the predicted period). For sake of simplicity let’s ignore the lag period(generally there is a lag between customer information extraction and data upload in the system for analysis). The motivation of this business problem and data preparation is from https://medium.com/@guaisang/credit-default-prediction-with-logistic-regression-b5bd89f2799f.
I have not used cross-sectional components(eg. Gender, Education etc.) in the data and only kept time series variables(balance, payment history etc.) to introduce CNN in this business problem. The goal of this article is to conceptualize and implement CNN on this structured data and generate 100 new features from this data using CNN model. You can get the data and entire code here.
About the data:
The datasets utilizes a binary variable, ‘default payment next month’ (Yes = 1, No = 0), as the response variable. There are 18 features(excluding ID) in this set:
1:6 =X1 the repayment status in the last month of the prediction period; . . .;X6 = the repayment status in the 6th month before prediction period. The measurement scale for the repayment status is: -1 = pay duly; 1 = payment delay for one month; 2 = payment delay for two months; . . .; 8 = payment delay for eight months; 9 = payment delay for nine months and above. 0 means there is no transaction
X7 = amount of bill statement in last month of reference time frame;.... X12 = amount of bill statement in 6th month before the reference time frame;
X13 = amount of bill statement in last month of reference time frame;.... X18 = amount of payment in 6th month before the reference time frame;
Deep Learning methods, specifically CNNs, have seen a lot of success in the domain of image-based data, where the data offers a clearly structured topology in the regular lattice of pixels.Although detailed discussion about convolutional neural network (CNN, or ConvNet) is beyond scope of this article, let’s take a look at what makes CNNs so popular?
Deep Learning methods, specifically CNNs, have seen a lot of success in the domain of image-based data, where the data offers a clearly structured topology in the regular lattice of pixels. Although detailed discussion about CNN or ConvNet is beyond scope of this article, let’s take a look what makes CNNs so popular?
Reduced Parameters(parameter sharing): During convolution operation (layer), each output value (convolved feature in the figure) is not required to connected to every neuron in the previous layer (image in the figure), but only to those, called receptive fields, where the convolution kernel is applied currently. This characteristic of convolution layer is called Local Connectivity.Also same weights are applied over the convolving until the next update of the parameters. This characteristic of convolution layer is called Parameter Sharing.These reduced the number of parameters needed dramatically compared to usual ANN(artificial neural network) structure, where there is a connection between every single pair of input/output neuron.
Shift/Translation In-variance: It means that when the input shifts the output also shifts but stays otherwise unchanged. To be specific to an image, you can recognize an object as an object, even when its appearance varies in some way.
So in nutshell to apply CNN on any data, the data needs to be prepared in a way, so that there are local patterns and the same local patterns are relevant everywhere. To specific our data we have time series horizons of events(balance, payments etc.) for an individual customer, which makes the data full of local patterns for her and hence these parameters can be shared across customers. We just need to prepare the data suitable to feed into a CNN- feature matrix of for individual customers, same like an image frame matrix of d * w * n(d, w and n is the depth, width and no of the channel of an image frame).
To elaborate if we have N customers with m features(here balance/payment etc.) across t time horizons(here month1, month2 etc.) for p different trades(trades are different lines of credit, such as retail cards, mortgage etc.). So simply m features, t time horizons and p trades for individual customers are analogous to width, depth and no of channels of an image feature array. Precisely for our data the dimension for each customer will be m * t * p and for the entire data will be N*m*t*p. Now this makes the originally structured data into image frame type data, ideal to apply CNN to extract complex non-linear local patterns across customers by a convolution operation.
The original data set was consisting of one trade- retail card. To make it more relevant and more challenging I created dummy data set(tagging target variable status as original data) for one additional trades — mortgage. The data is sparser than retail card data and values may not be 100% logical. The final data set(CreditDefault.csv) is kept here.
So we have 30k distinct customer ids and total 60k observations, first 30k observations are of the retail card, next 30k is for the mortgage.
A detailed solution including data preparation code is at https://github.com/nitsourish/CNN-automated-Feature-Extraction/blob/master/CNN_feature_extraction.ipynb. This is the tricky part of this problem is to prepare the data in the format(image like format), so that we can apply CNN.Precisely for our data the dimension for each customer will be 3(no of features) * 6(time horizons) * 2(trades) and there will be 30000 frames of this dimension. So for the entire data it will be an array of will be 30000 * 3(width) * 6(depth) * 2(no of channels). So the data will be perfect to train a Convolutional network.
After preparation of channel specific data, we see the dimension:
shape of channel1(retail)data: (30000, 3, 6, 1)shape of channel2(mortgage)data: (30000, 3, 6, 1)
After merging these two arrays the data is proper to feed in CNN as the input volume to extract complex features with non-linear interaction.
shape of input volume(layer)data: (30000, 3, 6, 2)
Now the data looks like image frame data image like data (30000 image frame of volume 3*6*2). Now we need to map target variable(default payment next month) against customer ID in one hot encoding format.
X = np.concatenate((retail, mort),axis=3)Y = event_id[['default payment next month']].valuesY = to_categorical(Y,2)In our data we have payment default rate is: 28.402671 percent
In the data we have 28.40% payment_default rate. Although event rate is not 50%, we can say it’s fairly balanced data. so no need to do any weight correction
To extract features from CNN model first we need to train the CNN network with last sigmoid/logistic dense layer(here dimension 2) w.r.t. target variable. The objective of the training network is to identify the correct weights for the network by multiple forward and backward iterations, which eventually try to minimize binary cross entropy(misclassification cost). Here I will use keras framework with back-end as TensorFlow(tf). For our business problem AUC is the evaluation metric and we will do the optimization by maximizing AUC value in each epoch(Keras doesn’t have default AUC metric. However we can leverage tf to create customized evaluation function for AUC.)
We built following CNN with 4 conv layers(conv + activation + pooling(optional)) and 2 FC(fully connected layers) before reaching to the last sigmoid output layer.
We trained our model for epochs = 100 utilizing early stopping to prevent overfitting.It took less than 10 mins time to train using my NVIDIA GTX GeForce 1060 GPU with val_auc = 0.8317.
Feature Extraction Methodology
Now by using a pre-trained model, we can directly apply these weights on a data, removing the last sigmoid/logistic layer(in this problem until the dense layer of dimension 100). We can use this to any new data of same business problem to calculate these features.We need to just feed forward the network and it will directly map final weights to calculate features at some intermediate layer, without building the network again.This is a kind of transfer learning.Based on our requirement of no of features we can extract features at any intermediate dense layer with the desired dimension. For this problem, we will extract feature using an intermediate model till ‘feature_dense’ layer of the CNN.
#Preparing Indermediate model-removing last sigmoid layerintermediate_layer_model = Model(inputs=model.input,outputs=model.get_layer('feature_dense').output)intermediate_layer_model.summary()
The output layer dimension is 100, so if we predict using this network on a new data with the same input dimension, we can create 100 new complex features.
#predict to get featured datafeauture_engg_data = intermediate_layer_model.predict(X)feauture_engg_data = pd.DataFrame(feauture_engg_data)print('feauture_engg_data shape:', feauture_engg_data.shape)feauture_engg_data shape: (30000, 100)
We successfully captured 100 complex interactions among raw variables.
· Let’s have some sneak-peak whether these features have any value. Although there are a few better ways, for sake of simplicity let’s capture some bivariate relationship of these new features with the target variable ‘default payment next month’.Although for categorical target variable Correlation is not 100% correct method, we will calculate the correlation of all new values with the target as an approximation of the variables which may be important for the final model.
#Sorting correlation values in decsending ordernew_corrs = sorted(new_corrs, key = lambda x: abs(x[1]), reverse = True)#Let's see top 10 correlation valuesnew_corrs[:10] [('PAY_1', 0.32479372847862253), ('PAY_2', 0.26355120167216467), ('PAY_3', 0.2352525137249163), ('feat_78', -0.22173805212223915), ('PAY_4', 0.21661363684242424), ('PAY_5', 0.20414891387616674), ('feat_86', -0.20047655459374053), ('feat_6', -0.19189993720885604), ('PAY_6', 0.1868663616535449), ('feat_3', -0.17394080015462873)]
We can see 4 newly created variables(feat_78,feat_86,feat_6,feat_3) are in top 10, in terms of correlation(pseudo although) with ‘default payment next month’. Although based on this nothing concretely can be said about the predictive strength of these variable, at least these variable are worthy of further investigation.
We can also look at the KDE(kernel density estimation) plot of the highest correlated variables, in terms of absolute magnitude correlation.
Now the critical ask is for this problem why CNN/deep learning method is only used for feature extraction. Why not use it as a classifier also. Two main reasons is there:
Local pattern: The data we used in this business problem(which is applicable to most of the scenarios where we use structural data), consists cross sectional(static)variables as well, where we will not find any local pattern. So we can’t use CNN on the entire data as classifier. Of course for the data which holds Shift/Translation Invariance property, we can use CNN as end classifier.
Infrastructural challenge: Building in large-scale industrial data and bringing into production requires significant infrastructural support(GPUs, AWS etc.), which may not available to every organization.
Latency in model run: Even with proper infrastructure forward propagation of decently complex deep learning models takes significantly higher time than highly effective classifiers like XGBoost, RF, SVM etc. Indeed some application, which requires blazing fast real-time prediction, the best solution, in that case, is to extract feature with an automated technique like CNN feature extraction and then to add relatively simpler classifier.
Regulatory challenge: Even with the immense focus on machine learning/AI, organizations especially into the domain of banking/insurance/finance have to go through internal/external regulatory processes before implementation of predictive models and it may require painstaking persuasion to make these latest techniques on the production system. On the contrary, if the end classifier is the traditional model, there may not be a challenge on a modeling methodology perspective.
As modern Artificial Intelligence and Deep Learning guru, Andrew Ng accurately said, “...applied machine learning is basically feature engineering.”, the importance of creating the meaningful feature space cannot be overstated and automated feature engineering techniques aim to help the data scientist with the problem of feature creation seamlessly building hundreds or thousands of new features from raw data set. However, the purpose is not to replace data scientist. Rather will allow her to focus on other valuable parts of the machine learning pipeline, such as feature selection, exploring new methodology, delivering robust models into production etc. We just discussed one of the potential methods of automated feature engineering. Surely there are a few other comparable techniques. Love to explore those in future. Meanwhile eager to hear the other applications of CNN on structured data(relational database), in any other business problems. | [
{
"code": null,
"e": 210,
"s": 172,
"text": "Written: 13th Aug 2018 by Sourish Dey"
},
{
"code": null,
"e": 260,
"s": 210,
"text": "https://www.linkedin.com/in/sourish-dey-03420b1a/"
},
{
"code": null,
"e": 292,
"s": 260,
"text": "Importance Feature Engineering:"
},
{
"code": null,
"e": 856,
"s": 292,
"text": "In my previous article, I discussed the importance of the creation of rich features from the limited number of features. Indeed, the real quality of machine learning/deep learning model comes from extensive feature engineering than from the modeling technique itself. While specific machine learning technique may work best for particular business problem/dataset, features are the universal drivers/critical components for any modeling project. Extracting as much information as possible from the available data sets is crucial to creating an effective solution."
},
{
"code": null,
"e": 1300,
"s": 856,
"text": "In this article I will discuss about a not so popular method of feature engineering in industry(at least for structured data) — generating features from structured data using CNN(yes you heard it correct, Convolutional Neural Network), a family of modern deep learning model, extensively used in the area of computer vision problem. We will also test this method on a small data to create features, hands-on- as if It’s Not Run, It’s Not Done."
},
{
"code": null,
"e": 1594,
"s": 1300,
"text": "Traditionally analysts/data scientists used to create features using a manual process from domain/business knowledge. Often it’s called handcrafted feature engineering. While in data science we can’t deny the importance of domain knowledge, this type of feature engineering has some drawbacks:"
},
{
"code": null,
"e": 2274,
"s": 1594,
"text": "1. Tedious: Manual feature engineering can be a tedious process. How many can new features be created from a list of parent variables? For example from the date variable, a data scientist can create 4 new features (month, year, hour, and day in the week) can be created. However, another data scientist can create 5 additional features(weekend indicator, festive season indicator, X-mass month indicator, seasonality index, week no in a month and so on). Is there any relationship/interaction with any other variable? So manual feature engineering is limited both by human time constraints and imagination: we simply cannot conceive of every possible feature that will be useful."
},
{
"code": null,
"e": 2531,
"s": 2274,
"text": "2. Influence of Human Bias: More often than not any human being working on a particular domain/ modeling project, builds up deep bias for some features(especially if it’s created by that analyst earlier!), irrespective of it adds value to the model or not."
},
{
"code": null,
"e": 2900,
"s": 2531,
"text": "Here it comes the power of automated feature engineering. Here no of features can be created is practically infinite and without any human bias. Also, this captures all possible complex non-linear interactions among features. Off course we can apply dimension reduction/feature selection technique at any point in time to get rid of redundant/zero importance features."
},
{
"code": null,
"e": 3447,
"s": 2900,
"text": "Here the business objective is to predict the probability of credit default based on credit card owner’s payment status, balance and payment history monitored for past few vintages(last 6 months from the predicted period). For sake of simplicity let’s ignore the lag period(generally there is a lag between customer information extraction and data upload in the system for analysis). The motivation of this business problem and data preparation is from https://medium.com/@guaisang/credit-default-prediction-with-logistic-regression-b5bd89f2799f."
},
{
"code": null,
"e": 3832,
"s": 3447,
"text": "I have not used cross-sectional components(eg. Gender, Education etc.) in the data and only kept time series variables(balance, payment history etc.) to introduce CNN in this business problem. The goal of this article is to conceptualize and implement CNN on this structured data and generate 100 new features from this data using CNN model. You can get the data and entire code here."
},
{
"code": null,
"e": 3848,
"s": 3832,
"text": "About the data:"
},
{
"code": null,
"e": 4012,
"s": 3848,
"text": "The datasets utilizes a binary variable, ‘default payment next month’ (Yes = 1, No = 0), as the response variable. There are 18 features(excluding ID) in this set:"
},
{
"code": null,
"e": 4413,
"s": 4012,
"text": "1:6 =X1 the repayment status in the last month of the prediction period; . . .;X6 = the repayment status in the 6th month before prediction period. The measurement scale for the repayment status is: -1 = pay duly; 1 = payment delay for one month; 2 = payment delay for two months; . . .; 8 = payment delay for eight months; 9 = payment delay for nine months and above. 0 means there is no transaction"
},
{
"code": null,
"e": 4563,
"s": 4413,
"text": "X7 = amount of bill statement in last month of reference time frame;.... X12 = amount of bill statement in 6th month before the reference time frame;"
},
{
"code": null,
"e": 4707,
"s": 4563,
"text": "X13 = amount of bill statement in last month of reference time frame;.... X18 = amount of payment in 6th month before the reference time frame;"
},
{
"code": null,
"e": 5060,
"s": 4707,
"text": "Deep Learning methods, specifically CNNs, have seen a lot of success in the domain of image-based data, where the data offers a clearly structured topology in the regular lattice of pixels.Although detailed discussion about convolutional neural network (CNN, or ConvNet) is beyond scope of this article, let’s take a look at what makes CNNs so popular?"
},
{
"code": null,
"e": 5379,
"s": 5060,
"text": "Deep Learning methods, specifically CNNs, have seen a lot of success in the domain of image-based data, where the data offers a clearly structured topology in the regular lattice of pixels. Although detailed discussion about CNN or ConvNet is beyond scope of this article, let’s take a look what makes CNNs so popular?"
},
{
"code": null,
"e": 6120,
"s": 5379,
"text": "Reduced Parameters(parameter sharing): During convolution operation (layer), each output value (convolved feature in the figure) is not required to connected to every neuron in the previous layer (image in the figure), but only to those, called receptive fields, where the convolution kernel is applied currently. This characteristic of convolution layer is called Local Connectivity.Also same weights are applied over the convolving until the next update of the parameters. This characteristic of convolution layer is called Parameter Sharing.These reduced the number of parameters needed dramatically compared to usual ANN(artificial neural network) structure, where there is a connection between every single pair of input/output neuron."
},
{
"code": null,
"e": 6356,
"s": 6120,
"text": "Shift/Translation In-variance: It means that when the input shifts the output also shifts but stays otherwise unchanged. To be specific to an image, you can recognize an object as an object, even when its appearance varies in some way."
},
{
"code": null,
"e": 6970,
"s": 6356,
"text": "So in nutshell to apply CNN on any data, the data needs to be prepared in a way, so that there are local patterns and the same local patterns are relevant everywhere. To specific our data we have time series horizons of events(balance, payments etc.) for an individual customer, which makes the data full of local patterns for her and hence these parameters can be shared across customers. We just need to prepare the data suitable to feed into a CNN- feature matrix of for individual customers, same like an image frame matrix of d * w * n(d, w and n is the depth, width and no of the channel of an image frame)."
},
{
"code": null,
"e": 7646,
"s": 6970,
"text": "To elaborate if we have N customers with m features(here balance/payment etc.) across t time horizons(here month1, month2 etc.) for p different trades(trades are different lines of credit, such as retail cards, mortgage etc.). So simply m features, t time horizons and p trades for individual customers are analogous to width, depth and no of channels of an image feature array. Precisely for our data the dimension for each customer will be m * t * p and for the entire data will be N*m*t*p. Now this makes the originally structured data into image frame type data, ideal to apply CNN to extract complex non-linear local patterns across customers by a convolution operation."
},
{
"code": null,
"e": 7998,
"s": 7646,
"text": "The original data set was consisting of one trade- retail card. To make it more relevant and more challenging I created dummy data set(tagging target variable status as original data) for one additional trades — mortgage. The data is sparser than retail card data and values may not be 100% logical. The final data set(CreditDefault.csv) is kept here."
},
{
"code": null,
"e": 8140,
"s": 7998,
"text": "So we have 30k distinct customer ids and total 60k observations, first 30k observations are of the retail card, next 30k is for the mortgage."
},
{
"code": null,
"e": 8752,
"s": 8140,
"text": "A detailed solution including data preparation code is at https://github.com/nitsourish/CNN-automated-Feature-Extraction/blob/master/CNN_feature_extraction.ipynb. This is the tricky part of this problem is to prepare the data in the format(image like format), so that we can apply CNN.Precisely for our data the dimension for each customer will be 3(no of features) * 6(time horizons) * 2(trades) and there will be 30000 frames of this dimension. So for the entire data it will be an array of will be 30000 * 3(width) * 6(depth) * 2(no of channels). So the data will be perfect to train a Convolutional network."
},
{
"code": null,
"e": 8818,
"s": 8752,
"text": "After preparation of channel specific data, we see the dimension:"
},
{
"code": null,
"e": 8915,
"s": 8818,
"text": "shape of channel1(retail)data: (30000, 3, 6, 1)shape of channel2(mortgage)data: (30000, 3, 6, 1)"
},
{
"code": null,
"e": 9057,
"s": 8915,
"text": "After merging these two arrays the data is proper to feed in CNN as the input volume to extract complex features with non-linear interaction."
},
{
"code": null,
"e": 9108,
"s": 9057,
"text": "shape of input volume(layer)data: (30000, 3, 6, 2)"
},
{
"code": null,
"e": 9313,
"s": 9108,
"text": "Now the data looks like image frame data image like data (30000 image frame of volume 3*6*2). Now we need to map target variable(default payment next month) against customer ID in one hot encoding format."
},
{
"code": null,
"e": 9491,
"s": 9313,
"text": "X = np.concatenate((retail, mort),axis=3)Y = event_id[['default payment next month']].valuesY = to_categorical(Y,2)In our data we have payment default rate is: 28.402671 percent"
},
{
"code": null,
"e": 9649,
"s": 9491,
"text": "In the data we have 28.40% payment_default rate. Although event rate is not 50%, we can say it’s fairly balanced data. so no need to do any weight correction"
},
{
"code": null,
"e": 10323,
"s": 9649,
"text": "To extract features from CNN model first we need to train the CNN network with last sigmoid/logistic dense layer(here dimension 2) w.r.t. target variable. The objective of the training network is to identify the correct weights for the network by multiple forward and backward iterations, which eventually try to minimize binary cross entropy(misclassification cost). Here I will use keras framework with back-end as TensorFlow(tf). For our business problem AUC is the evaluation metric and we will do the optimization by maximizing AUC value in each epoch(Keras doesn’t have default AUC metric. However we can leverage tf to create customized evaluation function for AUC.)"
},
{
"code": null,
"e": 10487,
"s": 10323,
"text": "We built following CNN with 4 conv layers(conv + activation + pooling(optional)) and 2 FC(fully connected layers) before reaching to the last sigmoid output layer."
},
{
"code": null,
"e": 10673,
"s": 10487,
"text": "We trained our model for epochs = 100 utilizing early stopping to prevent overfitting.It took less than 10 mins time to train using my NVIDIA GTX GeForce 1060 GPU with val_auc = 0.8317."
},
{
"code": null,
"e": 10704,
"s": 10673,
"text": "Feature Extraction Methodology"
},
{
"code": null,
"e": 11405,
"s": 10704,
"text": "Now by using a pre-trained model, we can directly apply these weights on a data, removing the last sigmoid/logistic layer(in this problem until the dense layer of dimension 100). We can use this to any new data of same business problem to calculate these features.We need to just feed forward the network and it will directly map final weights to calculate features at some intermediate layer, without building the network again.This is a kind of transfer learning.Based on our requirement of no of features we can extract features at any intermediate dense layer with the desired dimension. For this problem, we will extract feature using an intermediate model till ‘feature_dense’ layer of the CNN."
},
{
"code": null,
"e": 11597,
"s": 11405,
"text": "#Preparing Indermediate model-removing last sigmoid layerintermediate_layer_model = Model(inputs=model.input,outputs=model.get_layer('feature_dense').output)intermediate_layer_model.summary()"
},
{
"code": null,
"e": 11753,
"s": 11597,
"text": "The output layer dimension is 100, so if we predict using this network on a new data with the same input dimension, we can create 100 new complex features."
},
{
"code": null,
"e": 11990,
"s": 11753,
"text": "#predict to get featured datafeauture_engg_data = intermediate_layer_model.predict(X)feauture_engg_data = pd.DataFrame(feauture_engg_data)print('feauture_engg_data shape:', feauture_engg_data.shape)feauture_engg_data shape: (30000, 100)"
},
{
"code": null,
"e": 12061,
"s": 11990,
"text": "We successfully captured 100 complex interactions among raw variables."
},
{
"code": null,
"e": 12538,
"s": 12061,
"text": "· Let’s have some sneak-peak whether these features have any value. Although there are a few better ways, for sake of simplicity let’s capture some bivariate relationship of these new features with the target variable ‘default payment next month’.Although for categorical target variable Correlation is not 100% correct method, we will calculate the correlation of all new values with the target as an approximation of the variables which may be important for the final model."
},
{
"code": null,
"e": 13037,
"s": 12538,
"text": "#Sorting correlation values in decsending ordernew_corrs = sorted(new_corrs, key = lambda x: abs(x[1]), reverse = True)#Let's see top 10 correlation valuesnew_corrs[:10] [('PAY_1', 0.32479372847862253), ('PAY_2', 0.26355120167216467), ('PAY_3', 0.2352525137249163), ('feat_78', -0.22173805212223915), ('PAY_4', 0.21661363684242424), ('PAY_5', 0.20414891387616674), ('feat_86', -0.20047655459374053), ('feat_6', -0.19189993720885604), ('PAY_6', 0.1868663616535449), ('feat_3', -0.17394080015462873)]"
},
{
"code": null,
"e": 13360,
"s": 13037,
"text": "We can see 4 newly created variables(feat_78,feat_86,feat_6,feat_3) are in top 10, in terms of correlation(pseudo although) with ‘default payment next month’. Although based on this nothing concretely can be said about the predictive strength of these variable, at least these variable are worthy of further investigation."
},
{
"code": null,
"e": 13501,
"s": 13360,
"text": "We can also look at the KDE(kernel density estimation) plot of the highest correlated variables, in terms of absolute magnitude correlation."
},
{
"code": null,
"e": 13672,
"s": 13501,
"text": "Now the critical ask is for this problem why CNN/deep learning method is only used for feature extraction. Why not use it as a classifier also. Two main reasons is there:"
},
{
"code": null,
"e": 14060,
"s": 13672,
"text": "Local pattern: The data we used in this business problem(which is applicable to most of the scenarios where we use structural data), consists cross sectional(static)variables as well, where we will not find any local pattern. So we can’t use CNN on the entire data as classifier. Of course for the data which holds Shift/Translation Invariance property, we can use CNN as end classifier."
},
{
"code": null,
"e": 14265,
"s": 14060,
"text": "Infrastructural challenge: Building in large-scale industrial data and bringing into production requires significant infrastructural support(GPUs, AWS etc.), which may not available to every organization."
},
{
"code": null,
"e": 14706,
"s": 14265,
"text": "Latency in model run: Even with proper infrastructure forward propagation of decently complex deep learning models takes significantly higher time than highly effective classifiers like XGBoost, RF, SVM etc. Indeed some application, which requires blazing fast real-time prediction, the best solution, in that case, is to extract feature with an automated technique like CNN feature extraction and then to add relatively simpler classifier."
},
{
"code": null,
"e": 15184,
"s": 14706,
"text": "Regulatory challenge: Even with the immense focus on machine learning/AI, organizations especially into the domain of banking/insurance/finance have to go through internal/external regulatory processes before implementation of predictive models and it may require painstaking persuasion to make these latest techniques on the production system. On the contrary, if the end classifier is the traditional model, there may not be a challenge on a modeling methodology perspective."
}
] |
JavaScript | Program to generate one-time password (OTP) | 08 Dec, 2020
One-time Passwords (OTP) is a password that is valid for only one login session or transaction on a computer or a digital device. Nowadays OTP’s are used in almost every service like Internet Banking, online transactions, etc. They are generally a combination of 4 or 6 numeric digits or a 6-digit alphanumeric. The random function is used to generate random OTP which is predefined in the Math library. This article describes how to generate OTP using JavaScript.
Used Function:
Math.random(): This function returns any random number between 0 to 1.
Math.floor(): It returns floor of any floating number to a integer value.
Using the above function pick a random index of string array which contains all the possible candidates of a particular digit of the OTP.
Example 1: This example generates 4 digit Numeric OTP:
<script> // Function to generate OTPfunction generateOTP() { // Declare a digits variable // which stores all digits var digits = '0123456789'; let OTP = ''; for (let i = 0; i < 4; i++ ) { OTP += digits[Math.floor(Math.random() * 10)]; } return OTP;} document.write("OTP of 4 digits: ")document.write( generateOTP() );</script>
Output:
OTP of 4 digits: 2229
Example 2: This example generates 6 digit Numeric OTP:
<script> // Function to generate OTPfunction generateOTP() { // Declare a digits variable // which stores all digits var digits = '0123456789'; let OTP = ''; for (let i = 0; i < 6; i++ ) { OTP += digits[Math.floor(Math.random() * 10)]; } return OTP;} document.write("OTP of 6 digits: ")document.write( generateOTP() );</script>
Output:
OTP of 6 digits: 216664
Example 3: This example generates alphanumeric OTP of length 6:
<script> // Function to generate OTPfunction generateOTP() { // Declare a string variable // which stores all string var string = '0123456789abcdefghijklmnopqrs tuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; let OTP = ''; // Find the length of string var len = string.length; for (let i = 0; i < 6; i++ ) { OTP += string[Math.floor(Math.random() * len)]; } return OTP;} document.write("OTP of 6 length: ")document.write( generateOTP() );</script>
Output:
OTP of 6 length: rab0Tj
soham_de_roy
Technical Scripter 2018
JavaScript
Technical Scripter
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Difference between var, let and const keywords in JavaScript
Remove elements from a JavaScript Array
Difference Between PUT and PATCH Request
Roadmap to Learn JavaScript For Beginners
JavaScript | Promises
Installation of Node.js on Linux
Top 10 Projects For Beginners To Practice HTML and CSS Skills
Difference between var, let and const keywords in JavaScript
How to insert spaces/tabs in text using HTML/CSS?
How to fetch data from an API in ReactJS ? | [
{
"code": null,
"e": 53,
"s": 25,
"text": "\n08 Dec, 2020"
},
{
"code": null,
"e": 518,
"s": 53,
"text": "One-time Passwords (OTP) is a password that is valid for only one login session or transaction on a computer or a digital device. Nowadays OTP’s are used in almost every service like Internet Banking, online transactions, etc. They are generally a combination of 4 or 6 numeric digits or a 6-digit alphanumeric. The random function is used to generate random OTP which is predefined in the Math library. This article describes how to generate OTP using JavaScript."
},
{
"code": null,
"e": 533,
"s": 518,
"text": "Used Function:"
},
{
"code": null,
"e": 604,
"s": 533,
"text": "Math.random(): This function returns any random number between 0 to 1."
},
{
"code": null,
"e": 678,
"s": 604,
"text": "Math.floor(): It returns floor of any floating number to a integer value."
},
{
"code": null,
"e": 816,
"s": 678,
"text": "Using the above function pick a random index of string array which contains all the possible candidates of a particular digit of the OTP."
},
{
"code": null,
"e": 871,
"s": 816,
"text": "Example 1: This example generates 4 digit Numeric OTP:"
},
{
"code": "<script> // Function to generate OTPfunction generateOTP() { // Declare a digits variable // which stores all digits var digits = '0123456789'; let OTP = ''; for (let i = 0; i < 4; i++ ) { OTP += digits[Math.floor(Math.random() * 10)]; } return OTP;} document.write(\"OTP of 4 digits: \")document.write( generateOTP() );</script> ",
"e": 1260,
"s": 871,
"text": null
},
{
"code": null,
"e": 1268,
"s": 1260,
"text": "Output:"
},
{
"code": null,
"e": 1290,
"s": 1268,
"text": "OTP of 4 digits: 2229"
},
{
"code": null,
"e": 1345,
"s": 1290,
"text": "Example 2: This example generates 6 digit Numeric OTP:"
},
{
"code": "<script> // Function to generate OTPfunction generateOTP() { // Declare a digits variable // which stores all digits var digits = '0123456789'; let OTP = ''; for (let i = 0; i < 6; i++ ) { OTP += digits[Math.floor(Math.random() * 10)]; } return OTP;} document.write(\"OTP of 6 digits: \")document.write( generateOTP() );</script> ",
"e": 1734,
"s": 1345,
"text": null
},
{
"code": null,
"e": 1742,
"s": 1734,
"text": "Output:"
},
{
"code": null,
"e": 1766,
"s": 1742,
"text": "OTP of 6 digits: 216664"
},
{
"code": null,
"e": 1830,
"s": 1766,
"text": "Example 3: This example generates alphanumeric OTP of length 6:"
},
{
"code": "<script> // Function to generate OTPfunction generateOTP() { // Declare a string variable // which stores all string var string = '0123456789abcdefghijklmnopqrs tuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; let OTP = ''; // Find the length of string var len = string.length; for (let i = 0; i < 6; i++ ) { OTP += string[Math.floor(Math.random() * len)]; } return OTP;} document.write(\"OTP of 6 length: \")document.write( generateOTP() );</script> ",
"e": 2342,
"s": 1830,
"text": null
},
{
"code": null,
"e": 2350,
"s": 2342,
"text": "Output:"
},
{
"code": null,
"e": 2374,
"s": 2350,
"text": "OTP of 6 length: rab0Tj"
},
{
"code": null,
"e": 2387,
"s": 2374,
"text": "soham_de_roy"
},
{
"code": null,
"e": 2411,
"s": 2387,
"text": "Technical Scripter 2018"
},
{
"code": null,
"e": 2422,
"s": 2411,
"text": "JavaScript"
},
{
"code": null,
"e": 2441,
"s": 2422,
"text": "Technical Scripter"
},
{
"code": null,
"e": 2458,
"s": 2441,
"text": "Web Technologies"
},
{
"code": null,
"e": 2556,
"s": 2458,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 2617,
"s": 2556,
"text": "Difference between var, let and const keywords in JavaScript"
},
{
"code": null,
"e": 2657,
"s": 2617,
"text": "Remove elements from a JavaScript Array"
},
{
"code": null,
"e": 2698,
"s": 2657,
"text": "Difference Between PUT and PATCH Request"
},
{
"code": null,
"e": 2740,
"s": 2698,
"text": "Roadmap to Learn JavaScript For Beginners"
},
{
"code": null,
"e": 2762,
"s": 2740,
"text": "JavaScript | Promises"
},
{
"code": null,
"e": 2795,
"s": 2762,
"text": "Installation of Node.js on Linux"
},
{
"code": null,
"e": 2857,
"s": 2795,
"text": "Top 10 Projects For Beginners To Practice HTML and CSS Skills"
},
{
"code": null,
"e": 2918,
"s": 2857,
"text": "Difference between var, let and const keywords in JavaScript"
},
{
"code": null,
"e": 2968,
"s": 2918,
"text": "How to insert spaces/tabs in text using HTML/CSS?"
}
] |
Print reverse string after removing vowels | 16 Jun, 2022
Given a string s, print reverse of string and remove the characters from the reversed string where there are vowels in the original string. Examples:
Input : geeksforgeeks
Output : segrfseg
Explanation :
Reversed string is skeegrofskeeg, removing characters
from indexes 1, 2, 6, 9 & 10 (0 based indexing),
we get segrfseg .
Input :duck
Output :kud
A simple solution is to first reverse the string, then traverse the reversed string and remove vowels.An efficient solution is to do both tasks in one traversal. Create an empty string r and traverse the original string s and assign the value to the string r. Check whether, at that index, the original string contains a consonant or not. If yes then print the element at that index from string r.Basic implementation of the above approach :
C++
Java
Python3
C#
Javascript
// CPP Program for removing characters// from reversed string where vowels are// present in original string#include <bits/stdc++.h>using namespace std; // Function for replacing the stringvoid replaceOriginal(string s, int n){ // initialize a string of length n string r(n, ' '); // Traverse through all characters of string for (int i = 0; i < n; i++) { // assign the value to string r // from last index of string s r[i] = s[n - 1 - i]; // if s[i] is a consonant then // print r[i] if (s[i] != 'a' && s[i] != 'e' && s[i] != 'i' && s[i] != 'o' && s[i] != 'u') { cout << r[i]; } } cout << endl;} // Driver functionint main(){ string s = "geeksforgeeks"; int n = s.length(); replaceOriginal(s, n); return 0;}
// Java Program for removing characters// from reversed string where vowels are// present in original stringclass GFG { // Function for replacing the string static void replaceOriginal(String s, int n) { // initialize a string of length n char r[] = new char[n]; // Traverse through all characters of string for (int i = 0; i < n; i++) { // assign the value to string r // from last index of string s r[i] = s.charAt(n - 1 - i); // if s[i] is a consonant then // print r[i] if (s.charAt(i) != 'a' && s.charAt(i) != 'e' && s.charAt(i) != 'i' && s.charAt(i) != 'o' && s.charAt(i) != 'u') { System.out.print(r[i]); } } System.out.println(""); } // Driver function public static void main(String[] args) { String s = "geeksforgeeks"; int n = s.length(); replaceOriginal(s, n); }} // This code is contributed by princiRaj1992
# Python3 Program for removing characters# from reversed string where vowels are# present in original string # Function for replacing the stringdef replaceOriginal(s, n): # initialize a string of length n r = [' '] * n # Traverse through all characters of string for i in range(n): # assign the value to string r # from last index of string s r[i] = s[n - 1 - i] # if s[i] is a consonant then # print r[i] if (s[i] != 'a' and s[i] != 'e' and s[i] != 'i' and s[i] != 'o' and s[i] != 'u'): print(r[i], end = "") print() # Driver Codeif __name__ == "__main__": s = "geeksforgeeks" n = len(s) replaceOriginal(s, n) # This code is contributed by# sanjeev2552
// C# Program for removing characters// from reversed string where vowels are// present in original stringusing System; class GFG{ // Function for replacing the string static void replaceOriginal(String s, int n) { // initialize a string of length n char []r = new char[n]; // Traverse through all characters of string for (int i = 0; i < n; i++) { // assign the value to string r // from last index of string s r[i] = s[n - 1 - i]; // if s[i] is a consonant then // print r[i] if (s[i] != 'a' && s[i] != 'e' && s[i] != 'i' && s[i] != 'o' && s[i] != 'u') { Console.Write(r[i]); } } Console.WriteLine(""); } // Driver code public static void Main(String[] args) { String s = "geeksforgeeks"; int n = s.Length; replaceOriginal(s, n); }} // This code is contributed by Rajput-JI
<script> // JavaScript Program for removing characters// from reversed string where vowels are// present in original string// Function for replacing the stringfunction replaceOriginal(s, n){ // initialize a string of length n var r = new Array(n); // Traverse through all characters of string for (var i = 0; i < n; i++) { // assign the value to string r // from last index of string s r[i] = s.charAt(n - 1 - i); // if s[i] is a consonant then // print r[i] if (s.charAt(i) != 'a' && s.charAt(i) != 'e' && s.charAt(i) != 'i' && s.charAt(i) != 'o' && s.charAt(i) != 'u') { document.write(r[i]); } } document.write(""); } // Driver functionvar s = "geeksforgeeks";var n = s.length;replaceOriginal(s, n); // This code is contributed by shivanisinghss2110 </script>
Output:
segrfseg
Time complexity : O(n) Auxiliary Space : O(n)
Chapters
descriptions off, selected
captions settings, opens captions settings dialog
captions off, selected
English
This is a modal window.
Beginning of dialog window. Escape will cancel and close the window.
End of dialog window.
Print reverse string after removing vowels | GeeksforGeeks - YouTubeGeeksforGeeks529K subscribersPrint reverse string after removing vowels | GeeksforGeeksWatch laterShareCopy linkInfoShoppingTap to unmuteIf playback doesn't begin shortly, try restarting your device.More videosMore videosYou're signed outVideos you watch may be added to the TV's watch history and influence TV recommendations. To avoid this, cancel and sign in to YouTube on your computer.CancelConfirmSwitch cameraShareInclude playlistAn error occurred while retrieving sharing information. Please try again later.Watch on0:000:000:00 / 4:00•Live•<div class="player-unavailable"><h1 class="message">An error occurred.</h1><div class="submessage"><a href="https://www.youtube.com/watch?v=jixtSNRrD5c" target="_blank">Try watching this video on www.youtube.com</a>, or enable JavaScript if it is disabled in your browser.</div></div>
princiraj1992
Rajput-Ji
sanjeev2552
surinderdawra388
shivanisinghss2110
a7977370173
Reverse
vowel-consonant
Searching
Strings
Searching
Strings
Reverse
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Search, insert and delete in a sorted array
Given a sorted and rotated array, find if there is a pair with a given sum
Allocate minimum number of pages
Find common elements in three sorted arrays
Find whether an array is subset of another array
Write a program to reverse an array or string
Reverse a string in Java
Write a program to print all permutations of a given string
C++ Data Types
Check for Balanced Brackets in an expression (well-formedness) using Stack | [
{
"code": null,
"e": 53,
"s": 25,
"text": "\n16 Jun, 2022"
},
{
"code": null,
"e": 205,
"s": 53,
"text": "Given a string s, print reverse of string and remove the characters from the reversed string where there are vowels in the original string. Examples: "
},
{
"code": null,
"e": 406,
"s": 205,
"text": "Input : geeksforgeeks\nOutput : segrfseg\nExplanation :\nReversed string is skeegrofskeeg, removing characters \nfrom indexes 1, 2, 6, 9 & 10 (0 based indexing),\nwe get segrfseg .\n\nInput :duck\nOutput :kud"
},
{
"code": null,
"e": 852,
"s": 408,
"text": "A simple solution is to first reverse the string, then traverse the reversed string and remove vowels.An efficient solution is to do both tasks in one traversal. Create an empty string r and traverse the original string s and assign the value to the string r. Check whether, at that index, the original string contains a consonant or not. If yes then print the element at that index from string r.Basic implementation of the above approach : "
},
{
"code": null,
"e": 856,
"s": 852,
"text": "C++"
},
{
"code": null,
"e": 861,
"s": 856,
"text": "Java"
},
{
"code": null,
"e": 869,
"s": 861,
"text": "Python3"
},
{
"code": null,
"e": 872,
"s": 869,
"text": "C#"
},
{
"code": null,
"e": 883,
"s": 872,
"text": "Javascript"
},
{
"code": "// CPP Program for removing characters// from reversed string where vowels are// present in original string#include <bits/stdc++.h>using namespace std; // Function for replacing the stringvoid replaceOriginal(string s, int n){ // initialize a string of length n string r(n, ' '); // Traverse through all characters of string for (int i = 0; i < n; i++) { // assign the value to string r // from last index of string s r[i] = s[n - 1 - i]; // if s[i] is a consonant then // print r[i] if (s[i] != 'a' && s[i] != 'e' && s[i] != 'i' && s[i] != 'o' && s[i] != 'u') { cout << r[i]; } } cout << endl;} // Driver functionint main(){ string s = \"geeksforgeeks\"; int n = s.length(); replaceOriginal(s, n); return 0;}",
"e": 1696,
"s": 883,
"text": null
},
{
"code": "// Java Program for removing characters// from reversed string where vowels are// present in original stringclass GFG { // Function for replacing the string static void replaceOriginal(String s, int n) { // initialize a string of length n char r[] = new char[n]; // Traverse through all characters of string for (int i = 0; i < n; i++) { // assign the value to string r // from last index of string s r[i] = s.charAt(n - 1 - i); // if s[i] is a consonant then // print r[i] if (s.charAt(i) != 'a' && s.charAt(i) != 'e' && s.charAt(i) != 'i' && s.charAt(i) != 'o' && s.charAt(i) != 'u') { System.out.print(r[i]); } } System.out.println(\"\"); } // Driver function public static void main(String[] args) { String s = \"geeksforgeeks\"; int n = s.length(); replaceOriginal(s, n); }} // This code is contributed by princiRaj1992",
"e": 2706,
"s": 1696,
"text": null
},
{
"code": "# Python3 Program for removing characters# from reversed string where vowels are# present in original string # Function for replacing the stringdef replaceOriginal(s, n): # initialize a string of length n r = [' '] * n # Traverse through all characters of string for i in range(n): # assign the value to string r # from last index of string s r[i] = s[n - 1 - i] # if s[i] is a consonant then # print r[i] if (s[i] != 'a' and s[i] != 'e' and s[i] != 'i' and s[i] != 'o' and s[i] != 'u'): print(r[i], end = \"\") print() # Driver Codeif __name__ == \"__main__\": s = \"geeksforgeeks\" n = len(s) replaceOriginal(s, n) # This code is contributed by# sanjeev2552",
"e": 3463,
"s": 2706,
"text": null
},
{
"code": "// C# Program for removing characters// from reversed string where vowels are// present in original stringusing System; class GFG{ // Function for replacing the string static void replaceOriginal(String s, int n) { // initialize a string of length n char []r = new char[n]; // Traverse through all characters of string for (int i = 0; i < n; i++) { // assign the value to string r // from last index of string s r[i] = s[n - 1 - i]; // if s[i] is a consonant then // print r[i] if (s[i] != 'a' && s[i] != 'e' && s[i] != 'i' && s[i] != 'o' && s[i] != 'u') { Console.Write(r[i]); } } Console.WriteLine(\"\"); } // Driver code public static void Main(String[] args) { String s = \"geeksforgeeks\"; int n = s.Length; replaceOriginal(s, n); }} // This code is contributed by Rajput-JI",
"e": 4460,
"s": 3463,
"text": null
},
{
"code": "<script> // JavaScript Program for removing characters// from reversed string where vowels are// present in original string// Function for replacing the stringfunction replaceOriginal(s, n){ // initialize a string of length n var r = new Array(n); // Traverse through all characters of string for (var i = 0; i < n; i++) { // assign the value to string r // from last index of string s r[i] = s.charAt(n - 1 - i); // if s[i] is a consonant then // print r[i] if (s.charAt(i) != 'a' && s.charAt(i) != 'e' && s.charAt(i) != 'i' && s.charAt(i) != 'o' && s.charAt(i) != 'u') { document.write(r[i]); } } document.write(\"\"); } // Driver functionvar s = \"geeksforgeeks\";var n = s.length;replaceOriginal(s, n); // This code is contributed by shivanisinghss2110 </script>",
"e": 5383,
"s": 4460,
"text": null
},
{
"code": null,
"e": 5393,
"s": 5383,
"text": "Output: "
},
{
"code": null,
"e": 5402,
"s": 5393,
"text": "segrfseg"
},
{
"code": null,
"e": 5448,
"s": 5402,
"text": "Time complexity : O(n) Auxiliary Space : O(n)"
},
{
"code": null,
"e": 5457,
"s": 5448,
"text": "Chapters"
},
{
"code": null,
"e": 5484,
"s": 5457,
"text": "descriptions off, selected"
},
{
"code": null,
"e": 5534,
"s": 5484,
"text": "captions settings, opens captions settings dialog"
},
{
"code": null,
"e": 5557,
"s": 5534,
"text": "captions off, selected"
},
{
"code": null,
"e": 5565,
"s": 5557,
"text": "English"
},
{
"code": null,
"e": 5589,
"s": 5565,
"text": "This is a modal window."
},
{
"code": null,
"e": 5658,
"s": 5589,
"text": "Beginning of dialog window. Escape will cancel and close the window."
},
{
"code": null,
"e": 5680,
"s": 5658,
"text": "End of dialog window."
},
{
"code": null,
"e": 6584,
"s": 5682,
"text": "Print reverse string after removing vowels | GeeksforGeeks - YouTubeGeeksforGeeks529K subscribersPrint reverse string after removing vowels | GeeksforGeeksWatch laterShareCopy linkInfoShoppingTap to unmuteIf playback doesn't begin shortly, try restarting your device.More videosMore videosYou're signed outVideos you watch may be added to the TV's watch history and influence TV recommendations. To avoid this, cancel and sign in to YouTube on your computer.CancelConfirmSwitch cameraShareInclude playlistAn error occurred while retrieving sharing information. Please try again later.Watch on0:000:000:00 / 4:00•Live•<div class=\"player-unavailable\"><h1 class=\"message\">An error occurred.</h1><div class=\"submessage\"><a href=\"https://www.youtube.com/watch?v=jixtSNRrD5c\" target=\"_blank\">Try watching this video on www.youtube.com</a>, or enable JavaScript if it is disabled in your browser.</div></div>"
},
{
"code": null,
"e": 6600,
"s": 6586,
"text": "princiraj1992"
},
{
"code": null,
"e": 6610,
"s": 6600,
"text": "Rajput-Ji"
},
{
"code": null,
"e": 6622,
"s": 6610,
"text": "sanjeev2552"
},
{
"code": null,
"e": 6639,
"s": 6622,
"text": "surinderdawra388"
},
{
"code": null,
"e": 6658,
"s": 6639,
"text": "shivanisinghss2110"
},
{
"code": null,
"e": 6670,
"s": 6658,
"text": "a7977370173"
},
{
"code": null,
"e": 6678,
"s": 6670,
"text": "Reverse"
},
{
"code": null,
"e": 6694,
"s": 6678,
"text": "vowel-consonant"
},
{
"code": null,
"e": 6704,
"s": 6694,
"text": "Searching"
},
{
"code": null,
"e": 6712,
"s": 6704,
"text": "Strings"
},
{
"code": null,
"e": 6722,
"s": 6712,
"text": "Searching"
},
{
"code": null,
"e": 6730,
"s": 6722,
"text": "Strings"
},
{
"code": null,
"e": 6738,
"s": 6730,
"text": "Reverse"
},
{
"code": null,
"e": 6836,
"s": 6738,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 6880,
"s": 6836,
"text": "Search, insert and delete in a sorted array"
},
{
"code": null,
"e": 6955,
"s": 6880,
"text": "Given a sorted and rotated array, find if there is a pair with a given sum"
},
{
"code": null,
"e": 6988,
"s": 6955,
"text": "Allocate minimum number of pages"
},
{
"code": null,
"e": 7032,
"s": 6988,
"text": "Find common elements in three sorted arrays"
},
{
"code": null,
"e": 7081,
"s": 7032,
"text": "Find whether an array is subset of another array"
},
{
"code": null,
"e": 7127,
"s": 7081,
"text": "Write a program to reverse an array or string"
},
{
"code": null,
"e": 7152,
"s": 7127,
"text": "Reverse a string in Java"
},
{
"code": null,
"e": 7212,
"s": 7152,
"text": "Write a program to print all permutations of a given string"
},
{
"code": null,
"e": 7227,
"s": 7212,
"text": "C++ Data Types"
}
] |
Total no of 1’s in numbers | 30 Apr, 2021
Given an integer n, count the total number of digit 1 appearing in all positive integers less than or equal to n.Examples:
Input : n = 13
Output : 6
Explanation:
Here, no <= 13 containing 1 are 1, 10, 11,
12, 13. So, total 1s are 6.
Input : n = 5
Output : 1
Here, no <= 13 containing 1 are 1.
So, total 1s are 1.
Approach 1:
Iterate over i from 1 to n.Convert i to string and count ’1’ in each integer string.Add count of ’1’ in each string to the sum.
Iterate over i from 1 to n.
Convert i to string and count ’1’ in each integer string.
Add count of ’1’ in each string to the sum.
Below is the code for the above discussed approach.
C++
Java
Python3
C#
PHP
Javascript
// c++ code to count the frequency of 1// in numbers less than or equal to// the given number.#include <bits/stdc++.h>using namespace std;int countDigitOne(int n){ int countr = 0; for (int i = 1; i <= n; i++) { string str = to_string(i); countr += count(str.begin(), str.end(), '1'); } return countr;} // driver functionint main(){ int n = 13; cout << countDigitOne(n) << endl; n = 131; cout << countDigitOne(n) << endl; n = 159; cout << countDigitOne(n) << endl; return 0;}
// Java code to count the frequency of 1// in numbers less than or equal to// the given number.class GFG{static int countDigitOne(int n){ int countr = 0; for (int i = 1; i <= n; i++) { String str = String.valueOf(i); countr += str.split("1", -1) . length - 1; } return countr;} // Driver Codepublic static void main(String[] args){ int n = 13; System.out.println(countDigitOne(n)); n = 131; System.out.println(countDigitOne(n)); n = 159; System.out.println(countDigitOne(n));}} // This code is contributed by mits
# Python3 code to count the frequency# of 1 in numbers less than or equal# to the given number. def countDigitOne(n): countr = 0; for i in range(1, n + 1): str1 = str(i); countr += str1.count("1"); return countr; # Driver Coden = 13;print(countDigitOne(n)); n = 131;print(countDigitOne(n)); n = 159;print(countDigitOne(n)); # This code is contributed by mits
// C# code to count the frequency of 1// in numbers less than or equal to// the given number.using System;class GFG{static int countDigitOne(int n){ int countr = 0; for (int i = 1; i <= n; i++) { string str = i.ToString(); countr += str.Split("1") . Length - 1; } return countr;} // Driver Codepublic static void Main(){ int n = 13; Console.WriteLine(countDigitOne(n)); n = 131; Console.WriteLine(countDigitOne(n)); n = 159; Console.WriteLine(countDigitOne(n));}} // This code is contributed by mits
<?php// PHP code to count the frequency of 1// in numbers less than or equal to// the given number. function countDigitOne($n){ $countr = 0; for ($i = 1; $i <= $n; $i++) { $str = strval($i); $countr += substr_count($str, '1'); } return $countr;} // Driver Code$n = 13;echo countDigitOne($n) . "\n"; $n = 131;echo countDigitOne($n) . "\n"; $n = 159;echo countDigitOne($n) . "\n"; // This code is contributed by mits?>
<script> // Javascript code to count the frequency of 1 // in numbers less than or equal to // the given number. function countDigitOne(n) { let countr = 0; for (let i = 1; i <= n; i++) { let str = i.toString(); countr += str.split("1") . length - 1; } return countr; } let n = 13; document.write(countDigitOne(n) + "</br>"); n = 131; document.write(countDigitOne(n) + "</br>"); n = 159; document.write(countDigitOne(n) + "</br>"); </script>
Output:
6
66
96
Time complexity: O(nlog(n))Approach 2:
Initialize countr as 0.Iterate over i from 1 to n incrementing by 10 each time.Add (n / (i * 10 ) ) * i to countr after each (i*10) interval.Add min( max(n mod (i*10) – i + 1, 0), i) to countr.
Initialize countr as 0.
Iterate over i from 1 to n incrementing by 10 each time.
Add (n / (i * 10 ) ) * i to countr after each (i*10) interval.
Add min( max(n mod (i*10) – i + 1, 0), i) to countr.
Below is the code for the above discussed approach.
C++
Java
Python3
C#
PHP
Javascript
// c++ code to count the frequency of 1// in numbers less than or equal to// the given number.#include <bits/stdc++.h>using namespace std; // function to count the frequency of 1.int countDigitOne(int n){ int countr = 0; for (int i = 1; i <= n; i *= 10) { int divider = i * 10; countr += (n / divider) * i + min(max(n % divider - i + 1, 0), i); } return countr;} // driver functionint main(){ int n = 13; cout << countDigitOne(n) << endl; n = 113; cout << countDigitOne(n) << endl; n = 205; cout << countDigitOne(n) << endl;}
/// Java code to count the// frequency of 1 in numbers// less than or equal to// the given number.import java.io.*; class GFG{ // function to count// the frequency of 1.static int countDigitOne(int n){ int countr = 0; for (int i = 1; i <= n; i *= 10) { int divider = i * 10; countr += (n / divider) * i + Math.min(Math.max(n % divider - i + 1, 0), i); } return countr;} // Driver Codepublic static void main (String[] args){ int n = 13; System.out.println(countDigitOne(n)); n = 113; System.out.println(countDigitOne(n)); n = 205; System.out.println(countDigitOne(n));}} // This code is contributed by akt_mit
# Python3 code to count the# frequency of 1 in numbers# less than or equal to# the given number. # function to count the# frequency of 1.def countDigitOne(n): countr = 0; i = 1; while(i <= n): divider = i * 10; countr += (int(n / divider) * i + min(max(n % divider -i + 1, 0), i)); i *= 10; return countr; # Driver Coden = 13;print(countDigitOne(n));n = 113;print(countDigitOne(n));n = 205;print(countDigitOne(n)); # This code is contributed by mits
// C# code to count the// frequency of 1 in numbers// less than or equal to// the given number.using System; class GFG{ // function to count// the frequency of 1.static int countDigitOne(int n){ int countr = 0; for (int i = 1; i <= n; i *= 10) { int divider = i * 10; countr += (n / divider) * i + Math.Min(Math.Max(n % divider - i + 1, 0), i); } return countr;} // Driver Codepublic static void Main(){ int n = 13; Console.WriteLine(countDigitOne(n)); n = 113; Console.WriteLine(countDigitOne(n)); n = 205; Console.WriteLine(countDigitOne(n));}} // This code is contributed by mits
<?php// PHP code to count the// frequency of 1 in numbers// less than or equal to// the given number. // function to count the// frequency of 1.function countDigitOne($n){ $countr = 0; for ($i = 1; $i <= $n; $i *= 10) { $divider = $i * 10; $countr += (int)($n / $divider) * $i + min(max($n % $divider - $i + 1, 0), $i); } return $countr;} // Driver Code$n = 13;echo countDigitOne($n), "\n";$n = 113;echo countDigitOne($n), "\n";$n = 205;echo countDigitOne($n), "\n"; // This code is contributed by ajit?>
<script> // Javascript code to count the frequency of 1// in numbers less than or equal to// the given number. // function to count the frequency of 1.function countDigitOne(n){ var countr = 0; for (var i = 1; i <= n; i *= 10) { var divider = i * 10; countr += parseInt(n / divider) * i + Math.min(Math.max(n % divider - i + 1, 0), i); } return countr;} // driver functionvar n = 13;document.write(countDigitOne(n)+ "<br>");n = 113;document.write(countDigitOne(n)+ "<br>");n = 205;document.write(countDigitOne(n)+ "<br>"); </script>
Output:
6
40
141
Time complexity: O(log(n))
jit_t
Mithun Kumar
ShreyasWaghmare
rutvik_56
rameshtravel07
number-digits
Mathematical
Mathematical
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here. | [
{
"code": null,
"e": 52,
"s": 24,
"text": "\n30 Apr, 2021"
},
{
"code": null,
"e": 177,
"s": 52,
"text": "Given an integer n, count the total number of digit 1 appearing in all positive integers less than or equal to n.Examples: "
},
{
"code": null,
"e": 368,
"s": 177,
"text": "Input : n = 13\nOutput : 6\nExplanation:\nHere, no <= 13 containing 1 are 1, 10, 11,\n12, 13. So, total 1s are 6.\n\nInput : n = 5\nOutput : 1\nHere, no <= 13 containing 1 are 1.\nSo, total 1s are 1."
},
{
"code": null,
"e": 382,
"s": 370,
"text": "Approach 1:"
},
{
"code": null,
"e": 510,
"s": 382,
"text": "Iterate over i from 1 to n.Convert i to string and count ’1’ in each integer string.Add count of ’1’ in each string to the sum."
},
{
"code": null,
"e": 538,
"s": 510,
"text": "Iterate over i from 1 to n."
},
{
"code": null,
"e": 596,
"s": 538,
"text": "Convert i to string and count ’1’ in each integer string."
},
{
"code": null,
"e": 640,
"s": 596,
"text": "Add count of ’1’ in each string to the sum."
},
{
"code": null,
"e": 694,
"s": 640,
"text": "Below is the code for the above discussed approach. "
},
{
"code": null,
"e": 698,
"s": 694,
"text": "C++"
},
{
"code": null,
"e": 703,
"s": 698,
"text": "Java"
},
{
"code": null,
"e": 711,
"s": 703,
"text": "Python3"
},
{
"code": null,
"e": 714,
"s": 711,
"text": "C#"
},
{
"code": null,
"e": 718,
"s": 714,
"text": "PHP"
},
{
"code": null,
"e": 729,
"s": 718,
"text": "Javascript"
},
{
"code": "// c++ code to count the frequency of 1// in numbers less than or equal to// the given number.#include <bits/stdc++.h>using namespace std;int countDigitOne(int n){ int countr = 0; for (int i = 1; i <= n; i++) { string str = to_string(i); countr += count(str.begin(), str.end(), '1'); } return countr;} // driver functionint main(){ int n = 13; cout << countDigitOne(n) << endl; n = 131; cout << countDigitOne(n) << endl; n = 159; cout << countDigitOne(n) << endl; return 0;}",
"e": 1251,
"s": 729,
"text": null
},
{
"code": "// Java code to count the frequency of 1// in numbers less than or equal to// the given number.class GFG{static int countDigitOne(int n){ int countr = 0; for (int i = 1; i <= n; i++) { String str = String.valueOf(i); countr += str.split(\"1\", -1) . length - 1; } return countr;} // Driver Codepublic static void main(String[] args){ int n = 13; System.out.println(countDigitOne(n)); n = 131; System.out.println(countDigitOne(n)); n = 159; System.out.println(countDigitOne(n));}} // This code is contributed by mits",
"e": 1812,
"s": 1251,
"text": null
},
{
"code": "# Python3 code to count the frequency# of 1 in numbers less than or equal# to the given number. def countDigitOne(n): countr = 0; for i in range(1, n + 1): str1 = str(i); countr += str1.count(\"1\"); return countr; # Driver Coden = 13;print(countDigitOne(n)); n = 131;print(countDigitOne(n)); n = 159;print(countDigitOne(n)); # This code is contributed by mits",
"e": 2195,
"s": 1812,
"text": null
},
{
"code": "// C# code to count the frequency of 1// in numbers less than or equal to// the given number.using System;class GFG{static int countDigitOne(int n){ int countr = 0; for (int i = 1; i <= n; i++) { string str = i.ToString(); countr += str.Split(\"1\") . Length - 1; } return countr;} // Driver Codepublic static void Main(){ int n = 13; Console.WriteLine(countDigitOne(n)); n = 131; Console.WriteLine(countDigitOne(n)); n = 159; Console.WriteLine(countDigitOne(n));}} // This code is contributed by mits",
"e": 2742,
"s": 2195,
"text": null
},
{
"code": "<?php// PHP code to count the frequency of 1// in numbers less than or equal to// the given number. function countDigitOne($n){ $countr = 0; for ($i = 1; $i <= $n; $i++) { $str = strval($i); $countr += substr_count($str, '1'); } return $countr;} // Driver Code$n = 13;echo countDigitOne($n) . \"\\n\"; $n = 131;echo countDigitOne($n) . \"\\n\"; $n = 159;echo countDigitOne($n) . \"\\n\"; // This code is contributed by mits?>",
"e": 3188,
"s": 2742,
"text": null
},
{
"code": "<script> // Javascript code to count the frequency of 1 // in numbers less than or equal to // the given number. function countDigitOne(n) { let countr = 0; for (let i = 1; i <= n; i++) { let str = i.toString(); countr += str.split(\"1\") . length - 1; } return countr; } let n = 13; document.write(countDigitOne(n) + \"</br>\"); n = 131; document.write(countDigitOne(n) + \"</br>\"); n = 159; document.write(countDigitOne(n) + \"</br>\"); </script>",
"e": 3746,
"s": 3188,
"text": null
},
{
"code": null,
"e": 3756,
"s": 3746,
"text": "Output: "
},
{
"code": null,
"e": 3764,
"s": 3756,
"text": "6\n66\n96"
},
{
"code": null,
"e": 3804,
"s": 3764,
"text": "Time complexity: O(nlog(n))Approach 2: "
},
{
"code": null,
"e": 3998,
"s": 3804,
"text": "Initialize countr as 0.Iterate over i from 1 to n incrementing by 10 each time.Add (n / (i * 10 ) ) * i to countr after each (i*10) interval.Add min( max(n mod (i*10) – i + 1, 0), i) to countr."
},
{
"code": null,
"e": 4022,
"s": 3998,
"text": "Initialize countr as 0."
},
{
"code": null,
"e": 4079,
"s": 4022,
"text": "Iterate over i from 1 to n incrementing by 10 each time."
},
{
"code": null,
"e": 4142,
"s": 4079,
"text": "Add (n / (i * 10 ) ) * i to countr after each (i*10) interval."
},
{
"code": null,
"e": 4195,
"s": 4142,
"text": "Add min( max(n mod (i*10) – i + 1, 0), i) to countr."
},
{
"code": null,
"e": 4249,
"s": 4195,
"text": "Below is the code for the above discussed approach. "
},
{
"code": null,
"e": 4253,
"s": 4249,
"text": "C++"
},
{
"code": null,
"e": 4258,
"s": 4253,
"text": "Java"
},
{
"code": null,
"e": 4266,
"s": 4258,
"text": "Python3"
},
{
"code": null,
"e": 4269,
"s": 4266,
"text": "C#"
},
{
"code": null,
"e": 4273,
"s": 4269,
"text": "PHP"
},
{
"code": null,
"e": 4284,
"s": 4273,
"text": "Javascript"
},
{
"code": "// c++ code to count the frequency of 1// in numbers less than or equal to// the given number.#include <bits/stdc++.h>using namespace std; // function to count the frequency of 1.int countDigitOne(int n){ int countr = 0; for (int i = 1; i <= n; i *= 10) { int divider = i * 10; countr += (n / divider) * i + min(max(n % divider - i + 1, 0), i); } return countr;} // driver functionint main(){ int n = 13; cout << countDigitOne(n) << endl; n = 113; cout << countDigitOne(n) << endl; n = 205; cout << countDigitOne(n) << endl;}",
"e": 4868,
"s": 4284,
"text": null
},
{
"code": "/// Java code to count the// frequency of 1 in numbers// less than or equal to// the given number.import java.io.*; class GFG{ // function to count// the frequency of 1.static int countDigitOne(int n){ int countr = 0; for (int i = 1; i <= n; i *= 10) { int divider = i * 10; countr += (n / divider) * i + Math.min(Math.max(n % divider - i + 1, 0), i); } return countr;} // Driver Codepublic static void main (String[] args){ int n = 13; System.out.println(countDigitOne(n)); n = 113; System.out.println(countDigitOne(n)); n = 205; System.out.println(countDigitOne(n));}} // This code is contributed by akt_mit",
"e": 5617,
"s": 4868,
"text": null
},
{
"code": "# Python3 code to count the# frequency of 1 in numbers# less than or equal to# the given number. # function to count the# frequency of 1.def countDigitOne(n): countr = 0; i = 1; while(i <= n): divider = i * 10; countr += (int(n / divider) * i + min(max(n % divider -i + 1, 0), i)); i *= 10; return countr; # Driver Coden = 13;print(countDigitOne(n));n = 113;print(countDigitOne(n));n = 205;print(countDigitOne(n)); # This code is contributed by mits",
"e": 6150,
"s": 5617,
"text": null
},
{
"code": "// C# code to count the// frequency of 1 in numbers// less than or equal to// the given number.using System; class GFG{ // function to count// the frequency of 1.static int countDigitOne(int n){ int countr = 0; for (int i = 1; i <= n; i *= 10) { int divider = i * 10; countr += (n / divider) * i + Math.Min(Math.Max(n % divider - i + 1, 0), i); } return countr;} // Driver Codepublic static void Main(){ int n = 13; Console.WriteLine(countDigitOne(n)); n = 113; Console.WriteLine(countDigitOne(n)); n = 205; Console.WriteLine(countDigitOne(n));}} // This code is contributed by mits",
"e": 6860,
"s": 6150,
"text": null
},
{
"code": "<?php// PHP code to count the// frequency of 1 in numbers// less than or equal to// the given number. // function to count the// frequency of 1.function countDigitOne($n){ $countr = 0; for ($i = 1; $i <= $n; $i *= 10) { $divider = $i * 10; $countr += (int)($n / $divider) * $i + min(max($n % $divider - $i + 1, 0), $i); } return $countr;} // Driver Code$n = 13;echo countDigitOne($n), \"\\n\";$n = 113;echo countDigitOne($n), \"\\n\";$n = 205;echo countDigitOne($n), \"\\n\"; // This code is contributed by ajit?>",
"e": 7450,
"s": 6860,
"text": null
},
{
"code": "<script> // Javascript code to count the frequency of 1// in numbers less than or equal to// the given number. // function to count the frequency of 1.function countDigitOne(n){ var countr = 0; for (var i = 1; i <= n; i *= 10) { var divider = i * 10; countr += parseInt(n / divider) * i + Math.min(Math.max(n % divider - i + 1, 0), i); } return countr;} // driver functionvar n = 13;document.write(countDigitOne(n)+ \"<br>\");n = 113;document.write(countDigitOne(n)+ \"<br>\");n = 205;document.write(countDigitOne(n)+ \"<br>\"); </script>",
"e": 8021,
"s": 7450,
"text": null
},
{
"code": null,
"e": 8030,
"s": 8021,
"text": "Output: "
},
{
"code": null,
"e": 8039,
"s": 8030,
"text": "6\n40\n141"
},
{
"code": null,
"e": 8067,
"s": 8039,
"text": "Time complexity: O(log(n)) "
},
{
"code": null,
"e": 8073,
"s": 8067,
"text": "jit_t"
},
{
"code": null,
"e": 8086,
"s": 8073,
"text": "Mithun Kumar"
},
{
"code": null,
"e": 8102,
"s": 8086,
"text": "ShreyasWaghmare"
},
{
"code": null,
"e": 8112,
"s": 8102,
"text": "rutvik_56"
},
{
"code": null,
"e": 8127,
"s": 8112,
"text": "rameshtravel07"
},
{
"code": null,
"e": 8141,
"s": 8127,
"text": "number-digits"
},
{
"code": null,
"e": 8154,
"s": 8141,
"text": "Mathematical"
},
{
"code": null,
"e": 8167,
"s": 8154,
"text": "Mathematical"
}
] |
How to get bounding-box of different Shapes in p5.js ? | 22 Nov, 2019
In this article, we will see how to get the bounding-box of different shapes. We will use P5.js which is a Javascript framework creative programming environment and is very much inspired by Processing.
Bounding-box: A bounding-box is basically just a rectangle that bounds a shape more technically it is the rectangle with the smallest possible surface area that bounds the shape. A bounding-box can have rotation (called global bounding-box) but in this article, we’ll be focusing around the axis-aligned bounding boxes (AABB shapes) which have zero rotation in them (also called local bounding-box)
Note: A Bounding-Box for a shape is the rectangle with the smallest possible surface area that bounds the shape.
Reason to calculate bounding-box: A bounding-box acts as a container of a shape and has several applications in graphical applications (most notably used by GUI libraries for widget-masks). Since a bounding-box contains the shape so if any other shape doesn’t intersect with the bounding-box then it also doesn’t intersect with the inner-shape thus bounding-boxes are used heavily in Physics engines (such as Box2D) for broad-phase collision detection.
Base for the p5.js: This is the base-code (normally for every p5.js code).
<!-- Our main HTML file! --><html> <head> <script src="https://cdn.jsdelivr.net/npm/p5"></script> <script src="sketch.js"></script> </head> <body> </body></html>
Note: We will only change script.js at every iteration, and the HTML file will necessarily remain intact!
Finding bounding-box of an ellipse:/* p5.js Sketch for finding and drawing bounding-box of an ellipse*/function setup(){ createCanvas(480, 360);} // Draws bounding-box around the// given ellipse!function drawBBox(x0, y0, r1, r2){ // Draw only the outline // of the rectangle noFill(); // Draw the outline in red stroke(255, 0, 0); rect(x0-r1, y0-r2, 2*r1, 2*r2);}function draw() { let x0 = width/2, y0 = height/2; let r1 = 180, r2 = 100; // Note that `ellipse` takes in // diameters not radii! ellipse(x0, y0, 2*r1, 2*r2); drawBBox(x0, y0, r1, r2); // We don't want to draw this // over and over again noLoop();}Output:
/* p5.js Sketch for finding and drawing bounding-box of an ellipse*/function setup(){ createCanvas(480, 360);} // Draws bounding-box around the// given ellipse!function drawBBox(x0, y0, r1, r2){ // Draw only the outline // of the rectangle noFill(); // Draw the outline in red stroke(255, 0, 0); rect(x0-r1, y0-r2, 2*r1, 2*r2);}function draw() { let x0 = width/2, y0 = height/2; let r1 = 180, r2 = 100; // Note that `ellipse` takes in // diameters not radii! ellipse(x0, y0, 2*r1, 2*r2); drawBBox(x0, y0, r1, r2); // We don't want to draw this // over and over again noLoop();}
Output:
Finding bounding-box of a circle: It is same as an ellipse, since a circle is just a special case of an ellipse with same radii (same semi-major-axis and semi-minor axis).
Finding bounding-box of a line-segment/* p5.js Sketch for finding and drawing bounding-box of a line-segment*/function setup() { createCanvas(480, 360);} // Draws bounding-box around the// given line-segment!function drawBBox(x1, y1, x2, y2) { stroke(255, 0, 0); noFill(); let x = min(x1, x2), y = min(y1, y2); let w = max(x1, x2) - x, h = max(y1, y2) - y; rect(x, y, w, h);} function draw() { let x1 = 280, y1 = 80, x2 = 180, y2 = 280; line(x1, y1, x2, y2); drawBBox(x1, y1, x2, y2); noLoop();}Output:
/* p5.js Sketch for finding and drawing bounding-box of a line-segment*/function setup() { createCanvas(480, 360);} // Draws bounding-box around the// given line-segment!function drawBBox(x1, y1, x2, y2) { stroke(255, 0, 0); noFill(); let x = min(x1, x2), y = min(y1, y2); let w = max(x1, x2) - x, h = max(y1, y2) - y; rect(x, y, w, h);} function draw() { let x1 = 280, y1 = 80, x2 = 180, y2 = 280; line(x1, y1, x2, y2); drawBBox(x1, y1, x2, y2); noLoop();}
Output:
Finding bounding-box of a triangle: Finding bounding-box of a triangle is very similar to finding bounding-box for line-segment./* p5.js Sketch for finding and drawing bounding-box of a triangle*/function setup() { createCanvas(480, 360);} // Draws bounding-box around the// given triangle!function drawBBox(x1, y1, x2, y2, x3, y3) { stroke(255, 0, 0); noFill(); let x = min(x1, x2, x3), y = min(y1, y2, y3); let w = max(x1, x2, x3) - x, h = max(y1, y2, y3) - y; rect(x, y, w, h);} function draw() { let x1 = 240, y1 = 80, x2 = 140; let y2 = 280, x3 = 340, y3 = 280; triangle(x1, y1, x2, y2, x3, y3); drawBBox(x1, y1, x2, y2, x3, y3); noLoop();}Output:
/* p5.js Sketch for finding and drawing bounding-box of a triangle*/function setup() { createCanvas(480, 360);} // Draws bounding-box around the// given triangle!function drawBBox(x1, y1, x2, y2, x3, y3) { stroke(255, 0, 0); noFill(); let x = min(x1, x2, x3), y = min(y1, y2, y3); let w = max(x1, x2, x3) - x, h = max(y1, y2, y3) - y; rect(x, y, w, h);} function draw() { let x1 = 240, y1 = 80, x2 = 140; let y2 = 280, x3 = 340, y3 = 280; triangle(x1, y1, x2, y2, x3, y3); drawBBox(x1, y1, x2, y2, x3, y3); noLoop();}
Output:
Finding bounding-box of a polygon: A triangle is a polygon, and if we find the bounding-box of a triangle then finding bounding-box for polygon shouldn’t be any difficulty. We just have to generalize so that we can have any number of vertices and we are done./* p5.js sketch for finding and drawing bounding-box of a polygon*/function setup() { createCanvas(480, 360);} // Draws bounding-box around// the given polygon!function drawBBox(x, y) { stroke(255, 0, 0); noFill(); let rx = min(x), ry = min(y); let w = max(x) - rx, h = max(y) - ry; rect(rx, ry, w, h);} function draw(){ /* Vertices for a star-polygon (decagon) */ let x = [240, 268, 334, 286, 298, 240, 182, 194, 146, 212]; let y = [80, 140, 150, 194, 260, 230, 260, 194, 150, 140]; beginShape(); for (let i = 0; i < x.length; ++i) vertex(x[i], y[i]); fill(255, 217, 0); // If you don't CLOSE it then it'd // draw a chained line-segment endShape(CLOSE); drawBBox(x, y); noLoop();}Output:
/* p5.js sketch for finding and drawing bounding-box of a polygon*/function setup() { createCanvas(480, 360);} // Draws bounding-box around// the given polygon!function drawBBox(x, y) { stroke(255, 0, 0); noFill(); let rx = min(x), ry = min(y); let w = max(x) - rx, h = max(y) - ry; rect(rx, ry, w, h);} function draw(){ /* Vertices for a star-polygon (decagon) */ let x = [240, 268, 334, 286, 298, 240, 182, 194, 146, 212]; let y = [80, 140, 150, 194, 260, 230, 260, 194, 150, 140]; beginShape(); for (let i = 0; i < x.length; ++i) vertex(x[i], y[i]); fill(255, 217, 0); // If you don't CLOSE it then it'd // draw a chained line-segment endShape(CLOSE); drawBBox(x, y); noLoop();}
Output:
Finding Bounding-Boxes is an important part of visualization applications. Also in dynamic applications such as games, one cannot compute capsule-collision detection at every frame without entailing a punishment in the performance. So before any complex collision-checking, a broad-phase check is made for early exit which returns false as soon as it is ascertained that the shape doesn’t collide with the other shape. If the broad-phase check is passed then comes the narrow-phase where the actual collision-detection (OOBB, SAT, capsule, ellipsoid, etc) happens! Hence finding the bounding-box is an important part of many graphics-rich applications for various reasons.
JavaScript-p5.js
JavaScript
Technical Scripter
Web Technologies
Web technologies Questions
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here. | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n22 Nov, 2019"
},
{
"code": null,
"e": 230,
"s": 28,
"text": "In this article, we will see how to get the bounding-box of different shapes. We will use P5.js which is a Javascript framework creative programming environment and is very much inspired by Processing."
},
{
"code": null,
"e": 629,
"s": 230,
"text": "Bounding-box: A bounding-box is basically just a rectangle that bounds a shape more technically it is the rectangle with the smallest possible surface area that bounds the shape. A bounding-box can have rotation (called global bounding-box) but in this article, we’ll be focusing around the axis-aligned bounding boxes (AABB shapes) which have zero rotation in them (also called local bounding-box)"
},
{
"code": null,
"e": 742,
"s": 629,
"text": "Note: A Bounding-Box for a shape is the rectangle with the smallest possible surface area that bounds the shape."
},
{
"code": null,
"e": 1195,
"s": 742,
"text": "Reason to calculate bounding-box: A bounding-box acts as a container of a shape and has several applications in graphical applications (most notably used by GUI libraries for widget-masks). Since a bounding-box contains the shape so if any other shape doesn’t intersect with the bounding-box then it also doesn’t intersect with the inner-shape thus bounding-boxes are used heavily in Physics engines (such as Box2D) for broad-phase collision detection."
},
{
"code": null,
"e": 1270,
"s": 1195,
"text": "Base for the p5.js: This is the base-code (normally for every p5.js code)."
},
{
"code": "<!-- Our main HTML file! --><html> <head> <script src=\"https://cdn.jsdelivr.net/npm/p5\"></script> <script src=\"sketch.js\"></script> </head> <body> </body></html>",
"e": 1442,
"s": 1270,
"text": null
},
{
"code": null,
"e": 1548,
"s": 1442,
"text": "Note: We will only change script.js at every iteration, and the HTML file will necessarily remain intact!"
},
{
"code": null,
"e": 2195,
"s": 1548,
"text": "Finding bounding-box of an ellipse:/* p5.js Sketch for finding and drawing bounding-box of an ellipse*/function setup(){ createCanvas(480, 360);} // Draws bounding-box around the// given ellipse!function drawBBox(x0, y0, r1, r2){ // Draw only the outline // of the rectangle noFill(); // Draw the outline in red stroke(255, 0, 0); rect(x0-r1, y0-r2, 2*r1, 2*r2);}function draw() { let x0 = width/2, y0 = height/2; let r1 = 180, r2 = 100; // Note that `ellipse` takes in // diameters not radii! ellipse(x0, y0, 2*r1, 2*r2); drawBBox(x0, y0, r1, r2); // We don't want to draw this // over and over again noLoop();}Output:"
},
{
"code": "/* p5.js Sketch for finding and drawing bounding-box of an ellipse*/function setup(){ createCanvas(480, 360);} // Draws bounding-box around the// given ellipse!function drawBBox(x0, y0, r1, r2){ // Draw only the outline // of the rectangle noFill(); // Draw the outline in red stroke(255, 0, 0); rect(x0-r1, y0-r2, 2*r1, 2*r2);}function draw() { let x0 = width/2, y0 = height/2; let r1 = 180, r2 = 100; // Note that `ellipse` takes in // diameters not radii! ellipse(x0, y0, 2*r1, 2*r2); drawBBox(x0, y0, r1, r2); // We don't want to draw this // over and over again noLoop();}",
"e": 2800,
"s": 2195,
"text": null
},
{
"code": null,
"e": 2808,
"s": 2800,
"text": "Output:"
},
{
"code": null,
"e": 2980,
"s": 2808,
"text": "Finding bounding-box of a circle: It is same as an ellipse, since a circle is just a special case of an ellipse with same radii (same semi-major-axis and semi-minor axis)."
},
{
"code": null,
"e": 3496,
"s": 2980,
"text": "Finding bounding-box of a line-segment/* p5.js Sketch for finding and drawing bounding-box of a line-segment*/function setup() { createCanvas(480, 360);} // Draws bounding-box around the// given line-segment!function drawBBox(x1, y1, x2, y2) { stroke(255, 0, 0); noFill(); let x = min(x1, x2), y = min(y1, y2); let w = max(x1, x2) - x, h = max(y1, y2) - y; rect(x, y, w, h);} function draw() { let x1 = 280, y1 = 80, x2 = 180, y2 = 280; line(x1, y1, x2, y2); drawBBox(x1, y1, x2, y2); noLoop();}Output:"
},
{
"code": "/* p5.js Sketch for finding and drawing bounding-box of a line-segment*/function setup() { createCanvas(480, 360);} // Draws bounding-box around the// given line-segment!function drawBBox(x1, y1, x2, y2) { stroke(255, 0, 0); noFill(); let x = min(x1, x2), y = min(y1, y2); let w = max(x1, x2) - x, h = max(y1, y2) - y; rect(x, y, w, h);} function draw() { let x1 = 280, y1 = 80, x2 = 180, y2 = 280; line(x1, y1, x2, y2); drawBBox(x1, y1, x2, y2); noLoop();}",
"e": 3967,
"s": 3496,
"text": null
},
{
"code": null,
"e": 3975,
"s": 3967,
"text": "Output:"
},
{
"code": null,
"e": 4644,
"s": 3975,
"text": "Finding bounding-box of a triangle: Finding bounding-box of a triangle is very similar to finding bounding-box for line-segment./* p5.js Sketch for finding and drawing bounding-box of a triangle*/function setup() { createCanvas(480, 360);} // Draws bounding-box around the// given triangle!function drawBBox(x1, y1, x2, y2, x3, y3) { stroke(255, 0, 0); noFill(); let x = min(x1, x2, x3), y = min(y1, y2, y3); let w = max(x1, x2, x3) - x, h = max(y1, y2, y3) - y; rect(x, y, w, h);} function draw() { let x1 = 240, y1 = 80, x2 = 140; let y2 = 280, x3 = 340, y3 = 280; triangle(x1, y1, x2, y2, x3, y3); drawBBox(x1, y1, x2, y2, x3, y3); noLoop();}Output:"
},
{
"code": "/* p5.js Sketch for finding and drawing bounding-box of a triangle*/function setup() { createCanvas(480, 360);} // Draws bounding-box around the// given triangle!function drawBBox(x1, y1, x2, y2, x3, y3) { stroke(255, 0, 0); noFill(); let x = min(x1, x2, x3), y = min(y1, y2, y3); let w = max(x1, x2, x3) - x, h = max(y1, y2, y3) - y; rect(x, y, w, h);} function draw() { let x1 = 240, y1 = 80, x2 = 140; let y2 = 280, x3 = 340, y3 = 280; triangle(x1, y1, x2, y2, x3, y3); drawBBox(x1, y1, x2, y2, x3, y3); noLoop();}",
"e": 5178,
"s": 4644,
"text": null
},
{
"code": null,
"e": 5186,
"s": 5178,
"text": "Output:"
},
{
"code": null,
"e": 6183,
"s": 5186,
"text": "Finding bounding-box of a polygon: A triangle is a polygon, and if we find the bounding-box of a triangle then finding bounding-box for polygon shouldn’t be any difficulty. We just have to generalize so that we can have any number of vertices and we are done./* p5.js sketch for finding and drawing bounding-box of a polygon*/function setup() { createCanvas(480, 360);} // Draws bounding-box around// the given polygon!function drawBBox(x, y) { stroke(255, 0, 0); noFill(); let rx = min(x), ry = min(y); let w = max(x) - rx, h = max(y) - ry; rect(rx, ry, w, h);} function draw(){ /* Vertices for a star-polygon (decagon) */ let x = [240, 268, 334, 286, 298, 240, 182, 194, 146, 212]; let y = [80, 140, 150, 194, 260, 230, 260, 194, 150, 140]; beginShape(); for (let i = 0; i < x.length; ++i) vertex(x[i], y[i]); fill(255, 217, 0); // If you don't CLOSE it then it'd // draw a chained line-segment endShape(CLOSE); drawBBox(x, y); noLoop();}Output:"
},
{
"code": "/* p5.js sketch for finding and drawing bounding-box of a polygon*/function setup() { createCanvas(480, 360);} // Draws bounding-box around// the given polygon!function drawBBox(x, y) { stroke(255, 0, 0); noFill(); let rx = min(x), ry = min(y); let w = max(x) - rx, h = max(y) - ry; rect(rx, ry, w, h);} function draw(){ /* Vertices for a star-polygon (decagon) */ let x = [240, 268, 334, 286, 298, 240, 182, 194, 146, 212]; let y = [80, 140, 150, 194, 260, 230, 260, 194, 150, 140]; beginShape(); for (let i = 0; i < x.length; ++i) vertex(x[i], y[i]); fill(255, 217, 0); // If you don't CLOSE it then it'd // draw a chained line-segment endShape(CLOSE); drawBBox(x, y); noLoop();}",
"e": 6914,
"s": 6183,
"text": null
},
{
"code": null,
"e": 6922,
"s": 6914,
"text": "Output:"
},
{
"code": null,
"e": 7595,
"s": 6922,
"text": "Finding Bounding-Boxes is an important part of visualization applications. Also in dynamic applications such as games, one cannot compute capsule-collision detection at every frame without entailing a punishment in the performance. So before any complex collision-checking, a broad-phase check is made for early exit which returns false as soon as it is ascertained that the shape doesn’t collide with the other shape. If the broad-phase check is passed then comes the narrow-phase where the actual collision-detection (OOBB, SAT, capsule, ellipsoid, etc) happens! Hence finding the bounding-box is an important part of many graphics-rich applications for various reasons."
},
{
"code": null,
"e": 7612,
"s": 7595,
"text": "JavaScript-p5.js"
},
{
"code": null,
"e": 7623,
"s": 7612,
"text": "JavaScript"
},
{
"code": null,
"e": 7642,
"s": 7623,
"text": "Technical Scripter"
},
{
"code": null,
"e": 7659,
"s": 7642,
"text": "Web Technologies"
},
{
"code": null,
"e": 7686,
"s": 7659,
"text": "Web technologies Questions"
}
] |
DATEDIFF() Function in SQL Server | 18 Jan, 2021
DATEDIFF() function :This function in SQL Server is used to find the difference between the two specified dates.
Features :
This function is used to find the difference between the two given dates values.
This function comes under Date Functions.
This function accepts three parameters namely interval, first value of date, and second value of date.
This function can include time in the interval section and also in the date value section.
Syntax :
DATEDIFF(interval, date1, date2)
Parameter :This method accepts three parameters as given below :
interval : It is the specified part which is to be returned. Moreover, the values of the interval can be as given below:
year, yyyy, yy = Year, which is the specified year.quarter, qq, q = Quarter, which is the specified quarter.month, mm, m = month, which is the specified month.dayofyear, dy, y = Day of the year, which is the specified day of the year.day, dd, d = Day, which is the specified day.week, ww, wk = Week, which is the specified week.weekday, dw, w = Weekday, which is the specified week day.hour, hh = hour, which is the specified hour.minute, mi, n = Minute, which is the specified minute.second, ss, s = Second, which is the specified second.millisecond, ms = Millisecond, which is the specified millisecond.
year, yyyy, yy = Year, which is the specified year.
quarter, qq, q = Quarter, which is the specified quarter.
month, mm, m = month, which is the specified month.
dayofyear, dy, y = Day of the year, which is the specified day of the year.
day, dd, d = Day, which is the specified day.
week, ww, wk = Week, which is the specified week.
weekday, dw, w = Weekday, which is the specified week day.
hour, hh = hour, which is the specified hour.
minute, mi, n = Minute, which is the specified minute.
second, ss, s = Second, which is the specified second.
millisecond, ms = Millisecond, which is the specified millisecond.
date1, date2 : The two specified dates in order to find the difference between them.
Returns :It returns the difference between the two specified dates.
Example-1 :Using DATEDIFF() function and getting the difference between two values of dates, in years.
SELECT DATEDIFF(year, '2010/01/12', '2021/01/12');
Output :
11
Example-2 :Using DATEDIFF() function and getting the difference between two values of dates, in months.
SELECT DATEDIFF(month, '2010/2/12', '2021/12/12');
Output :
142
Example-3 :Using DATEDIFF() function and getting the negative difference between the two values of dates, in day.
SELECT DATEDIFF(day, '2021/2/1', '2010/12/12');
Output :
-3704
Example-4 :Using DATEDIFF() function and getting the difference between the two values of dates which includes time as well, in hour.
SELECT DATEDIFF(hour, '2019/2/1 09:55', '2020/12/12 07:45');
Output :
16318
Example-5 :Using DATEDIFF() function and getting the difference between the two values of dates using variables which includes time as well, in second.
DECLARE @date1 VARCHAR(50);
DECLARE @date2 VARCHAR(50);
SET @date1 = '2019/2/1 09:55:44';
SET @date2 = '2020/12/12 07:45:22';
SELECT DATEDIFF(second, @date1, @date2);
Output :
58744178
Application :This function is used to find the difference between two specified values of date.
DBMS-SQL
SQL-Server
SQL
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
CTE in SQL
SQL Trigger | Student Database
How to Update Multiple Columns in Single Update Statement in SQL?
SQL | Views
Difference between DELETE, DROP and TRUNCATE
Difference between SQL and NoSQL
Window functions in SQL
MySQL | Group_CONCAT() Function
SQL | GROUP BY
Difference between DDL and DML in DBMS | [
{
"code": null,
"e": 53,
"s": 25,
"text": "\n18 Jan, 2021"
},
{
"code": null,
"e": 166,
"s": 53,
"text": "DATEDIFF() function :This function in SQL Server is used to find the difference between the two specified dates."
},
{
"code": null,
"e": 177,
"s": 166,
"text": "Features :"
},
{
"code": null,
"e": 258,
"s": 177,
"text": "This function is used to find the difference between the two given dates values."
},
{
"code": null,
"e": 300,
"s": 258,
"text": "This function comes under Date Functions."
},
{
"code": null,
"e": 403,
"s": 300,
"text": "This function accepts three parameters namely interval, first value of date, and second value of date."
},
{
"code": null,
"e": 494,
"s": 403,
"text": "This function can include time in the interval section and also in the date value section."
},
{
"code": null,
"e": 503,
"s": 494,
"text": "Syntax :"
},
{
"code": null,
"e": 537,
"s": 503,
"text": "DATEDIFF(interval, date1, date2)\n"
},
{
"code": null,
"e": 602,
"s": 537,
"text": "Parameter :This method accepts three parameters as given below :"
},
{
"code": null,
"e": 723,
"s": 602,
"text": "interval : It is the specified part which is to be returned. Moreover, the values of the interval can be as given below:"
},
{
"code": null,
"e": 1329,
"s": 723,
"text": "year, yyyy, yy = Year, which is the specified year.quarter, qq, q = Quarter, which is the specified quarter.month, mm, m = month, which is the specified month.dayofyear, dy, y = Day of the year, which is the specified day of the year.day, dd, d = Day, which is the specified day.week, ww, wk = Week, which is the specified week.weekday, dw, w = Weekday, which is the specified week day.hour, hh = hour, which is the specified hour.minute, mi, n = Minute, which is the specified minute.second, ss, s = Second, which is the specified second.millisecond, ms = Millisecond, which is the specified millisecond."
},
{
"code": null,
"e": 1381,
"s": 1329,
"text": "year, yyyy, yy = Year, which is the specified year."
},
{
"code": null,
"e": 1439,
"s": 1381,
"text": "quarter, qq, q = Quarter, which is the specified quarter."
},
{
"code": null,
"e": 1491,
"s": 1439,
"text": "month, mm, m = month, which is the specified month."
},
{
"code": null,
"e": 1567,
"s": 1491,
"text": "dayofyear, dy, y = Day of the year, which is the specified day of the year."
},
{
"code": null,
"e": 1613,
"s": 1567,
"text": "day, dd, d = Day, which is the specified day."
},
{
"code": null,
"e": 1663,
"s": 1613,
"text": "week, ww, wk = Week, which is the specified week."
},
{
"code": null,
"e": 1722,
"s": 1663,
"text": "weekday, dw, w = Weekday, which is the specified week day."
},
{
"code": null,
"e": 1768,
"s": 1722,
"text": "hour, hh = hour, which is the specified hour."
},
{
"code": null,
"e": 1823,
"s": 1768,
"text": "minute, mi, n = Minute, which is the specified minute."
},
{
"code": null,
"e": 1878,
"s": 1823,
"text": "second, ss, s = Second, which is the specified second."
},
{
"code": null,
"e": 1945,
"s": 1878,
"text": "millisecond, ms = Millisecond, which is the specified millisecond."
},
{
"code": null,
"e": 2030,
"s": 1945,
"text": "date1, date2 : The two specified dates in order to find the difference between them."
},
{
"code": null,
"e": 2098,
"s": 2030,
"text": "Returns :It returns the difference between the two specified dates."
},
{
"code": null,
"e": 2201,
"s": 2098,
"text": "Example-1 :Using DATEDIFF() function and getting the difference between two values of dates, in years."
},
{
"code": null,
"e": 2253,
"s": 2201,
"text": "SELECT DATEDIFF(year, '2010/01/12', '2021/01/12');\n"
},
{
"code": null,
"e": 2262,
"s": 2253,
"text": "Output :"
},
{
"code": null,
"e": 2265,
"s": 2262,
"text": "11"
},
{
"code": null,
"e": 2369,
"s": 2265,
"text": "Example-2 :Using DATEDIFF() function and getting the difference between two values of dates, in months."
},
{
"code": null,
"e": 2421,
"s": 2369,
"text": "SELECT DATEDIFF(month, '2010/2/12', '2021/12/12');\n"
},
{
"code": null,
"e": 2430,
"s": 2421,
"text": "Output :"
},
{
"code": null,
"e": 2434,
"s": 2430,
"text": "142"
},
{
"code": null,
"e": 2548,
"s": 2434,
"text": "Example-3 :Using DATEDIFF() function and getting the negative difference between the two values of dates, in day."
},
{
"code": null,
"e": 2597,
"s": 2548,
"text": "SELECT DATEDIFF(day, '2021/2/1', '2010/12/12');\n"
},
{
"code": null,
"e": 2606,
"s": 2597,
"text": "Output :"
},
{
"code": null,
"e": 2612,
"s": 2606,
"text": "-3704"
},
{
"code": null,
"e": 2746,
"s": 2612,
"text": "Example-4 :Using DATEDIFF() function and getting the difference between the two values of dates which includes time as well, in hour."
},
{
"code": null,
"e": 2808,
"s": 2746,
"text": "SELECT DATEDIFF(hour, '2019/2/1 09:55', '2020/12/12 07:45');\n"
},
{
"code": null,
"e": 2817,
"s": 2808,
"text": "Output :"
},
{
"code": null,
"e": 2823,
"s": 2817,
"text": "16318"
},
{
"code": null,
"e": 2975,
"s": 2823,
"text": "Example-5 :Using DATEDIFF() function and getting the difference between the two values of dates using variables which includes time as well, in second."
},
{
"code": null,
"e": 3143,
"s": 2975,
"text": "DECLARE @date1 VARCHAR(50);\nDECLARE @date2 VARCHAR(50);\nSET @date1 = '2019/2/1 09:55:44';\nSET @date2 = '2020/12/12 07:45:22';\nSELECT DATEDIFF(second, @date1, @date2);\n"
},
{
"code": null,
"e": 3152,
"s": 3143,
"text": "Output :"
},
{
"code": null,
"e": 3161,
"s": 3152,
"text": "58744178"
},
{
"code": null,
"e": 3257,
"s": 3161,
"text": "Application :This function is used to find the difference between two specified values of date."
},
{
"code": null,
"e": 3266,
"s": 3257,
"text": "DBMS-SQL"
},
{
"code": null,
"e": 3277,
"s": 3266,
"text": "SQL-Server"
},
{
"code": null,
"e": 3281,
"s": 3277,
"text": "SQL"
},
{
"code": null,
"e": 3285,
"s": 3281,
"text": "SQL"
},
{
"code": null,
"e": 3383,
"s": 3285,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 3394,
"s": 3383,
"text": "CTE in SQL"
},
{
"code": null,
"e": 3425,
"s": 3394,
"text": "SQL Trigger | Student Database"
},
{
"code": null,
"e": 3491,
"s": 3425,
"text": "How to Update Multiple Columns in Single Update Statement in SQL?"
},
{
"code": null,
"e": 3503,
"s": 3491,
"text": "SQL | Views"
},
{
"code": null,
"e": 3548,
"s": 3503,
"text": "Difference between DELETE, DROP and TRUNCATE"
},
{
"code": null,
"e": 3581,
"s": 3548,
"text": "Difference between SQL and NoSQL"
},
{
"code": null,
"e": 3605,
"s": 3581,
"text": "Window functions in SQL"
},
{
"code": null,
"e": 3637,
"s": 3605,
"text": "MySQL | Group_CONCAT() Function"
},
{
"code": null,
"e": 3652,
"s": 3637,
"text": "SQL | GROUP BY"
}
] |
Python | Get a list as input from user | 08 Jul, 2022
We often encounter a situation when we need to take number/string as input from the user. In this article, we will see how to get as input a list from the user.
Examples:
Input : n = 4, ele = 1 2 3 4
Output : [1, 2, 3, 4]
Input : n = 6, ele = 3 4 1 7 9 6
Output : [3, 4, 1, 7, 9, 6]
Code #1: Basic example
Python3
# creating an empty listlst = [] # number of elements as inputn = int(input("Enter number of elements : ")) # iterating till the rangefor i in range(0, n): ele = int(input()) lst.append(ele) # adding the element print(lst)
Output:
Code #2: With handling exception
Python3
# try block to handle the exceptiontry: my_list = [] while True: my_list.append(int(input())) # if the input is not-integer, just print the listexcept: print(my_list)
Output:
Code #3: Using map()
Python3
# number of elementsn = int(input("Enter number of elements : ")) # Below line read inputs from user using map() function a = list(map(int,input("\nEnter the numbers : ").strip().split()))[:n] print("\nList is - ", a)
Output:
Code #4: List of lists as input
Python3
lst = [ ]n = int(input("Enter number of elements : ")) for i in range(0, n): ele = [input(), int(input())] lst.append(ele) print(lst)
Output:
Code #5: Using List Comprehension and Typecasting
Python3
# For list of integerslst1 = [] # For list of strings/charslst2 = [] lst1 = [int(item) for item in input("Enter the list items : ").split()] lst2 = [item for item in input("Enter the list items : ").split()] print(lst1)print(lst2)
Output:
rahulsrivastava7
sooda367
Python list-programs
python-list
Python
python-list
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Different ways to create Pandas Dataframe
Enumerate() in Python
Read a file line by line in Python
Python String | replace()
How to Install PIP on Windows ?
*args and **kwargs in Python
Python Classes and Objects
Iterate over a list in Python
Python OOPs Concepts | [
{
"code": null,
"e": 52,
"s": 24,
"text": "\n08 Jul, 2022"
},
{
"code": null,
"e": 214,
"s": 52,
"text": "We often encounter a situation when we need to take number/string as input from the user. In this article, we will see how to get as input a list from the user. "
},
{
"code": null,
"e": 226,
"s": 214,
"text": "Examples: "
},
{
"code": null,
"e": 341,
"s": 226,
"text": "Input : n = 4, ele = 1 2 3 4\nOutput : [1, 2, 3, 4]\n\nInput : n = 6, ele = 3 4 1 7 9 6\nOutput : [3, 4, 1, 7, 9, 6]"
},
{
"code": null,
"e": 366,
"s": 341,
"text": "Code #1: Basic example "
},
{
"code": null,
"e": 374,
"s": 366,
"text": "Python3"
},
{
"code": "# creating an empty listlst = [] # number of elements as inputn = int(input(\"Enter number of elements : \")) # iterating till the rangefor i in range(0, n): ele = int(input()) lst.append(ele) # adding the element print(lst)",
"e": 612,
"s": 374,
"text": null
},
{
"code": null,
"e": 622,
"s": 612,
"text": "Output: "
},
{
"code": null,
"e": 659,
"s": 622,
"text": " Code #2: With handling exception "
},
{
"code": null,
"e": 667,
"s": 659,
"text": "Python3"
},
{
"code": "# try block to handle the exceptiontry: my_list = [] while True: my_list.append(int(input())) # if the input is not-integer, just print the listexcept: print(my_list)",
"e": 865,
"s": 667,
"text": null
},
{
"code": null,
"e": 875,
"s": 865,
"text": "Output: "
},
{
"code": null,
"e": 900,
"s": 875,
"text": " Code #3: Using map() "
},
{
"code": null,
"e": 908,
"s": 900,
"text": "Python3"
},
{
"code": "# number of elementsn = int(input(\"Enter number of elements : \")) # Below line read inputs from user using map() function a = list(map(int,input(\"\\nEnter the numbers : \").strip().split()))[:n] print(\"\\nList is - \", a)",
"e": 1128,
"s": 908,
"text": null
},
{
"code": null,
"e": 1138,
"s": 1128,
"text": "Output: "
},
{
"code": null,
"e": 1174,
"s": 1138,
"text": " Code #4: List of lists as input "
},
{
"code": null,
"e": 1182,
"s": 1174,
"text": "Python3"
},
{
"code": "lst = [ ]n = int(input(\"Enter number of elements : \")) for i in range(0, n): ele = [input(), int(input())] lst.append(ele) print(lst)",
"e": 1328,
"s": 1182,
"text": null
},
{
"code": null,
"e": 1338,
"s": 1328,
"text": "Output: "
},
{
"code": null,
"e": 1390,
"s": 1338,
"text": "Code #5: Using List Comprehension and Typecasting "
},
{
"code": null,
"e": 1398,
"s": 1390,
"text": "Python3"
},
{
"code": "# For list of integerslst1 = [] # For list of strings/charslst2 = [] lst1 = [int(item) for item in input(\"Enter the list items : \").split()] lst2 = [item for item in input(\"Enter the list items : \").split()] print(lst1)print(lst2)",
"e": 1637,
"s": 1398,
"text": null
},
{
"code": null,
"e": 1647,
"s": 1637,
"text": "Output: "
},
{
"code": null,
"e": 1666,
"s": 1649,
"text": "rahulsrivastava7"
},
{
"code": null,
"e": 1675,
"s": 1666,
"text": "sooda367"
},
{
"code": null,
"e": 1696,
"s": 1675,
"text": "Python list-programs"
},
{
"code": null,
"e": 1708,
"s": 1696,
"text": "python-list"
},
{
"code": null,
"e": 1715,
"s": 1708,
"text": "Python"
},
{
"code": null,
"e": 1727,
"s": 1715,
"text": "python-list"
},
{
"code": null,
"e": 1825,
"s": 1727,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 1843,
"s": 1825,
"text": "Python Dictionary"
},
{
"code": null,
"e": 1885,
"s": 1843,
"text": "Different ways to create Pandas Dataframe"
},
{
"code": null,
"e": 1907,
"s": 1885,
"text": "Enumerate() in Python"
},
{
"code": null,
"e": 1942,
"s": 1907,
"text": "Read a file line by line in Python"
},
{
"code": null,
"e": 1968,
"s": 1942,
"text": "Python String | replace()"
},
{
"code": null,
"e": 2000,
"s": 1968,
"text": "How to Install PIP on Windows ?"
},
{
"code": null,
"e": 2029,
"s": 2000,
"text": "*args and **kwargs in Python"
},
{
"code": null,
"e": 2056,
"s": 2029,
"text": "Python Classes and Objects"
},
{
"code": null,
"e": 2086,
"s": 2056,
"text": "Iterate over a list in Python"
}
] |
Getting the absolute value of a number in Julia – abs() Method | 21 Apr, 2020
The abs() is an inbuilt function in julia which is used to return the absolute value of the specified number x.
Syntax: abs(x)
Parameters:
x: Specified value.
Returns: It returns the absolute value of the specified number x.
Example 1:
# Julia program to illustrate # the use of abs() method # Getting absolute value of the # specified number xprintln(abs(0))println(abs(-2.7))println(abs(2))
Output:
0
2.7
2
Example 2:
# Julia program to illustrate # the use of abs() method # Getting absolute value of the # specified number xprintln(abs(0))println(abs(-2.7))println(abs(-2.9))println(abs(0.7))println(abs(-0.2))println(abs(-22))
Output:
0
2.7
2.9
0.7
0.2
22
Julia
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Vectors in Julia
Getting rounded value of a number in Julia - round() Method
Storing Output on a File in Julia
Reshaping array dimensions in Julia | Array reshape() Method
Manipulating matrices in Julia
Exception handling in Julia
Formatting of Strings in Julia
Creating array with repeated elements in Julia - repeat() Method
Tuples in Julia
while loop in Julia | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n21 Apr, 2020"
},
{
"code": null,
"e": 140,
"s": 28,
"text": "The abs() is an inbuilt function in julia which is used to return the absolute value of the specified number x."
},
{
"code": null,
"e": 155,
"s": 140,
"text": "Syntax: abs(x)"
},
{
"code": null,
"e": 167,
"s": 155,
"text": "Parameters:"
},
{
"code": null,
"e": 187,
"s": 167,
"text": "x: Specified value."
},
{
"code": null,
"e": 253,
"s": 187,
"text": "Returns: It returns the absolute value of the specified number x."
},
{
"code": null,
"e": 264,
"s": 253,
"text": "Example 1:"
},
{
"code": "# Julia program to illustrate # the use of abs() method # Getting absolute value of the # specified number xprintln(abs(0))println(abs(-2.7))println(abs(2))",
"e": 422,
"s": 264,
"text": null
},
{
"code": null,
"e": 430,
"s": 422,
"text": "Output:"
},
{
"code": null,
"e": 439,
"s": 430,
"text": "0\n2.7\n2\n"
},
{
"code": null,
"e": 450,
"s": 439,
"text": "Example 2:"
},
{
"code": "# Julia program to illustrate # the use of abs() method # Getting absolute value of the # specified number xprintln(abs(0))println(abs(-2.7))println(abs(-2.9))println(abs(0.7))println(abs(-0.2))println(abs(-22))",
"e": 663,
"s": 450,
"text": null
},
{
"code": null,
"e": 671,
"s": 663,
"text": "Output:"
},
{
"code": null,
"e": 693,
"s": 671,
"text": "0\n2.7\n2.9\n0.7\n0.2\n22\n"
},
{
"code": null,
"e": 699,
"s": 693,
"text": "Julia"
},
{
"code": null,
"e": 797,
"s": 699,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 814,
"s": 797,
"text": "Vectors in Julia"
},
{
"code": null,
"e": 874,
"s": 814,
"text": "Getting rounded value of a number in Julia - round() Method"
},
{
"code": null,
"e": 908,
"s": 874,
"text": "Storing Output on a File in Julia"
},
{
"code": null,
"e": 969,
"s": 908,
"text": "Reshaping array dimensions in Julia | Array reshape() Method"
},
{
"code": null,
"e": 1000,
"s": 969,
"text": "Manipulating matrices in Julia"
},
{
"code": null,
"e": 1028,
"s": 1000,
"text": "Exception handling in Julia"
},
{
"code": null,
"e": 1059,
"s": 1028,
"text": "Formatting of Strings in Julia"
},
{
"code": null,
"e": 1124,
"s": 1059,
"text": "Creating array with repeated elements in Julia - repeat() Method"
},
{
"code": null,
"e": 1140,
"s": 1124,
"text": "Tuples in Julia"
}
] |
Puzzle | Program to find number of squares in a chessboard - GeeksforGeeks | 04 Jan, 2022
Puzzle: You are provided with a chessboard and are asked to find the number of squares in it. A chessboard is a board with 8 x 8 grids in it as represented below.
Solution: Looking closely at the chessboard we can see that in addition to the 1 x 1 square, there can be a combination of 2 x 2, 3 x 3, 4 x 4, 5 x 5, 6 x 6, 7 x 7, and 8 x 8 squares too. To get the total number of squares we need to find all the squares formed.
1 x 1: 8 * 8 = 64 squares.
2 x 2: 7 * 7 = 49 squares.
3 x 3: 6 * 6 = 36 squares.
4 x 4: 5 * 5 = 25 squares.
5 x 5: 4 * 4 = 16 squares.
6 x 6: 3 * 3 = 9 squares.
7 x 7: 2 * 2 = 4 squares.
8 x 8: 1 * 1 = 1 square.
Therefore, we have in all = 64 + 49 + 36 + 25 + 16 + 9 + 4 + 1 = 204 squares in a chessboard.
General ProcessGiven an n x n grid, count squares in it.
Examples:
Input: n = 2
Output: 5 (4 squares of 1 unit + 1 square of 2 units)
Input: n = 3
Output: 14 (9 squares of 1 unit + 4 square of 2 units
+ 1 square of 1 unit)
For a grid of size n*n the total number of squares formed are:
1^2 + 2^2 + 3^2 + ... + n^2 = n(n+1)(2n+1) / 6
Below is the implementation of the above formula. Since the value of n*(n+1)*(2n+1) can cause overflow for large values of n, below are some interesting tricks used in the program.
long int is used in return.n * (n + 1) / 2 is evaluated first as the value n*(n+1) will always be a multiple of 2.
long int is used in return.
n * (n + 1) / 2 is evaluated first as the value n*(n+1) will always be a multiple of 2.
Note that overflow may still happen, but the above tricks just reduce the chances of an overflow.
C++
Java
Python3
C#
PHP
Javascript
// C++ find number of squares in a// chessboard#include <bits/stdc++.h>using namespace std; // Function to return count of squares;long long int countSquares(int n){ return (n * (n + 1) / 2) * (2 * n + 1) / 3;} // Driver Codeint main(){ int n = 4; cout << countSquares(n); return 0;} //vermay87 `
// Java find number of squares in a// chessboard class GFG{ // Function to return count of squares; static int countSquares(int n) { // A better way to write n*(n+1)*(2n+1)/6 return (n * (n + 1) / 2) * (2 * n + 1) / 3; } // Driver code public static void main (String[] args) { int n = 3; System.out.println("Count of squares is " +countSquares(n)); }} // This code is contributed by Anant Agarwal.
# python code to find number# of squares in a chessboard # Function to return count# of squares;def countSquares(n): # better way to write # n*(n+1)*(2n+1)/6 return ((n * (n + 1) / 2) * (2 * n + 1) / 3) # Driver coden = 4print("Count of squares is ", countSquares(n)) # This code is contributed by sam007.
// C# find number of squares in a// chessboardusing System; public class GFG { static int countSquares(int n) { // A better way to write // n*(n+1)*(2n+1)/6 return (n * (n + 1) / 2) * (2 * n + 1) / 3; } // Driver code public static void Main () { int n = 4; Console.WriteLine("Count of" + "squares is " + countSquares(n)); }} // This code is contributed by Sam007.
<?php// PHP program to find number// of squares in a chessboard // Function to return// count of squares;function countSquares($n){ // A better way to // write n*(n+1)*(2n+1)/6 return ($n * ($n + 1) / 2) * (2 * $n + 1) / 3;} // Driver Code$n = 4;echo "Count of squares is " , countSquares($n); // This code is contributed// by nitin mittal.?>
<script> // Java find number of squares in a// chessboard // Function to return count of squares;function countSquares( n){ // A better way to write n*(n+1)*(2n+1)/6 return (n * (n + 1) / 2) * (2*n + 1) / 3;} // Driver Code let n = 4;document.write("Count of squares is " + countSquares(n)); </script>
Output:
Count of squares is 30
This article is contributed by Rishabh. Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above
Sam007
nitin mittal
Chinmoy Lenka
jana_sayantan
vermay87
Goldman Sachs
MAQ Software
number-theory
permutation
Articles
Mathematical
Goldman Sachs
MAQ Software
number-theory
Mathematical
permutation
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Service-Oriented Architecture
Const keyword in C++
Amazon’s most frequently asked interview questions | Set 2
What's the difference between Scripting and Programming Languages?
Must Do Questions for Companies like TCS, CTS, HCL, IBM ...
Program for Fibonacci numbers
Write a program to print all permutations of a given string
C++ Data Types
Set in C++ Standard Template Library (STL)
Coin Change | DP-7 | [
{
"code": null,
"e": 26358,
"s": 26330,
"text": "\n04 Jan, 2022"
},
{
"code": null,
"e": 26522,
"s": 26358,
"text": "Puzzle: You are provided with a chessboard and are asked to find the number of squares in it. A chessboard is a board with 8 x 8 grids in it as represented below. "
},
{
"code": null,
"e": 26786,
"s": 26522,
"text": "Solution: Looking closely at the chessboard we can see that in addition to the 1 x 1 square, there can be a combination of 2 x 2, 3 x 3, 4 x 4, 5 x 5, 6 x 6, 7 x 7, and 8 x 8 squares too. To get the total number of squares we need to find all the squares formed. "
},
{
"code": null,
"e": 26998,
"s": 26786,
"text": "1 x 1: 8 * 8 = 64 squares.\n2 x 2: 7 * 7 = 49 squares.\n3 x 3: 6 * 6 = 36 squares.\n4 x 4: 5 * 5 = 25 squares.\n5 x 5: 4 * 4 = 16 squares.\n6 x 6: 3 * 3 = 9 squares.\n7 x 7: 2 * 2 = 4 squares.\n8 x 8: 1 * 1 = 1 square."
},
{
"code": null,
"e": 27093,
"s": 26998,
"text": "Therefore, we have in all = 64 + 49 + 36 + 25 + 16 + 9 + 4 + 1 = 204 squares in a chessboard. "
},
{
"code": null,
"e": 27151,
"s": 27093,
"text": "General ProcessGiven an n x n grid, count squares in it. "
},
{
"code": null,
"e": 27162,
"s": 27151,
"text": "Examples: "
},
{
"code": null,
"e": 27353,
"s": 27162,
"text": "Input: n = 2\nOutput: 5 (4 squares of 1 unit + 1 square of 2 units)\n\nInput: n = 3\nOutput: 14 (9 squares of 1 unit + 4 square of 2 units \n + 1 square of 1 unit) "
},
{
"code": null,
"e": 27417,
"s": 27353,
"text": "For a grid of size n*n the total number of squares formed are: "
},
{
"code": null,
"e": 27465,
"s": 27417,
"text": "1^2 + 2^2 + 3^2 + ... + n^2 = n(n+1)(2n+1) / 6 "
},
{
"code": null,
"e": 27647,
"s": 27465,
"text": "Below is the implementation of the above formula. Since the value of n*(n+1)*(2n+1) can cause overflow for large values of n, below are some interesting tricks used in the program. "
},
{
"code": null,
"e": 27762,
"s": 27647,
"text": "long int is used in return.n * (n + 1) / 2 is evaluated first as the value n*(n+1) will always be a multiple of 2."
},
{
"code": null,
"e": 27790,
"s": 27762,
"text": "long int is used in return."
},
{
"code": null,
"e": 27878,
"s": 27790,
"text": "n * (n + 1) / 2 is evaluated first as the value n*(n+1) will always be a multiple of 2."
},
{
"code": null,
"e": 27978,
"s": 27878,
"text": "Note that overflow may still happen, but the above tricks just reduce the chances of an overflow. "
},
{
"code": null,
"e": 27982,
"s": 27978,
"text": "C++"
},
{
"code": null,
"e": 27987,
"s": 27982,
"text": "Java"
},
{
"code": null,
"e": 27995,
"s": 27987,
"text": "Python3"
},
{
"code": null,
"e": 27998,
"s": 27995,
"text": "C#"
},
{
"code": null,
"e": 28002,
"s": 27998,
"text": "PHP"
},
{
"code": null,
"e": 28013,
"s": 28002,
"text": "Javascript"
},
{
"code": "// C++ find number of squares in a// chessboard#include <bits/stdc++.h>using namespace std; // Function to return count of squares;long long int countSquares(int n){ return (n * (n + 1) / 2) * (2 * n + 1) / 3;} // Driver Codeint main(){ int n = 4; cout << countSquares(n); return 0;} //vermay87 `",
"e": 28319,
"s": 28013,
"text": null
},
{
"code": "// Java find number of squares in a// chessboard class GFG{ // Function to return count of squares; static int countSquares(int n) { // A better way to write n*(n+1)*(2n+1)/6 return (n * (n + 1) / 2) * (2 * n + 1) / 3; } // Driver code public static void main (String[] args) { int n = 3; System.out.println(\"Count of squares is \" +countSquares(n)); }} // This code is contributed by Anant Agarwal.",
"e": 28803,
"s": 28319,
"text": null
},
{
"code": "# python code to find number# of squares in a chessboard # Function to return count# of squares;def countSquares(n): # better way to write # n*(n+1)*(2n+1)/6 return ((n * (n + 1) / 2) * (2 * n + 1) / 3) # Driver coden = 4print(\"Count of squares is \", countSquares(n)) # This code is contributed by sam007.",
"e": 29150,
"s": 28803,
"text": null
},
{
"code": "// C# find number of squares in a// chessboardusing System; public class GFG { static int countSquares(int n) { // A better way to write // n*(n+1)*(2n+1)/6 return (n * (n + 1) / 2) * (2 * n + 1) / 3; } // Driver code public static void Main () { int n = 4; Console.WriteLine(\"Count of\" + \"squares is \" + countSquares(n)); }} // This code is contributed by Sam007.",
"e": 29632,
"s": 29150,
"text": null
},
{
"code": "<?php// PHP program to find number// of squares in a chessboard // Function to return// count of squares;function countSquares($n){ // A better way to // write n*(n+1)*(2n+1)/6 return ($n * ($n + 1) / 2) * (2 * $n + 1) / 3;} // Driver Code$n = 4;echo \"Count of squares is \" , countSquares($n); // This code is contributed// by nitin mittal.?>",
"e": 30009,
"s": 29632,
"text": null
},
{
"code": "<script> // Java find number of squares in a// chessboard // Function to return count of squares;function countSquares( n){ // A better way to write n*(n+1)*(2n+1)/6 return (n * (n + 1) / 2) * (2*n + 1) / 3;} // Driver Code let n = 4;document.write(\"Count of squares is \" + countSquares(n)); </script>",
"e": 30318,
"s": 30009,
"text": null
},
{
"code": null,
"e": 30328,
"s": 30318,
"text": "Output: "
},
{
"code": null,
"e": 30351,
"s": 30328,
"text": "Count of squares is 30"
},
{
"code": null,
"e": 30516,
"s": 30351,
"text": "This article is contributed by Rishabh. Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above "
},
{
"code": null,
"e": 30523,
"s": 30516,
"text": "Sam007"
},
{
"code": null,
"e": 30536,
"s": 30523,
"text": "nitin mittal"
},
{
"code": null,
"e": 30550,
"s": 30536,
"text": "Chinmoy Lenka"
},
{
"code": null,
"e": 30564,
"s": 30550,
"text": "jana_sayantan"
},
{
"code": null,
"e": 30573,
"s": 30564,
"text": "vermay87"
},
{
"code": null,
"e": 30587,
"s": 30573,
"text": "Goldman Sachs"
},
{
"code": null,
"e": 30600,
"s": 30587,
"text": "MAQ Software"
},
{
"code": null,
"e": 30614,
"s": 30600,
"text": "number-theory"
},
{
"code": null,
"e": 30626,
"s": 30614,
"text": "permutation"
},
{
"code": null,
"e": 30635,
"s": 30626,
"text": "Articles"
},
{
"code": null,
"e": 30648,
"s": 30635,
"text": "Mathematical"
},
{
"code": null,
"e": 30662,
"s": 30648,
"text": "Goldman Sachs"
},
{
"code": null,
"e": 30675,
"s": 30662,
"text": "MAQ Software"
},
{
"code": null,
"e": 30689,
"s": 30675,
"text": "number-theory"
},
{
"code": null,
"e": 30702,
"s": 30689,
"text": "Mathematical"
},
{
"code": null,
"e": 30714,
"s": 30702,
"text": "permutation"
},
{
"code": null,
"e": 30812,
"s": 30714,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 30842,
"s": 30812,
"text": "Service-Oriented Architecture"
},
{
"code": null,
"e": 30863,
"s": 30842,
"text": "Const keyword in C++"
},
{
"code": null,
"e": 30922,
"s": 30863,
"text": "Amazon’s most frequently asked interview questions | Set 2"
},
{
"code": null,
"e": 30989,
"s": 30922,
"text": "What's the difference between Scripting and Programming Languages?"
},
{
"code": null,
"e": 31049,
"s": 30989,
"text": "Must Do Questions for Companies like TCS, CTS, HCL, IBM ..."
},
{
"code": null,
"e": 31079,
"s": 31049,
"text": "Program for Fibonacci numbers"
},
{
"code": null,
"e": 31139,
"s": 31079,
"text": "Write a program to print all permutations of a given string"
},
{
"code": null,
"e": 31154,
"s": 31139,
"text": "C++ Data Types"
},
{
"code": null,
"e": 31197,
"s": 31154,
"text": "Set in C++ Standard Template Library (STL)"
}
] |
Python EasyGUI - Button Box - GeeksforGeeks | 05 Sep, 2020
EasyGUI is a module for very simple, very easy GUI programming in Python. EasyGUI is different from other GUI generators in that EasyGUI is NOT event-driven. Instead, all GUI interactions are invoked by simple function calls. Unlike other complicated GUI’s EasyGUI is the simplest GUI till now.
Button Box : It is used to display a window having multiple buttons in EasyGUI, it can be used where there is condition to select one among lot of buttons for example buttons in lift at a time user can opt only one option, below is how the normal button box looks like
In order to do this we will use buttonbox method
Syntax : buttonbox(text, title, button_list)
Argument : It takes 3 arguments, first string i.e text to be displayed, second string i.e title of the window and third list of button(strings)
Return : It returns the text of the button that the user selected
Example :In this we will create a button box windows having a three buttons which user can select and selected button text will get printed, below is the implementation
# importing easygui modulefrom easygui import * # message to be displayed text = "Message to be displayed on the window GfG" # window titletitle = "Window Title GfG" # button listbutton_list = [] # button 1button1 = "First" # second buttonbutton2 = "Second" # third buttonbutton3 = "Third" # appending button to the button listbutton_list.append(button1)button_list.append(button2)button_list.append(button3) # creating a button boxoutput = buttonbox(text, title, button_list) # printing the button pressed by the userprint("User selected option : ", end = " ")print(output)
Output :
User selected option : Second
Another example :
# importing easygui modulefrom easygui import * # message to be displayed text = "Message to be displayed on the window GfG" # window titletitle = "Window Title GfG" # creating a button boxoutput = buttonbox(text, title) # printing the button pressed by the userprint("User selected option : ", end = " ")print(output)
Output :
User selected option : Button[3]
Python-EasyGUI
Python-gui
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Read a file line by line in Python
Enumerate() in Python
Different ways to create Pandas Dataframe
Iterate over a list in Python
Python String | replace()
Reading and Writing to text files in Python
*args and **kwargs in Python
Convert integer to string in Python
Check if element exists in list in Python | [
{
"code": null,
"e": 25279,
"s": 25251,
"text": "\n05 Sep, 2020"
},
{
"code": null,
"e": 25574,
"s": 25279,
"text": "EasyGUI is a module for very simple, very easy GUI programming in Python. EasyGUI is different from other GUI generators in that EasyGUI is NOT event-driven. Instead, all GUI interactions are invoked by simple function calls. Unlike other complicated GUI’s EasyGUI is the simplest GUI till now."
},
{
"code": null,
"e": 25843,
"s": 25574,
"text": "Button Box : It is used to display a window having multiple buttons in EasyGUI, it can be used where there is condition to select one among lot of buttons for example buttons in lift at a time user can opt only one option, below is how the normal button box looks like"
},
{
"code": null,
"e": 25892,
"s": 25843,
"text": "In order to do this we will use buttonbox method"
},
{
"code": null,
"e": 25937,
"s": 25892,
"text": "Syntax : buttonbox(text, title, button_list)"
},
{
"code": null,
"e": 26081,
"s": 25937,
"text": "Argument : It takes 3 arguments, first string i.e text to be displayed, second string i.e title of the window and third list of button(strings)"
},
{
"code": null,
"e": 26147,
"s": 26081,
"text": "Return : It returns the text of the button that the user selected"
},
{
"code": null,
"e": 26316,
"s": 26147,
"text": "Example :In this we will create a button box windows having a three buttons which user can select and selected button text will get printed, below is the implementation"
},
{
"code": "# importing easygui modulefrom easygui import * # message to be displayed text = \"Message to be displayed on the window GfG\" # window titletitle = \"Window Title GfG\" # button listbutton_list = [] # button 1button1 = \"First\" # second buttonbutton2 = \"Second\" # third buttonbutton3 = \"Third\" # appending button to the button listbutton_list.append(button1)button_list.append(button2)button_list.append(button3) # creating a button boxoutput = buttonbox(text, title, button_list) # printing the button pressed by the userprint(\"User selected option : \", end = \" \")print(output)",
"e": 26902,
"s": 26316,
"text": null
},
{
"code": null,
"e": 26911,
"s": 26902,
"text": "Output :"
},
{
"code": null,
"e": 26943,
"s": 26911,
"text": "User selected option : Second\n"
},
{
"code": null,
"e": 26961,
"s": 26943,
"text": "Another example :"
},
{
"code": "# importing easygui modulefrom easygui import * # message to be displayed text = \"Message to be displayed on the window GfG\" # window titletitle = \"Window Title GfG\" # creating a button boxoutput = buttonbox(text, title) # printing the button pressed by the userprint(\"User selected option : \", end = \" \")print(output)",
"e": 27284,
"s": 26961,
"text": null
},
{
"code": null,
"e": 27293,
"s": 27284,
"text": "Output :"
},
{
"code": null,
"e": 27328,
"s": 27293,
"text": "User selected option : Button[3]\n"
},
{
"code": null,
"e": 27343,
"s": 27328,
"text": "Python-EasyGUI"
},
{
"code": null,
"e": 27354,
"s": 27343,
"text": "Python-gui"
},
{
"code": null,
"e": 27361,
"s": 27354,
"text": "Python"
},
{
"code": null,
"e": 27459,
"s": 27361,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 27491,
"s": 27459,
"text": "How to Install PIP on Windows ?"
},
{
"code": null,
"e": 27526,
"s": 27491,
"text": "Read a file line by line in Python"
},
{
"code": null,
"e": 27548,
"s": 27526,
"text": "Enumerate() in Python"
},
{
"code": null,
"e": 27590,
"s": 27548,
"text": "Different ways to create Pandas Dataframe"
},
{
"code": null,
"e": 27620,
"s": 27590,
"text": "Iterate over a list in Python"
},
{
"code": null,
"e": 27646,
"s": 27620,
"text": "Python String | replace()"
},
{
"code": null,
"e": 27690,
"s": 27646,
"text": "Reading and Writing to text files in Python"
},
{
"code": null,
"e": 27719,
"s": 27690,
"text": "*args and **kwargs in Python"
},
{
"code": null,
"e": 27755,
"s": 27719,
"text": "Convert integer to string in Python"
}
] |
Break the number into three parts - GeeksforGeeks | 06 May, 2021
Given a really large number, break it into 3 whole numbers such that they sum up to the original number and count number of ways to do so.
Examples :
Input : 3
Output : 10
The possible combinations where the sum
of the numbers is equal to 3 are:
0+0+3 = 3
0+3+0 = 3
3+0+0 = 3
0+1+2 = 3
0+2+1 = 3
1+0+2 = 3
1+2+0 = 3
2+0+1 = 3
2+1+0 = 3
1+1+1 = 3
Input : 6
Output : 28
A total of 10 ways, so answer is 10.
Naive Approach: Try all combinations from 0 to the given number and check if they add upto the given number or not, if they do, increase the count by 1 and continue the process.
C++
Java
Python3
C#
PHP
Javascript
// C++ program to count number of ways to break// a number in three parts.#include <bits/stdc++.h>#define ll long long intusing namespace std; // Function to count number of ways// to make the given number nll count_of_ways(ll n){ ll count = 0; for (int i = 0; i <= n; i++) for (int j = 0; j <= n; j++) for (int k = 0; k <= n; k++) if (i + j + k == n) count++; return count;} // Driver Functionint main(){ ll n = 3; cout << count_of_ways(n) << endl; return 0;}
// Java program to count number of ways to break// a number in three partsimport java.io.*; class GFG { // Function to count number of ways // to make the given number n static long count_of_ways(long n) { long count = 0; for (int i = 0; i <= n; i++) for (int j = 0; j <= n; j++) for (int k = 0; k <= n; k++) if (i + j + k == n) count++; return count; } // driver program public static void main(String[] args) { long n = 3; System.out.println(count_of_ways(n)); }} // Contributed by Pramod Kumar
# Python3 program to count number of# ways to break# a number in three parts. # Function to count number of ways# to make the given number ndef count_of_ways(n): count = 0 for i in range(0, n+1): for j in range(0, n+1): for k in range(0, n+1): if(i + j + k == n): count = count + 1 return count # Driver Functionif __name__=='__main__': n = 3 print(count_of_ways(n)) # This code is contributed by# Sanjit_Prasad
// C# program to count number of ways// to break a number in three partsusing System; class GFG { // Function to count number of ways // to make the given number n static long count_of_ways(long n) { long count = 0; for (int i = 0; i <= n; i++) for (int j = 0; j <= n; j++) for (int k = 0; k <= n; k++) if (i + j + k == n) count++; return count; } // driver program public static void Main() { long n = 3; Console.WriteLine(count_of_ways(n)); }} // This code is Contributed by vt_m.
<?php// PHP program to count number// of ways to break a number// in three parts. // Function to count number of ways// to make the given number nfunction count_of_ways( $n){ $count = 0; for ($i = 0; $i <= $n; $i++) for ($j = 0; $j <= $n; $j++) for ($k = 0; $k <= $n; $k++) if ($i + $j + $k == $n) $count++; return $count;} // Driver Code$n = 3;echo count_of_ways($n); // This code is Contributed by vt_m.?>
<script> // JavaScript program to count// number of ways to break// a number in three parts. // Function to count number of ways// to make the given number nfunction count_of_ways(n){ let count = 0; for(let i = 0; i <= n; i++) for(let j = 0; j <= n; j++) for(let k = 0; k <= n; k++) if (i + j + k == n) count++; return count;} // Driver codelet n = 3; document.write(count_of_ways(n) + "<br>"); // This code is contributed by Surbhi Tyagi. </script>
Output :
10
Time Complexity : O(n3)
Efficient Approach: If we carefully observe the test cases then we realize that the number of ways to break a number n into 3 parts is equal to (n+1) * (n+2) / 2.
C++
Java
Python3
C#
PHP
Javascript
// C++ program to count number of ways to break// a number in three parts.#include <bits/stdc++.h>#define ll long long intusing namespace std; // Function to count number of ways// to make the given number nll count_of_ways(ll n){ ll count; count = (n + 1) * (n + 2) / 2; return count;} // Driver Functionint main(){ ll n = 3; cout << count_of_ways(n) << endl; return 0;}
// Java program to count number of ways to break// a number in three partsimport java.io.*; class GFG { // Function to count number of ways // to make the given number n static long count_of_ways(long n) { long count = 0; count = (n + 1) * (n + 2) / 2; return count; } // driver program public static void main(String[] args) { long n = 3; System.out.println(count_of_ways(n)); }} // Contributed by Pramod Kumar
# Python 3 program to count number of# ways to break a number in three parts. # Function to count number of ways# to make the given number ndef count_of_ways(n): count = 0 count = (n + 1) * (n + 2) // 2 return count # Driver coden = 3print(count_of_ways(n)) # This code is contributed by Shrikant13
// C# program to count number of ways to// break a number in three partsusing System; class GFG { // Function to count number of ways // to make the given number n static long count_of_ways(long n) { long count = 0; count = (n + 1) * (n + 2) / 2; return count; } // driver program public static void Main() { long n = 3; Console.WriteLine(count_of_ways(n)); }} // This code is Contributed by vt_m.
<?php// PHP program to count number// of ways to break a number// in three parts. // Function to count number of ways// to make the given number nfunction count_of_ways( $n){ $count; $count = ($n + 1) * ($n + 2) / 2; return $count;} // Driver Code$n = 3;echo count_of_ways($n); // This code is Contributed by vt_m.?>
<script> // javascript program to count number of ways to// break a number in three parts // Function to count number of ways // to make the given number n function count_of_ways(n) { var count = 0; count = (n + 1) * (n + 2) / 2; return count; } // driver program var n = 3; document.write(count_of_ways(n)); // This code is contributed by bunnyram19.</script>
Output :
10
Time Complexity: O(1)
This article is contributed by Aditya Gupta. If you like GeeksforGeeks and would like to contribute, you can also write an article using write.geeksforgeeks.org or mail your article to [email protected]. See your article appearing on the GeeksforGeeks main page and help other Geeks.Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
vt_m
Sanjit_Prasad
shrikanth13
surbhityagi15
bunnyram19
number-theory
Mathematical
number-theory
Mathematical
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Merge two sorted arrays
Modulo Operator (%) in C/C++ with Examples
Prime Numbers
Program to find GCD or HCF of two numbers
Sieve of Eratosthenes
Print all possible combinations of r elements in a given array of size n
Operators in C / C++
Program for factorial of a number
Program for Decimal to Binary Conversion
Find minimum number of coins that make a given value | [
{
"code": null,
"e": 26627,
"s": 26599,
"text": "\n06 May, 2021"
},
{
"code": null,
"e": 26766,
"s": 26627,
"text": "Given a really large number, break it into 3 whole numbers such that they sum up to the original number and count number of ways to do so."
},
{
"code": null,
"e": 26778,
"s": 26766,
"text": "Examples : "
},
{
"code": null,
"e": 26997,
"s": 26778,
"text": "Input : 3\nOutput : 10\nThe possible combinations where the sum\nof the numbers is equal to 3 are:\n0+0+3 = 3\n0+3+0 = 3\n3+0+0 = 3\n0+1+2 = 3\n0+2+1 = 3\n1+0+2 = 3\n1+2+0 = 3\n2+0+1 = 3\n2+1+0 = 3\n1+1+1 = 3\n\nInput : 6\nOutput : 28"
},
{
"code": null,
"e": 27035,
"s": 26997,
"text": "A total of 10 ways, so answer is 10. "
},
{
"code": null,
"e": 27214,
"s": 27035,
"text": "Naive Approach: Try all combinations from 0 to the given number and check if they add upto the given number or not, if they do, increase the count by 1 and continue the process. "
},
{
"code": null,
"e": 27218,
"s": 27214,
"text": "C++"
},
{
"code": null,
"e": 27223,
"s": 27218,
"text": "Java"
},
{
"code": null,
"e": 27231,
"s": 27223,
"text": "Python3"
},
{
"code": null,
"e": 27234,
"s": 27231,
"text": "C#"
},
{
"code": null,
"e": 27238,
"s": 27234,
"text": "PHP"
},
{
"code": null,
"e": 27249,
"s": 27238,
"text": "Javascript"
},
{
"code": "// C++ program to count number of ways to break// a number in three parts.#include <bits/stdc++.h>#define ll long long intusing namespace std; // Function to count number of ways// to make the given number nll count_of_ways(ll n){ ll count = 0; for (int i = 0; i <= n; i++) for (int j = 0; j <= n; j++) for (int k = 0; k <= n; k++) if (i + j + k == n) count++; return count;} // Driver Functionint main(){ ll n = 3; cout << count_of_ways(n) << endl; return 0;}",
"e": 27780,
"s": 27249,
"text": null
},
{
"code": "// Java program to count number of ways to break// a number in three partsimport java.io.*; class GFG { // Function to count number of ways // to make the given number n static long count_of_ways(long n) { long count = 0; for (int i = 0; i <= n; i++) for (int j = 0; j <= n; j++) for (int k = 0; k <= n; k++) if (i + j + k == n) count++; return count; } // driver program public static void main(String[] args) { long n = 3; System.out.println(count_of_ways(n)); }} // Contributed by Pramod Kumar",
"e": 28408,
"s": 27780,
"text": null
},
{
"code": "# Python3 program to count number of# ways to break# a number in three parts. # Function to count number of ways# to make the given number ndef count_of_ways(n): count = 0 for i in range(0, n+1): for j in range(0, n+1): for k in range(0, n+1): if(i + j + k == n): count = count + 1 return count # Driver Functionif __name__=='__main__': n = 3 print(count_of_ways(n)) # This code is contributed by# Sanjit_Prasad",
"e": 28889,
"s": 28408,
"text": null
},
{
"code": "// C# program to count number of ways// to break a number in three partsusing System; class GFG { // Function to count number of ways // to make the given number n static long count_of_ways(long n) { long count = 0; for (int i = 0; i <= n; i++) for (int j = 0; j <= n; j++) for (int k = 0; k <= n; k++) if (i + j + k == n) count++; return count; } // driver program public static void Main() { long n = 3; Console.WriteLine(count_of_ways(n)); }} // This code is Contributed by vt_m.",
"e": 29508,
"s": 28889,
"text": null
},
{
"code": "<?php// PHP program to count number// of ways to break a number// in three parts. // Function to count number of ways// to make the given number nfunction count_of_ways( $n){ $count = 0; for ($i = 0; $i <= $n; $i++) for ($j = 0; $j <= $n; $j++) for ($k = 0; $k <= $n; $k++) if ($i + $j + $k == $n) $count++; return $count;} // Driver Code$n = 3;echo count_of_ways($n); // This code is Contributed by vt_m.?>",
"e": 29977,
"s": 29508,
"text": null
},
{
"code": "<script> // JavaScript program to count// number of ways to break// a number in three parts. // Function to count number of ways// to make the given number nfunction count_of_ways(n){ let count = 0; for(let i = 0; i <= n; i++) for(let j = 0; j <= n; j++) for(let k = 0; k <= n; k++) if (i + j + k == n) count++; return count;} // Driver codelet n = 3; document.write(count_of_ways(n) + \"<br>\"); // This code is contributed by Surbhi Tyagi. </script>",
"e": 30509,
"s": 29977,
"text": null
},
{
"code": null,
"e": 30519,
"s": 30509,
"text": "Output : "
},
{
"code": null,
"e": 30522,
"s": 30519,
"text": "10"
},
{
"code": null,
"e": 30547,
"s": 30522,
"text": "Time Complexity : O(n3) "
},
{
"code": null,
"e": 30711,
"s": 30547,
"text": "Efficient Approach: If we carefully observe the test cases then we realize that the number of ways to break a number n into 3 parts is equal to (n+1) * (n+2) / 2. "
},
{
"code": null,
"e": 30715,
"s": 30711,
"text": "C++"
},
{
"code": null,
"e": 30720,
"s": 30715,
"text": "Java"
},
{
"code": null,
"e": 30728,
"s": 30720,
"text": "Python3"
},
{
"code": null,
"e": 30731,
"s": 30728,
"text": "C#"
},
{
"code": null,
"e": 30735,
"s": 30731,
"text": "PHP"
},
{
"code": null,
"e": 30746,
"s": 30735,
"text": "Javascript"
},
{
"code": "// C++ program to count number of ways to break// a number in three parts.#include <bits/stdc++.h>#define ll long long intusing namespace std; // Function to count number of ways// to make the given number nll count_of_ways(ll n){ ll count; count = (n + 1) * (n + 2) / 2; return count;} // Driver Functionint main(){ ll n = 3; cout << count_of_ways(n) << endl; return 0;}",
"e": 31136,
"s": 30746,
"text": null
},
{
"code": "// Java program to count number of ways to break// a number in three partsimport java.io.*; class GFG { // Function to count number of ways // to make the given number n static long count_of_ways(long n) { long count = 0; count = (n + 1) * (n + 2) / 2; return count; } // driver program public static void main(String[] args) { long n = 3; System.out.println(count_of_ways(n)); }} // Contributed by Pramod Kumar",
"e": 31611,
"s": 31136,
"text": null
},
{
"code": "# Python 3 program to count number of# ways to break a number in three parts. # Function to count number of ways# to make the given number ndef count_of_ways(n): count = 0 count = (n + 1) * (n + 2) // 2 return count # Driver coden = 3print(count_of_ways(n)) # This code is contributed by Shrikant13",
"e": 31919,
"s": 31611,
"text": null
},
{
"code": "// C# program to count number of ways to// break a number in three partsusing System; class GFG { // Function to count number of ways // to make the given number n static long count_of_ways(long n) { long count = 0; count = (n + 1) * (n + 2) / 2; return count; } // driver program public static void Main() { long n = 3; Console.WriteLine(count_of_ways(n)); }} // This code is Contributed by vt_m.",
"e": 32385,
"s": 31919,
"text": null
},
{
"code": "<?php// PHP program to count number// of ways to break a number// in three parts. // Function to count number of ways// to make the given number nfunction count_of_ways( $n){ $count; $count = ($n + 1) * ($n + 2) / 2; return $count;} // Driver Code$n = 3;echo count_of_ways($n); // This code is Contributed by vt_m.?>",
"e": 32711,
"s": 32385,
"text": null
},
{
"code": "<script> // javascript program to count number of ways to// break a number in three parts // Function to count number of ways // to make the given number n function count_of_ways(n) { var count = 0; count = (n + 1) * (n + 2) / 2; return count; } // driver program var n = 3; document.write(count_of_ways(n)); // This code is contributed by bunnyram19.</script>",
"e": 33140,
"s": 32711,
"text": null
},
{
"code": null,
"e": 33150,
"s": 33140,
"text": "Output : "
},
{
"code": null,
"e": 33153,
"s": 33150,
"text": "10"
},
{
"code": null,
"e": 33175,
"s": 33153,
"text": "Time Complexity: O(1)"
},
{
"code": null,
"e": 33597,
"s": 33175,
"text": " This article is contributed by Aditya Gupta. If you like GeeksforGeeks and would like to contribute, you can also write an article using write.geeksforgeeks.org or mail your article to [email protected]. See your article appearing on the GeeksforGeeks main page and help other Geeks.Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above. "
},
{
"code": null,
"e": 33602,
"s": 33597,
"text": "vt_m"
},
{
"code": null,
"e": 33616,
"s": 33602,
"text": "Sanjit_Prasad"
},
{
"code": null,
"e": 33628,
"s": 33616,
"text": "shrikanth13"
},
{
"code": null,
"e": 33642,
"s": 33628,
"text": "surbhityagi15"
},
{
"code": null,
"e": 33653,
"s": 33642,
"text": "bunnyram19"
},
{
"code": null,
"e": 33667,
"s": 33653,
"text": "number-theory"
},
{
"code": null,
"e": 33680,
"s": 33667,
"text": "Mathematical"
},
{
"code": null,
"e": 33694,
"s": 33680,
"text": "number-theory"
},
{
"code": null,
"e": 33707,
"s": 33694,
"text": "Mathematical"
},
{
"code": null,
"e": 33805,
"s": 33707,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 33829,
"s": 33805,
"text": "Merge two sorted arrays"
},
{
"code": null,
"e": 33872,
"s": 33829,
"text": "Modulo Operator (%) in C/C++ with Examples"
},
{
"code": null,
"e": 33886,
"s": 33872,
"text": "Prime Numbers"
},
{
"code": null,
"e": 33928,
"s": 33886,
"text": "Program to find GCD or HCF of two numbers"
},
{
"code": null,
"e": 33950,
"s": 33928,
"text": "Sieve of Eratosthenes"
},
{
"code": null,
"e": 34023,
"s": 33950,
"text": "Print all possible combinations of r elements in a given array of size n"
},
{
"code": null,
"e": 34044,
"s": 34023,
"text": "Operators in C / C++"
},
{
"code": null,
"e": 34078,
"s": 34044,
"text": "Program for factorial of a number"
},
{
"code": null,
"e": 34119,
"s": 34078,
"text": "Program for Decimal to Binary Conversion"
}
] |
How to shuffle an array using JavaScript ? - GeeksforGeeks | 16 Jul, 2021
Shuffling an array or a list means that we randomly re-arranging the content of that structure. To shuffle an array we will use the following algorithms:
Algorithm 1:
javascript
function shuffleArray(array) { for (var i = array.length - 1; i > 0; i--) { // Generate random number var j = Math.floor(Math.random() * (i + 1)); var temp = array[i]; array[i] = array[j]; array[j] = temp; } return array;}
Example:
html
<!DOCTYPE html><html> <head> <title>Shuffle array</title></head> <body> <p>Array is=[1, 2, 3, 4, 5, 6, 7]</p> <button onclick="show()"> click </button> <script> // Function to shuffle the array content function shuffleArray(array) { for (var i = array.length - 1; i > 0; i--) { // Generate random number var j = Math.floor(Math.random() * (i + 1)); var temp = array[i]; array[i] = array[j]; array[j] = temp; } return array; } // Function to show the result function show() { var arr = [1, 2, 3, 4, 5, 6, 7] var arr1 = shuffleArray(arr) document.write("After shuffling: ", arr1) } </script></body> </html>
Output:
Before Clicking the Button:
After Clicking the button:
Algorithm 2:
Passing a function that returns (random value – 0.5 ) as comparator to sort function, so as to sort elements on random basis.
Javascript
function shuffleArray(array) { return array.sort( ()=>Math.random()-0.5 ); }
Example:
HTML
<!DOCTYPE html><html> <head> <title>Shuffle array</title></head> <body> <p>Array is=[1, 2, 3, 4, 5, 6, 7]</p> <button onclick="show()"> click </button> <script> // Function to shuffle the array content function shuffleArray(array) { return array.sort( ()=>Math.random()-0.5 ); } // Function to show the result function show() { var arr = [1, 2, 3, 4, 5, 6, 7] var arr1 = shuffleArray(arr) document.write("After shuffling: ", arr1) } </script></body> </html>
Output:
Before Clicking the Button:
After Clicking the button:
omkarphansopkar
anikakapoor
JavaScript-Questions
Picked
HTML
JavaScript
Web Technologies
Web technologies Questions
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to update Node.js and NPM to next version ?
REST API (Introduction)
How to Insert Form Data into Database using PHP ?
CSS to put icon inside an input element in a form
Types of CSS (Cascading Style Sheet)
Remove elements from a JavaScript Array
Convert a string to an integer in JavaScript
Difference between var, let and const keywords in JavaScript
Differences between Functional Components and Class Components in React
How to calculate the number of days between two dates in javascript? | [
{
"code": null,
"e": 25687,
"s": 25659,
"text": "\n16 Jul, 2021"
},
{
"code": null,
"e": 25841,
"s": 25687,
"text": "Shuffling an array or a list means that we randomly re-arranging the content of that structure. To shuffle an array we will use the following algorithms:"
},
{
"code": null,
"e": 25855,
"s": 25841,
"text": "Algorithm 1: "
},
{
"code": null,
"e": 25866,
"s": 25855,
"text": "javascript"
},
{
"code": "function shuffleArray(array) { for (var i = array.length - 1; i > 0; i--) { // Generate random number var j = Math.floor(Math.random() * (i + 1)); var temp = array[i]; array[i] = array[j]; array[j] = temp; } return array;}",
"e": 26154,
"s": 25866,
"text": null
},
{
"code": null,
"e": 26164,
"s": 26154,
"text": "Example: "
},
{
"code": null,
"e": 26169,
"s": 26164,
"text": "html"
},
{
"code": "<!DOCTYPE html><html> <head> <title>Shuffle array</title></head> <body> <p>Array is=[1, 2, 3, 4, 5, 6, 7]</p> <button onclick=\"show()\"> click </button> <script> // Function to shuffle the array content function shuffleArray(array) { for (var i = array.length - 1; i > 0; i--) { // Generate random number var j = Math.floor(Math.random() * (i + 1)); var temp = array[i]; array[i] = array[j]; array[j] = temp; } return array; } // Function to show the result function show() { var arr = [1, 2, 3, 4, 5, 6, 7] var arr1 = shuffleArray(arr) document.write(\"After shuffling: \", arr1) } </script></body> </html>",
"e": 27002,
"s": 26169,
"text": null
},
{
"code": null,
"e": 27012,
"s": 27002,
"text": "Output: "
},
{
"code": null,
"e": 27042,
"s": 27012,
"text": "Before Clicking the Button: "
},
{
"code": null,
"e": 27071,
"s": 27042,
"text": "After Clicking the button: "
},
{
"code": null,
"e": 27084,
"s": 27071,
"text": "Algorithm 2:"
},
{
"code": null,
"e": 27211,
"s": 27084,
"text": "Passing a function that returns (random value – 0.5 ) as comparator to sort function, so as to sort elements on random basis. "
},
{
"code": null,
"e": 27222,
"s": 27211,
"text": "Javascript"
},
{
"code": "function shuffleArray(array) { return array.sort( ()=>Math.random()-0.5 ); }",
"e": 27302,
"s": 27222,
"text": null
},
{
"code": null,
"e": 27312,
"s": 27302,
"text": "Example: "
},
{
"code": null,
"e": 27317,
"s": 27312,
"text": "HTML"
},
{
"code": "<!DOCTYPE html><html> <head> <title>Shuffle array</title></head> <body> <p>Array is=[1, 2, 3, 4, 5, 6, 7]</p> <button onclick=\"show()\"> click </button> <script> // Function to shuffle the array content function shuffleArray(array) { return array.sort( ()=>Math.random()-0.5 ); } // Function to show the result function show() { var arr = [1, 2, 3, 4, 5, 6, 7] var arr1 = shuffleArray(arr) document.write(\"After shuffling: \", arr1) } </script></body> </html>",
"e": 27903,
"s": 27317,
"text": null
},
{
"code": null,
"e": 27914,
"s": 27903,
"text": " Output: "
},
{
"code": null,
"e": 27943,
"s": 27914,
"text": "Before Clicking the Button: "
},
{
"code": null,
"e": 27971,
"s": 27943,
"text": "After Clicking the button: "
},
{
"code": null,
"e": 27989,
"s": 27973,
"text": "omkarphansopkar"
},
{
"code": null,
"e": 28001,
"s": 27989,
"text": "anikakapoor"
},
{
"code": null,
"e": 28022,
"s": 28001,
"text": "JavaScript-Questions"
},
{
"code": null,
"e": 28029,
"s": 28022,
"text": "Picked"
},
{
"code": null,
"e": 28034,
"s": 28029,
"text": "HTML"
},
{
"code": null,
"e": 28045,
"s": 28034,
"text": "JavaScript"
},
{
"code": null,
"e": 28062,
"s": 28045,
"text": "Web Technologies"
},
{
"code": null,
"e": 28089,
"s": 28062,
"text": "Web technologies Questions"
},
{
"code": null,
"e": 28094,
"s": 28089,
"text": "HTML"
},
{
"code": null,
"e": 28192,
"s": 28094,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 28240,
"s": 28192,
"text": "How to update Node.js and NPM to next version ?"
},
{
"code": null,
"e": 28264,
"s": 28240,
"text": "REST API (Introduction)"
},
{
"code": null,
"e": 28314,
"s": 28264,
"text": "How to Insert Form Data into Database using PHP ?"
},
{
"code": null,
"e": 28364,
"s": 28314,
"text": "CSS to put icon inside an input element in a form"
},
{
"code": null,
"e": 28401,
"s": 28364,
"text": "Types of CSS (Cascading Style Sheet)"
},
{
"code": null,
"e": 28441,
"s": 28401,
"text": "Remove elements from a JavaScript Array"
},
{
"code": null,
"e": 28486,
"s": 28441,
"text": "Convert a string to an integer in JavaScript"
},
{
"code": null,
"e": 28547,
"s": 28486,
"text": "Difference between var, let and const keywords in JavaScript"
},
{
"code": null,
"e": 28619,
"s": 28547,
"text": "Differences between Functional Components and Class Components in React"
}
] |
C# Program to Demonstrate the Array of Structures - GeeksforGeeks | 29 Oct, 2021
An array of structures means each array index contains structure as a value. In this article, we will create the array of structure and access structure members using an array with a specific index.
Syntax
array[index].Structure(Details);
where index specifies the particular position to be inserted and details are the values in the structure
Example:
Input:
Insert three values in an array
Student[] student = { new Student(), new Student(), new Student() };
student[0].SetStudent(1, "ojaswi", 20);
student[1].SetStudent(2, "rohith", 21);
student[2].SetStudent(3, "rohith", 21);
Output:
(1, "ojaswi", 20)
(2, "rohith", 21)
(3, "rohith", 21)
Approach:
Declare three variables id , name and age.Set the details in the SetStudent() method.Create array of structure for three students.Pass the structure to array index for three students separately.Display the students by calling DisplayStudent() method
Declare three variables id , name and age.
Set the details in the SetStudent() method.
Create array of structure for three students.
Pass the structure to array index for three students separately.
Display the students by calling DisplayStudent() method
Example:
C#
// C# program to display the array of structureusing System; public struct Employee{ // Declare three variables // id, name and age public int Id; public string Name; public int Age; // Set the employee details public void SetEmployee(int id, string name, int age) { Id = id; Name = name; Age = age; } // Display employee details public void DisplayEmployee() { Console.WriteLine("Employee:"); Console.WriteLine("\tId : " + Id); Console.WriteLine("\tName : " + Name); Console.WriteLine("\tAge : " + Age); Console.WriteLine("\n"); }} class GFG{ // Driver codestatic void Main(string[] args){ // Create array of structure Employee[] emp = { new Employee(), new Employee(), new Employee() }; // Pass the array indexes with values as structures emp[0].SetEmployee(1, "Ojaswi", 20); emp[1].SetEmployee(2, "Rohit", 21); emp[2].SetEmployee(3, "Mohit", 23); // Call the display method emp[0].DisplayEmployee(); emp[1].DisplayEmployee(); emp[2].DisplayEmployee();}}
Output:
Employee:
Id : 1
Name : Ojaswi
Age : 20
Employee:
Id : 2
Name : Rohit
Age : 21
Employee:
Id : 3
Name : Mohit
Age : 23
surindertarika1234
CSharp-Arrays
CSharp-programs
Picked
C#
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Extension Method in C#
HashSet in C# with Examples
C# | Inheritance
Partial Classes in C#
C# | Generics - Introduction
Top 50 C# Interview Questions & Answers
Switch Statement in C#
Convert String to Character Array in C#
C# | How to insert an element in an Array?
Linked List Implementation in C# | [
{
"code": null,
"e": 25547,
"s": 25519,
"text": "\n29 Oct, 2021"
},
{
"code": null,
"e": 25746,
"s": 25547,
"text": "An array of structures means each array index contains structure as a value. In this article, we will create the array of structure and access structure members using an array with a specific index."
},
{
"code": null,
"e": 25753,
"s": 25746,
"text": "Syntax"
},
{
"code": null,
"e": 25786,
"s": 25753,
"text": "array[index].Structure(Details);"
},
{
"code": null,
"e": 25891,
"s": 25786,
"text": "where index specifies the particular position to be inserted and details are the values in the structure"
},
{
"code": null,
"e": 25900,
"s": 25891,
"text": "Example:"
},
{
"code": null,
"e": 26191,
"s": 25900,
"text": "Input:\nInsert three values in an array\nStudent[] student = { new Student(), new Student(), new Student() };\nstudent[0].SetStudent(1, \"ojaswi\", 20);\nstudent[1].SetStudent(2, \"rohith\", 21);\nstudent[2].SetStudent(3, \"rohith\", 21);\n\nOutput:\n(1, \"ojaswi\", 20)\n(2, \"rohith\", 21)\n(3, \"rohith\", 21)"
},
{
"code": null,
"e": 26201,
"s": 26191,
"text": "Approach:"
},
{
"code": null,
"e": 26451,
"s": 26201,
"text": "Declare three variables id , name and age.Set the details in the SetStudent() method.Create array of structure for three students.Pass the structure to array index for three students separately.Display the students by calling DisplayStudent() method"
},
{
"code": null,
"e": 26494,
"s": 26451,
"text": "Declare three variables id , name and age."
},
{
"code": null,
"e": 26538,
"s": 26494,
"text": "Set the details in the SetStudent() method."
},
{
"code": null,
"e": 26584,
"s": 26538,
"text": "Create array of structure for three students."
},
{
"code": null,
"e": 26649,
"s": 26584,
"text": "Pass the structure to array index for three students separately."
},
{
"code": null,
"e": 26705,
"s": 26649,
"text": "Display the students by calling DisplayStudent() method"
},
{
"code": null,
"e": 26714,
"s": 26705,
"text": "Example:"
},
{
"code": null,
"e": 26717,
"s": 26714,
"text": "C#"
},
{
"code": "// C# program to display the array of structureusing System; public struct Employee{ // Declare three variables // id, name and age public int Id; public string Name; public int Age; // Set the employee details public void SetEmployee(int id, string name, int age) { Id = id; Name = name; Age = age; } // Display employee details public void DisplayEmployee() { Console.WriteLine(\"Employee:\"); Console.WriteLine(\"\\tId : \" + Id); Console.WriteLine(\"\\tName : \" + Name); Console.WriteLine(\"\\tAge : \" + Age); Console.WriteLine(\"\\n\"); }} class GFG{ // Driver codestatic void Main(string[] args){ // Create array of structure Employee[] emp = { new Employee(), new Employee(), new Employee() }; // Pass the array indexes with values as structures emp[0].SetEmployee(1, \"Ojaswi\", 20); emp[1].SetEmployee(2, \"Rohit\", 21); emp[2].SetEmployee(3, \"Mohit\", 23); // Call the display method emp[0].DisplayEmployee(); emp[1].DisplayEmployee(); emp[2].DisplayEmployee();}}",
"e": 27876,
"s": 26717,
"text": null
},
{
"code": null,
"e": 27884,
"s": 27876,
"text": "Output:"
},
{
"code": null,
"e": 28063,
"s": 27884,
"text": "Employee:\n Id : 1\n Name : Ojaswi\n Age : 20\n\n\nEmployee:\n Id : 2\n Name : Rohit\n Age : 21\n\n\nEmployee:\n Id : 3\n Name : Mohit\n Age : 23"
},
{
"code": null,
"e": 28082,
"s": 28063,
"text": "surindertarika1234"
},
{
"code": null,
"e": 28096,
"s": 28082,
"text": "CSharp-Arrays"
},
{
"code": null,
"e": 28112,
"s": 28096,
"text": "CSharp-programs"
},
{
"code": null,
"e": 28119,
"s": 28112,
"text": "Picked"
},
{
"code": null,
"e": 28122,
"s": 28119,
"text": "C#"
},
{
"code": null,
"e": 28220,
"s": 28122,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 28243,
"s": 28220,
"text": "Extension Method in C#"
},
{
"code": null,
"e": 28271,
"s": 28243,
"text": "HashSet in C# with Examples"
},
{
"code": null,
"e": 28288,
"s": 28271,
"text": "C# | Inheritance"
},
{
"code": null,
"e": 28310,
"s": 28288,
"text": "Partial Classes in C#"
},
{
"code": null,
"e": 28339,
"s": 28310,
"text": "C# | Generics - Introduction"
},
{
"code": null,
"e": 28379,
"s": 28339,
"text": "Top 50 C# Interview Questions & Answers"
},
{
"code": null,
"e": 28402,
"s": 28379,
"text": "Switch Statement in C#"
},
{
"code": null,
"e": 28442,
"s": 28402,
"text": "Convert String to Character Array in C#"
},
{
"code": null,
"e": 28485,
"s": 28442,
"text": "C# | How to insert an element in an Array?"
}
] |
Set toArray() method in Java with Example - GeeksforGeeks | 24 Aug, 2021
The toArray() method of Java Set is used to form an array of the same elements as that of the Set. Basically, it copies all the element from a Set to a new array.Syntax:
Object[] toArray()
Parameters: The method takes optional parameter. If we provide the type of Object array we want we can pass it as an argument. for ex: set.toArray(new Integer[0]) returns an array of type Integer, we can also do it as set.toArray(new Integer[size]) where size is the size of the resultant array. Doing it in the former way works as the required size is allocated internally. Return Value: The method returns an array containing the elements similar to the Set.Below programs illustrate the Set.toArray() method:Program 1:
Java
// Java code to illustrate toArray() import java.util.*; public class SetDemo { public static void main(String args[]) { // Creating an empty Set Set<String> abs_col = new HashSet<String>(); // Use add() method to add // elements into the Set abs_col.add("Welcome"); abs_col.add("To"); abs_col.add("Geeks"); abs_col.add("For"); abs_col.add("Geeks"); // Displaying the Set System.out.println("The Set: " + abs_col); // Creating the array and using toArray() Object[] arr = abs_col.toArray(); System.out.println("The array is:"); for (int j = 0; j < arr.length; j++) System.out.println(arr[j]); }}
The Set: [Geeks, For, Welcome, To]
The array is:
Geeks
For
Welcome
To
Program 2:
Java
// Java code to illustrate toArray() import java.util.*; public class SetDemo { public static void main(String args[]) { // Creating an empty Set Set<Integer> abs_col = new HashSet<Integer>(); // Use add() method to add // elements into the Set abs_col.add(10); abs_col.add(15); abs_col.add(30); abs_col.add(20); abs_col.add(5); abs_col.add(25); // Displaying the Set System.out.println("The Set: " + abs_col); // Creating the array and using toArray() Integer[] arr = abs_col.toArray(new Integer[0]); System.out.println("The array is:"); for (int j = 0; j < arr.length; j++) System.out.println(arr[j]); }}
The Set: [20, 5, 25, 10, 30, 15]
The array is:
20
5
25
10
30
15
Reference: https://docs.oracle.com/javase/7/docs/api/java/util/Set.html#toArray()
shubho2001g
Java-Collections
Java-Functions
java-set
Java
Java
Java-Collections
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Interfaces in Java
Stream In Java
ArrayList in Java
Initialize an ArrayList in Java
Stack Class in Java
Multidimensional Arrays in Java
Singleton Class in Java
Multithreading in Java
Collections in Java
Queue Interface In Java | [
{
"code": null,
"e": 25575,
"s": 25547,
"text": "\n24 Aug, 2021"
},
{
"code": null,
"e": 25747,
"s": 25575,
"text": "The toArray() method of Java Set is used to form an array of the same elements as that of the Set. Basically, it copies all the element from a Set to a new array.Syntax: "
},
{
"code": null,
"e": 25766,
"s": 25747,
"text": "Object[] toArray()"
},
{
"code": null,
"e": 26289,
"s": 25766,
"text": "Parameters: The method takes optional parameter. If we provide the type of Object array we want we can pass it as an argument. for ex: set.toArray(new Integer[0]) returns an array of type Integer, we can also do it as set.toArray(new Integer[size]) where size is the size of the resultant array. Doing it in the former way works as the required size is allocated internally. Return Value: The method returns an array containing the elements similar to the Set.Below programs illustrate the Set.toArray() method:Program 1: "
},
{
"code": null,
"e": 26294,
"s": 26289,
"text": "Java"
},
{
"code": "// Java code to illustrate toArray() import java.util.*; public class SetDemo { public static void main(String args[]) { // Creating an empty Set Set<String> abs_col = new HashSet<String>(); // Use add() method to add // elements into the Set abs_col.add(\"Welcome\"); abs_col.add(\"To\"); abs_col.add(\"Geeks\"); abs_col.add(\"For\"); abs_col.add(\"Geeks\"); // Displaying the Set System.out.println(\"The Set: \" + abs_col); // Creating the array and using toArray() Object[] arr = abs_col.toArray(); System.out.println(\"The array is:\"); for (int j = 0; j < arr.length; j++) System.out.println(arr[j]); }}",
"e": 27045,
"s": 26294,
"text": null
},
{
"code": null,
"e": 27115,
"s": 27045,
"text": "The Set: [Geeks, For, Welcome, To]\nThe array is:\nGeeks\nFor\nWelcome\nTo"
},
{
"code": null,
"e": 27129,
"s": 27117,
"text": "Program 2: "
},
{
"code": null,
"e": 27134,
"s": 27129,
"text": "Java"
},
{
"code": "// Java code to illustrate toArray() import java.util.*; public class SetDemo { public static void main(String args[]) { // Creating an empty Set Set<Integer> abs_col = new HashSet<Integer>(); // Use add() method to add // elements into the Set abs_col.add(10); abs_col.add(15); abs_col.add(30); abs_col.add(20); abs_col.add(5); abs_col.add(25); // Displaying the Set System.out.println(\"The Set: \" + abs_col); // Creating the array and using toArray() Integer[] arr = abs_col.toArray(new Integer[0]); System.out.println(\"The array is:\"); for (int j = 0; j < arr.length; j++) System.out.println(arr[j]); }}",
"e": 27877,
"s": 27134,
"text": null
},
{
"code": null,
"e": 27941,
"s": 27877,
"text": "The Set: [20, 5, 25, 10, 30, 15]\nThe array is:\n20\n5\n25\n10\n30\n15"
},
{
"code": null,
"e": 28026,
"s": 27943,
"text": "Reference: https://docs.oracle.com/javase/7/docs/api/java/util/Set.html#toArray() "
},
{
"code": null,
"e": 28038,
"s": 28026,
"text": "shubho2001g"
},
{
"code": null,
"e": 28055,
"s": 28038,
"text": "Java-Collections"
},
{
"code": null,
"e": 28070,
"s": 28055,
"text": "Java-Functions"
},
{
"code": null,
"e": 28079,
"s": 28070,
"text": "java-set"
},
{
"code": null,
"e": 28084,
"s": 28079,
"text": "Java"
},
{
"code": null,
"e": 28089,
"s": 28084,
"text": "Java"
},
{
"code": null,
"e": 28106,
"s": 28089,
"text": "Java-Collections"
},
{
"code": null,
"e": 28204,
"s": 28106,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 28223,
"s": 28204,
"text": "Interfaces in Java"
},
{
"code": null,
"e": 28238,
"s": 28223,
"text": "Stream In Java"
},
{
"code": null,
"e": 28256,
"s": 28238,
"text": "ArrayList in Java"
},
{
"code": null,
"e": 28288,
"s": 28256,
"text": "Initialize an ArrayList in Java"
},
{
"code": null,
"e": 28308,
"s": 28288,
"text": "Stack Class in Java"
},
{
"code": null,
"e": 28340,
"s": 28308,
"text": "Multidimensional Arrays in Java"
},
{
"code": null,
"e": 28364,
"s": 28340,
"text": "Singleton Class in Java"
},
{
"code": null,
"e": 28387,
"s": 28364,
"text": "Multithreading in Java"
},
{
"code": null,
"e": 28407,
"s": 28387,
"text": "Collections in Java"
}
] |
For loop in Julia - GeeksforGeeks | 19 Feb, 2020
For loops are used to iterate over a set of values and perform a set of operations that are given in the body of the loop. For loops are used for sequential traversal. In Julia, there is no C style for loop, i.e., for (i = 0; i < n; i++). There is a "for in" loop which is similar to for each loop in other languages. Let us learn how to use for in loop for sequential traversals.
Syntax:
for iterator in range
statements(s)
end
Here, ‘for‘ is the keyword stating for loop, ‘in‘ keyword is used to define a range in which to iterate, ‘end‘ keyword is used to denote the end of for loop.
Example:
# Julia program to illustrate # the use of For loop print("List Iteration\n") l = ["geeks", "for", "geeks"] for i in l println(i) end # Iterating over a tuple (immutable) print("\nTuple Iteration\n") t = ("geeks", "for", "geeks") for i in t println(i) end # Iterating over a String print("\nString Iteration\n") s = "Geeks"for i in s println(i) end
Output: Nested for-loop: Julia programming language allows to use one loop inside another loop. The following section shows an example to illustrate the concept.Syntax:
for iterator in range
for iterator in range
statements(s)
statements(s)
end
end
Example:
# Julia program to illustrate # the use of Nested For-Loops # Outer For-loopfor i in 1:5 # Inner For-loop for j in 1:i # Print statement print(i, " ") end println() end
Output:
Julia-loops
Julia
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Vectors in Julia
Getting rounded value of a number in Julia - round() Method
Decision Making in Julia (if, if-else, Nested-if, if-elseif-else ladder)
Storing Output on a File in Julia
Manipulating matrices in Julia
Creating array with repeated elements in Julia - repeat() Method
Reshaping array dimensions in Julia | Array reshape() Method
while loop in Julia
Taking Input from Users in Julia
Get array dimensions and size of a dimension in Julia - size() Method | [
{
"code": null,
"e": 25425,
"s": 25397,
"text": "\n19 Feb, 2020"
},
{
"code": null,
"e": 25810,
"s": 25425,
"text": "For loops are used to iterate over a set of values and perform a set of operations that are given in the body of the loop. For loops are used for sequential traversal. In Julia, there is no C style for loop, i.e., for (i = 0; i < n; i++). There is a \"for in\" loop which is similar to for each loop in other languages. Let us learn how to use for in loop for sequential traversals.\n \n "
},
{
"code": null,
"e": 25818,
"s": 25810,
"text": "Syntax:"
},
{
"code": null,
"e": 25863,
"s": 25818,
"text": "for iterator in range\n statements(s)\nend\n"
},
{
"code": null,
"e": 26021,
"s": 25863,
"text": "Here, ‘for‘ is the keyword stating for loop, ‘in‘ keyword is used to define a range in which to iterate, ‘end‘ keyword is used to denote the end of for loop."
},
{
"code": null,
"e": 26030,
"s": 26021,
"text": "Example:"
},
{
"code": "# Julia program to illustrate # the use of For loop print(\"List Iteration\\n\") l = [\"geeks\", \"for\", \"geeks\"] for i in l println(i) end # Iterating over a tuple (immutable) print(\"\\nTuple Iteration\\n\") t = (\"geeks\", \"for\", \"geeks\") for i in t println(i) end # Iterating over a String print(\"\\nString Iteration\\n\") s = \"Geeks\"for i in s println(i) end",
"e": 26396,
"s": 26030,
"text": null
},
{
"code": null,
"e": 26565,
"s": 26396,
"text": "Output: Nested for-loop: Julia programming language allows to use one loop inside another loop. The following section shows an example to illustrate the concept.Syntax:"
},
{
"code": null,
"e": 26673,
"s": 26565,
"text": "for iterator in range\n for iterator in range \n statements(s) \n statements(s)\n end\nend\n "
},
{
"code": null,
"e": 26682,
"s": 26673,
"text": "Example:"
},
{
"code": "# Julia program to illustrate # the use of Nested For-Loops # Outer For-loopfor i in 1:5 # Inner For-loop for j in 1:i # Print statement print(i, \" \") end println() end",
"e": 26892,
"s": 26682,
"text": null
},
{
"code": null,
"e": 26900,
"s": 26892,
"text": "Output:"
},
{
"code": null,
"e": 26912,
"s": 26900,
"text": "Julia-loops"
},
{
"code": null,
"e": 26918,
"s": 26912,
"text": "Julia"
},
{
"code": null,
"e": 27016,
"s": 26918,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 27033,
"s": 27016,
"text": "Vectors in Julia"
},
{
"code": null,
"e": 27093,
"s": 27033,
"text": "Getting rounded value of a number in Julia - round() Method"
},
{
"code": null,
"e": 27166,
"s": 27093,
"text": "Decision Making in Julia (if, if-else, Nested-if, if-elseif-else ladder)"
},
{
"code": null,
"e": 27200,
"s": 27166,
"text": "Storing Output on a File in Julia"
},
{
"code": null,
"e": 27231,
"s": 27200,
"text": "Manipulating matrices in Julia"
},
{
"code": null,
"e": 27296,
"s": 27231,
"text": "Creating array with repeated elements in Julia - repeat() Method"
},
{
"code": null,
"e": 27357,
"s": 27296,
"text": "Reshaping array dimensions in Julia | Array reshape() Method"
},
{
"code": null,
"e": 27377,
"s": 27357,
"text": "while loop in Julia"
},
{
"code": null,
"e": 27410,
"s": 27377,
"text": "Taking Input from Users in Julia"
}
] |
Regularity condition in the master theorem. - GeeksforGeeks | 06 Oct, 2017
Master theorem is a direct way to get the solution of a recurrence relation, provided that it is of the following type:
T(n) = aT(n/b) + f(n) where a >= 1 and b > 1
The theorem consists of the following three cases:1.If f(n) = () where c < then T(n) = (n)
2.If f(n) = () where c = then T(n) = (Log n)
3.If f(n) = () where c > then T(n) = (f(n))
Imagine the recurrence aT(n/b) + f(n) in the form of a tree.Case 1 covers the case when the children nodes does more work than the parent node.For example the equation T(n)=2T(n/2)+1 falls under the category of case 1 and we can clearly see from it’s tree below that at each level the children nodes perform twice as much work as the parent node.
T(n) ------(1)
/ \
T(n/2) T(n/2) ------(2)
/ \ / \
Case 2 covers the case when the children node and the parent node does an equal amount of work.
For example the equation T(n)=2T(n/2)+n falls under the category of case 2 and we can clearly see from it’s tree below that at each level the children nodes perform as much work as the parent node.
T(n) ------(n)
/ \
T(n/2) T(n/2) ------(n)
/ \ / \
Case 3 covers the scenario that the parent node does more work than the children nodes.T(n)=T(n/2)+n is a example of case 3 where the parent performs more work than the child.
T(n) ------(n)
|
T(n/2) ------(n/2)
|
In case 1 and case 2 the case conditions themselves make sure that work done by children is either more or equal to the parent but that is not the case with case 3.In case 3 we apply a regulatory condition to make sure that the parent does at least as much as the children.
The regulatory condition for case 3 is
af(n/b)<=cf(n).
This says that f(n) (the amount of work done in the root) needs to be at least as big as the sum of the work done in the lower levels.
The equation T(n) = T(n/2) + n(sin(n – /2) + 2) is a example where regulatory condition makes a huge difference. The equation isn’t satisfying case 1 and case 2. In case 3 for large values of n it can never satisfy the regulatory condition. Hence this equation is beyond the scope of master theorem.
This article is contributed by Vineet Joshi. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to [email protected]. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
Analysis
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Types of Complexity Classes | P, NP, CoNP, NP hard and NP complete
Difference between Deterministic and Non-deterministic Algorithms
Complexity analysis of various operations of Binary Min Heap
Proof that Hamiltonian Cycle is NP-Complete
Pseudo-polynomial Algorithms
Applications of Hashing
3-coloring is NP Complete
Examples of Big-O analysis
Why does Dijkstra's Algorithm fail on negative weights?
Miscellaneous Problems of Time Complexity | [
{
"code": null,
"e": 26289,
"s": 26261,
"text": "\n06 Oct, 2017"
},
{
"code": null,
"e": 26409,
"s": 26289,
"text": "Master theorem is a direct way to get the solution of a recurrence relation, provided that it is of the following type:"
},
{
"code": null,
"e": 26455,
"s": 26409,
"text": "T(n) = aT(n/b) + f(n) where a >= 1 and b > 1\n"
},
{
"code": null,
"e": 26547,
"s": 26455,
"text": "The theorem consists of the following three cases:1.If f(n) = () where c < then T(n) = (n)"
},
{
"code": null,
"e": 26593,
"s": 26547,
"text": "2.If f(n) = () where c = then T(n) = (Log n)"
},
{
"code": null,
"e": 26638,
"s": 26593,
"text": "3.If f(n) = () where c > then T(n) = (f(n))"
},
{
"code": null,
"e": 26985,
"s": 26638,
"text": "Imagine the recurrence aT(n/b) + f(n) in the form of a tree.Case 1 covers the case when the children nodes does more work than the parent node.For example the equation T(n)=2T(n/2)+1 falls under the category of case 1 and we can clearly see from it’s tree below that at each level the children nodes perform twice as much work as the parent node."
},
{
"code": null,
"e": 27203,
"s": 26985,
"text": " T(n) ------(1)\n / \\\n T(n/2) T(n/2) ------(2)\n / \\ / \\ \n"
},
{
"code": null,
"e": 27299,
"s": 27203,
"text": "Case 2 covers the case when the children node and the parent node does an equal amount of work."
},
{
"code": null,
"e": 27497,
"s": 27299,
"text": "For example the equation T(n)=2T(n/2)+n falls under the category of case 2 and we can clearly see from it’s tree below that at each level the children nodes perform as much work as the parent node."
},
{
"code": null,
"e": 27715,
"s": 27497,
"text": " T(n) ------(n)\n / \\\n T(n/2) T(n/2) ------(n)\n / \\ / \\ \n"
},
{
"code": null,
"e": 27891,
"s": 27715,
"text": "Case 3 covers the scenario that the parent node does more work than the children nodes.T(n)=T(n/2)+n is a example of case 3 where the parent performs more work than the child."
},
{
"code": null,
"e": 28098,
"s": 27891,
"text": " T(n) ------(n)\n |\n T(n/2) ------(n/2)\n |\n"
},
{
"code": null,
"e": 28372,
"s": 28098,
"text": "In case 1 and case 2 the case conditions themselves make sure that work done by children is either more or equal to the parent but that is not the case with case 3.In case 3 we apply a regulatory condition to make sure that the parent does at least as much as the children."
},
{
"code": null,
"e": 28411,
"s": 28372,
"text": "The regulatory condition for case 3 is"
},
{
"code": null,
"e": 28427,
"s": 28411,
"text": "af(n/b)<=cf(n)."
},
{
"code": null,
"e": 28562,
"s": 28427,
"text": "This says that f(n) (the amount of work done in the root) needs to be at least as big as the sum of the work done in the lower levels."
},
{
"code": null,
"e": 28862,
"s": 28562,
"text": "The equation T(n) = T(n/2) + n(sin(n – /2) + 2) is a example where regulatory condition makes a huge difference. The equation isn’t satisfying case 1 and case 2. In case 3 for large values of n it can never satisfy the regulatory condition. Hence this equation is beyond the scope of master theorem."
},
{
"code": null,
"e": 29162,
"s": 28862,
"text": "This article is contributed by Vineet Joshi. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to [email protected]. See your article appearing on the GeeksforGeeks main page and help other Geeks."
},
{
"code": null,
"e": 29287,
"s": 29162,
"text": "Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above."
},
{
"code": null,
"e": 29296,
"s": 29287,
"text": "Analysis"
},
{
"code": null,
"e": 29394,
"s": 29296,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 29461,
"s": 29394,
"text": "Types of Complexity Classes | P, NP, CoNP, NP hard and NP complete"
},
{
"code": null,
"e": 29527,
"s": 29461,
"text": "Difference between Deterministic and Non-deterministic Algorithms"
},
{
"code": null,
"e": 29588,
"s": 29527,
"text": "Complexity analysis of various operations of Binary Min Heap"
},
{
"code": null,
"e": 29632,
"s": 29588,
"text": "Proof that Hamiltonian Cycle is NP-Complete"
},
{
"code": null,
"e": 29661,
"s": 29632,
"text": "Pseudo-polynomial Algorithms"
},
{
"code": null,
"e": 29685,
"s": 29661,
"text": "Applications of Hashing"
},
{
"code": null,
"e": 29711,
"s": 29685,
"text": "3-coloring is NP Complete"
},
{
"code": null,
"e": 29738,
"s": 29711,
"text": "Examples of Big-O analysis"
},
{
"code": null,
"e": 29794,
"s": 29738,
"text": "Why does Dijkstra's Algorithm fail on negative weights?"
}
] |
numpy.bincount() in Python - GeeksforGeeks | 17 Nov, 2020
In an array of +ve integers, the numpy.bincount() method counts the occurrence of each element. Each bin value is the occurrence of its index. One can also set the bin size accordingly.Syntax :
numpy.bincount(arr, weights = None, min_len = 0)
Parameters :
arr : [array_like, 1D]Input array, having positive numbers
weights : [array_like, optional]same shape as that of arr
min_len : Minimum number of bins we want in the output array
Return :
Output array with no. of occurrence of index value of bin in input - arr.
Output array, by default is of the length max element of arr + 1.
Here size of the output array would be max(input_arr)+1.
Code 1 : Working of bincount() in NumPy
# Python Program explaining # working of numpy.bincount() method import numpy as geek # 1D array with +ve integersarray1 = [1, 6, 1, 1, 1, 2, 2]bin = geek.bincount(array1)print("Bincount output : \n ", bin)print("size of bin : ", len(bin), "\n") array2 = [1, 5, 5, 5, 4, 5, 5, 2, 2, 2]bin = geek.bincount(array2)print("Bincount output : \n ", bin)print("size of bin : ", len(bin), "\n") # using min_length attributelength = 10bin1 = geek.bincount(array2, None, length)print("Bincount output : \n ", bin1) print("size of bin : ", len(bin1), "\n")
Output :
Bincount output :
[0 4 2 0 0 0 1]
size of bin : 7
Bincount output :
[0 1 3 0 1 5]
size of bin : 6
Bincount output :
[0 1 3 0 1 5 0 0 0 0]
size of bin : 10
Code 2 : We can perform addition as per element with bincount() weight
# Python Program explaining # working of numpy.bincount() method import numpy as geek # 1D array with +ve integersarray2 = [10, 11, 4, 6, 2, 1, 9]array1 = [1, 3, 1, 3, 1, 2, 2] # array2 : weightbin = geek.bincount(array1, array2)print("Summation element-wise : \n", bin) #index 0 : 0#index 1 : 10 + 4 + 2 = 16#index 2 : 1 + 9 = 10#index 3 : 11 + 6 = 17
Output :
Summation element-wise :
[ 0. 16. 10. 17.]
References :https://docs.scipy.org/doc/numpy/reference/generated/numpy.bincount.html#numpy.bincount.This article is contributed by Mohit Gupta_OMG . If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to [email protected]. See your article appearing on the GeeksforGeeks main page and help other Geeks.
CodeWithPriyansh
Python numpy-Statistics Functions
Python-numpy
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
How to drop one or multiple columns in Pandas Dataframe
Python Classes and Objects
Python | Get unique values from a list
Python | os.path.join() method
Create a directory in Python
Defaultdict in Python
Python | Pandas dataframe.groupby() | [
{
"code": null,
"e": 25537,
"s": 25509,
"text": "\n17 Nov, 2020"
},
{
"code": null,
"e": 25731,
"s": 25537,
"text": "In an array of +ve integers, the numpy.bincount() method counts the occurrence of each element. Each bin value is the occurrence of its index. One can also set the bin size accordingly.Syntax :"
},
{
"code": null,
"e": 25780,
"s": 25731,
"text": "numpy.bincount(arr, weights = None, min_len = 0)"
},
{
"code": null,
"e": 25793,
"s": 25780,
"text": "Parameters :"
},
{
"code": null,
"e": 25976,
"s": 25793,
"text": "arr : [array_like, 1D]Input array, having positive numbers\nweights : [array_like, optional]same shape as that of arr\nmin_len : Minimum number of bins we want in the output array\n"
},
{
"code": null,
"e": 25985,
"s": 25976,
"text": "Return :"
},
{
"code": null,
"e": 26185,
"s": 25985,
"text": "Output array with no. of occurrence of index value of bin in input - arr. \nOutput array, by default is of the length max element of arr + 1. \nHere size of the output array would be max(input_arr)+1.\n"
},
{
"code": null,
"e": 26225,
"s": 26185,
"text": "Code 1 : Working of bincount() in NumPy"
},
{
"code": "# Python Program explaining # working of numpy.bincount() method import numpy as geek # 1D array with +ve integersarray1 = [1, 6, 1, 1, 1, 2, 2]bin = geek.bincount(array1)print(\"Bincount output : \\n \", bin)print(\"size of bin : \", len(bin), \"\\n\") array2 = [1, 5, 5, 5, 4, 5, 5, 2, 2, 2]bin = geek.bincount(array2)print(\"Bincount output : \\n \", bin)print(\"size of bin : \", len(bin), \"\\n\") # using min_length attributelength = 10bin1 = geek.bincount(array2, None, length)print(\"Bincount output : \\n \", bin1) print(\"size of bin : \", len(bin1), \"\\n\")",
"e": 26779,
"s": 26225,
"text": null
},
{
"code": null,
"e": 26788,
"s": 26779,
"text": "Output :"
},
{
"code": null,
"e": 26965,
"s": 26788,
"text": "Bincount output : \n [0 4 2 0 0 0 1]\nsize of bin : 7 \n\nBincount output : \n [0 1 3 0 1 5]\nsize of bin : 6 \n\nBincount output : \n [0 1 3 0 1 5 0 0 0 0]\nsize of bin : 10 \n\n"
},
{
"code": null,
"e": 27036,
"s": 26965,
"text": "Code 2 : We can perform addition as per element with bincount() weight"
},
{
"code": "# Python Program explaining # working of numpy.bincount() method import numpy as geek # 1D array with +ve integersarray2 = [10, 11, 4, 6, 2, 1, 9]array1 = [1, 3, 1, 3, 1, 2, 2] # array2 : weightbin = geek.bincount(array1, array2)print(\"Summation element-wise : \\n\", bin) #index 0 : 0#index 1 : 10 + 4 + 2 = 16#index 2 : 1 + 9 = 10#index 3 : 11 + 6 = 17",
"e": 27393,
"s": 27036,
"text": null
},
{
"code": null,
"e": 27402,
"s": 27393,
"text": "Output :"
},
{
"code": null,
"e": 27451,
"s": 27402,
"text": "Summation element-wise : \n [ 0. 16. 10. 17.]"
},
{
"code": null,
"e": 27855,
"s": 27451,
"text": "References :https://docs.scipy.org/doc/numpy/reference/generated/numpy.bincount.html#numpy.bincount.This article is contributed by Mohit Gupta_OMG . If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to [email protected]. See your article appearing on the GeeksforGeeks main page and help other Geeks."
},
{
"code": null,
"e": 27872,
"s": 27855,
"text": "CodeWithPriyansh"
},
{
"code": null,
"e": 27906,
"s": 27872,
"text": "Python numpy-Statistics Functions"
},
{
"code": null,
"e": 27919,
"s": 27906,
"text": "Python-numpy"
},
{
"code": null,
"e": 27926,
"s": 27919,
"text": "Python"
},
{
"code": null,
"e": 28024,
"s": 27926,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 28056,
"s": 28024,
"text": "How to Install PIP on Windows ?"
},
{
"code": null,
"e": 28098,
"s": 28056,
"text": "Check if element exists in list in Python"
},
{
"code": null,
"e": 28140,
"s": 28098,
"text": "How To Convert Python Dictionary To JSON?"
},
{
"code": null,
"e": 28196,
"s": 28140,
"text": "How to drop one or multiple columns in Pandas Dataframe"
},
{
"code": null,
"e": 28223,
"s": 28196,
"text": "Python Classes and Objects"
},
{
"code": null,
"e": 28262,
"s": 28223,
"text": "Python | Get unique values from a list"
},
{
"code": null,
"e": 28293,
"s": 28262,
"text": "Python | os.path.join() method"
},
{
"code": null,
"e": 28322,
"s": 28293,
"text": "Create a directory in Python"
},
{
"code": null,
"e": 28344,
"s": 28322,
"text": "Defaultdict in Python"
}
] |
How to install the previous version of node.js and npm ? - GeeksforGeeks | 20 Mar, 2020
Node.js: It is a JavaScript runtime(server-side) built on V8 JavaScript engine of Google Chrome. It was developed in 2009 by Ryan Dhal. Node.js uses an event-driven, non-blocking input/output model that makes it lightweight and efficient. It is perfect for data-intensive real-time applications. Node is like a wrapper around the V8 with built-in modules providing many features that are easy to use in asynchronous APIs.
NPM: NPM(Node Package Manager) installs and manages version and dependency of packages for Node.js. NPM is installed with Node. The aim of NPM is automated dependency and package management, anytime or anyone needs to get started with the project they can simply rum NPM install and all the dependencies they will have immediately. It is possible to specify which version your project depends upon to save your project from breaking due to updates.
Installing the previous version of Node.js and NPM: To install the previous versions from the latest version, the latest version of Node.js should be installed on your computer or you can install it from the official site of Node.js.
Step 1: Check the installed version of Node and NPM on the computer use the following command respectively
In windows:node -vnpm -v
node -v
npm -v
In linux:node --versionnpm --version
node --version
npm --version
Step 2: For installing the previous version of Node use the following command:
In windows:npm install -g node@versionExample:npm install -g [email protected]
npm install -g node@version
Example:
npm install -g [email protected]
In linux:sudo apt-get install nodejs=version-1chl1~precise1Example:sudo apt-get install nodejs=10.9.0-1chl1~precise1
sudo apt-get install nodejs=version-1chl1~precise1
Example:
sudo apt-get install nodejs=10.9.0-1chl1~precise1
Step 3: To install previous version of NPM use the following command:
In windows:npm install -g npm@version Example:npm install -g [email protected]
npm install -g npm@version
Example:
npm install -g [email protected]
In linux:sudo apt-get install npm=version-1chl1~precise1Example:sudo apt-get install npm=4.0.0-1chl1~precise1
sudo apt-get install npm=version-1chl1~precise1
Example:
sudo apt-get install npm=4.0.0-1chl1~precise1
Node.js
Node.js-Misc
Picked
Node.js
Web Technologies
Web technologies Questions
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to update Node.js and NPM to next version ?
Node.js fs.readFileSync() Method
Node.js fs.writeFile() Method
How to update NPM ?
Difference between promise and async await in Node.js
Remove elements from a JavaScript Array
Convert a string to an integer in JavaScript
How to fetch data from an API in ReactJS ?
How to insert spaces/tabs in text using HTML/CSS?
Difference between var, let and const keywords in JavaScript | [
{
"code": null,
"e": 38501,
"s": 38473,
"text": "\n20 Mar, 2020"
},
{
"code": null,
"e": 38923,
"s": 38501,
"text": "Node.js: It is a JavaScript runtime(server-side) built on V8 JavaScript engine of Google Chrome. It was developed in 2009 by Ryan Dhal. Node.js uses an event-driven, non-blocking input/output model that makes it lightweight and efficient. It is perfect for data-intensive real-time applications. Node is like a wrapper around the V8 with built-in modules providing many features that are easy to use in asynchronous APIs."
},
{
"code": null,
"e": 39372,
"s": 38923,
"text": "NPM: NPM(Node Package Manager) installs and manages version and dependency of packages for Node.js. NPM is installed with Node. The aim of NPM is automated dependency and package management, anytime or anyone needs to get started with the project they can simply rum NPM install and all the dependencies they will have immediately. It is possible to specify which version your project depends upon to save your project from breaking due to updates."
},
{
"code": null,
"e": 39606,
"s": 39372,
"text": "Installing the previous version of Node.js and NPM: To install the previous versions from the latest version, the latest version of Node.js should be installed on your computer or you can install it from the official site of Node.js."
},
{
"code": null,
"e": 39713,
"s": 39606,
"text": "Step 1: Check the installed version of Node and NPM on the computer use the following command respectively"
},
{
"code": null,
"e": 39738,
"s": 39713,
"text": "In windows:node -vnpm -v"
},
{
"code": null,
"e": 39746,
"s": 39738,
"text": "node -v"
},
{
"code": null,
"e": 39753,
"s": 39746,
"text": "npm -v"
},
{
"code": null,
"e": 39790,
"s": 39753,
"text": "In linux:node --versionnpm --version"
},
{
"code": null,
"e": 39805,
"s": 39790,
"text": "node --version"
},
{
"code": null,
"e": 39819,
"s": 39805,
"text": "npm --version"
},
{
"code": null,
"e": 39898,
"s": 39819,
"text": "Step 2: For installing the previous version of Node use the following command:"
},
{
"code": null,
"e": 39972,
"s": 39898,
"text": "In windows:npm install -g node@versionExample:npm install -g [email protected] "
},
{
"code": null,
"e": 40000,
"s": 39972,
"text": "npm install -g node@version"
},
{
"code": null,
"e": 40009,
"s": 40000,
"text": "Example:"
},
{
"code": null,
"e": 40037,
"s": 40009,
"text": "npm install -g [email protected] "
},
{
"code": null,
"e": 40156,
"s": 40037,
"text": "In linux:sudo apt-get install nodejs=version-1chl1~precise1Example:sudo apt-get install nodejs=10.9.0-1chl1~precise1"
},
{
"code": null,
"e": 40208,
"s": 40156,
"text": "sudo apt-get install nodejs=version-1chl1~precise1"
},
{
"code": null,
"e": 40217,
"s": 40208,
"text": "Example:"
},
{
"code": null,
"e": 40268,
"s": 40217,
"text": "sudo apt-get install nodejs=10.9.0-1chl1~precise1"
},
{
"code": null,
"e": 40338,
"s": 40268,
"text": "Step 3: To install previous version of NPM use the following command:"
},
{
"code": null,
"e": 40409,
"s": 40338,
"text": "In windows:npm install -g npm@version Example:npm install -g [email protected]"
},
{
"code": null,
"e": 40437,
"s": 40409,
"text": "npm install -g npm@version "
},
{
"code": null,
"e": 40446,
"s": 40437,
"text": "Example:"
},
{
"code": null,
"e": 40471,
"s": 40446,
"text": "npm install -g [email protected]"
},
{
"code": null,
"e": 40583,
"s": 40471,
"text": "In linux:sudo apt-get install npm=version-1chl1~precise1Example:sudo apt-get install npm=4.0.0-1chl1~precise1"
},
{
"code": null,
"e": 40632,
"s": 40583,
"text": "sudo apt-get install npm=version-1chl1~precise1"
},
{
"code": null,
"e": 40641,
"s": 40632,
"text": "Example:"
},
{
"code": null,
"e": 40688,
"s": 40641,
"text": "sudo apt-get install npm=4.0.0-1chl1~precise1"
},
{
"code": null,
"e": 40696,
"s": 40688,
"text": "Node.js"
},
{
"code": null,
"e": 40709,
"s": 40696,
"text": "Node.js-Misc"
},
{
"code": null,
"e": 40716,
"s": 40709,
"text": "Picked"
},
{
"code": null,
"e": 40724,
"s": 40716,
"text": "Node.js"
},
{
"code": null,
"e": 40741,
"s": 40724,
"text": "Web Technologies"
},
{
"code": null,
"e": 40768,
"s": 40741,
"text": "Web technologies Questions"
},
{
"code": null,
"e": 40866,
"s": 40768,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 40914,
"s": 40866,
"text": "How to update Node.js and NPM to next version ?"
},
{
"code": null,
"e": 40947,
"s": 40914,
"text": "Node.js fs.readFileSync() Method"
},
{
"code": null,
"e": 40977,
"s": 40947,
"text": "Node.js fs.writeFile() Method"
},
{
"code": null,
"e": 40997,
"s": 40977,
"text": "How to update NPM ?"
},
{
"code": null,
"e": 41051,
"s": 40997,
"text": "Difference between promise and async await in Node.js"
},
{
"code": null,
"e": 41091,
"s": 41051,
"text": "Remove elements from a JavaScript Array"
},
{
"code": null,
"e": 41136,
"s": 41091,
"text": "Convert a string to an integer in JavaScript"
},
{
"code": null,
"e": 41179,
"s": 41136,
"text": "How to fetch data from an API in ReactJS ?"
},
{
"code": null,
"e": 41229,
"s": 41179,
"text": "How to insert spaces/tabs in text using HTML/CSS?"
}
] |
Python DateTime - Date Class - GeeksforGeeks | 19 Dec, 2021
The object of the Date class represents the naive date containing year, month, and date according to the current Gregorian calendar. This date can be extended indefinitely in both directions. The January 1 of year 1 is called day 1 and January 2 or year 2 is called day 2 and so on.
Syntax:
class datetime.date(year, month, day)
The arguments must be in the following range –
MINYEAR(1) <= year <= MAXYEAR(9999)
1 <= month <= 12
1 <= day <= number of days in the given month and year
Note: If the argument is not an integer it will raise a TypeError and if it is outside the range a ValueError will be raised.
Example:
Python3
# Python program to# demonstrate date class # import the date classfrom datetime import date # initializing constructor# and passing arguments in the# format year, month, datemy_date = date(2020, 12, 11) print("Date passed as argument is", my_date) # Uncommenting my_date = date(1996, 12, 39)# will raise an ValueError as it is# outside range # uncommenting my_date = date('1996', 12, 11)# will raise a TypeError as a string is# passed instead of integer
Date passed as argument is 2020-12-11
Let’s see the attributes provided by this class –
Example 1: Getting min and max representable date
Python3
from datetime import date # Getting min datemindate = date.minprint("Min Date supported", mindate) # Getting max datemaxdate = date.maxprint("Max Date supported", maxdate)
Min Date supported 0001-01-01
Max Date supported 9999-12-31
Example 2: Accessing the year, month, and date attribute from the date class
Python3
from datetime import date # creating the date objectDate = date(2020, 12, 11) # Accessing the attributesprint("Year:", Date.year)print("Month:", Date.month)print("Day:", Date.day)
Year: 2020
Month: 12
Day: 11
Date class provides various functions to work with date object, like we can get the today’s date, date from the current timestamp, date from the proleptic Gregorian ordinal, where January 1 of year 1 has ordinal 1, etc. Let’s see the list of all the functions provided by this class –
Let’s see certain examples of the above functions
Example 1: Getting the current date and also change the date to string
Python3
# Python program to# print current date from datetime import date # calling the today# function of date classtoday = date.today() print("Today's date is", today) # Converting the date to the stringStr = date.isoformat(today)print("String Representation", Str)print(type(Str))
Today's date is 2021-07-23
String Representation 2021-07-23
<class 'str'>
Example 2: Getting the weekday from the day and proleptic Gregorian ordinal
Python3
# Python program to# print current date from datetime import date # calling the today# function of date classtoday = date.today() # Getting Weekday using weekday()# methodprint("Weekday using weekday():", today.weekday()) # Getting Weekday using isoweekday()# methodprint("Weekday using isoweekday():", today.isoweekday()) # Getting the proleptic Gregorian# ordinalprint("proleptic Gregorian ordinal:", today.toordinal()) # Getting the date from the ordinalprint("Date from ordinal", date.fromordinal(737000))
Weekday using weekday(): 4
Weekday using isoweekday(): 5
proleptic Gregorian ordinal: 737994
Date from ordinal 2018-11-02
Note: For more information on Python Datetime, refer to Python Datetime Tutorial
singghakshay
simranarora5sos
Python-datetime
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
Python Classes and Objects
How to drop one or multiple columns in Pandas Dataframe
Defaultdict in Python
Python | Get unique values from a list
Python | os.path.join() method
Create a directory in Python
Python | Pandas dataframe.groupby() | [
{
"code": null,
"e": 25537,
"s": 25509,
"text": "\n19 Dec, 2021"
},
{
"code": null,
"e": 25820,
"s": 25537,
"text": "The object of the Date class represents the naive date containing year, month, and date according to the current Gregorian calendar. This date can be extended indefinitely in both directions. The January 1 of year 1 is called day 1 and January 2 or year 2 is called day 2 and so on."
},
{
"code": null,
"e": 25828,
"s": 25820,
"text": "Syntax:"
},
{
"code": null,
"e": 25866,
"s": 25828,
"text": "class datetime.date(year, month, day)"
},
{
"code": null,
"e": 25913,
"s": 25866,
"text": "The arguments must be in the following range –"
},
{
"code": null,
"e": 25949,
"s": 25913,
"text": "MINYEAR(1) <= year <= MAXYEAR(9999)"
},
{
"code": null,
"e": 25966,
"s": 25949,
"text": "1 <= month <= 12"
},
{
"code": null,
"e": 26021,
"s": 25966,
"text": "1 <= day <= number of days in the given month and year"
},
{
"code": null,
"e": 26148,
"s": 26021,
"text": "Note: If the argument is not an integer it will raise a TypeError and if it is outside the range a ValueError will be raised. "
},
{
"code": null,
"e": 26157,
"s": 26148,
"text": "Example:"
},
{
"code": null,
"e": 26165,
"s": 26157,
"text": "Python3"
},
{
"code": "# Python program to# demonstrate date class # import the date classfrom datetime import date # initializing constructor# and passing arguments in the# format year, month, datemy_date = date(2020, 12, 11) print(\"Date passed as argument is\", my_date) # Uncommenting my_date = date(1996, 12, 39)# will raise an ValueError as it is# outside range # uncommenting my_date = date('1996', 12, 11)# will raise a TypeError as a string is# passed instead of integer",
"e": 26620,
"s": 26165,
"text": null
},
{
"code": null,
"e": 26658,
"s": 26620,
"text": "Date passed as argument is 2020-12-11"
},
{
"code": null,
"e": 26709,
"s": 26658,
"text": "Let’s see the attributes provided by this class – "
},
{
"code": null,
"e": 26760,
"s": 26709,
"text": "Example 1: Getting min and max representable date "
},
{
"code": null,
"e": 26768,
"s": 26760,
"text": "Python3"
},
{
"code": "from datetime import date # Getting min datemindate = date.minprint(\"Min Date supported\", mindate) # Getting max datemaxdate = date.maxprint(\"Max Date supported\", maxdate)",
"e": 26940,
"s": 26768,
"text": null
},
{
"code": null,
"e": 27000,
"s": 26940,
"text": "Min Date supported 0001-01-01\nMax Date supported 9999-12-31"
},
{
"code": null,
"e": 27077,
"s": 27000,
"text": "Example 2: Accessing the year, month, and date attribute from the date class"
},
{
"code": null,
"e": 27085,
"s": 27077,
"text": "Python3"
},
{
"code": "from datetime import date # creating the date objectDate = date(2020, 12, 11) # Accessing the attributesprint(\"Year:\", Date.year)print(\"Month:\", Date.month)print(\"Day:\", Date.day)",
"e": 27265,
"s": 27085,
"text": null
},
{
"code": null,
"e": 27294,
"s": 27265,
"text": "Year: 2020\nMonth: 12\nDay: 11"
},
{
"code": null,
"e": 27581,
"s": 27294,
"text": " Date class provides various functions to work with date object, like we can get the today’s date, date from the current timestamp, date from the proleptic Gregorian ordinal, where January 1 of year 1 has ordinal 1, etc. Let’s see the list of all the functions provided by this class – "
},
{
"code": null,
"e": 27631,
"s": 27581,
"text": "Let’s see certain examples of the above functions"
},
{
"code": null,
"e": 27702,
"s": 27631,
"text": "Example 1: Getting the current date and also change the date to string"
},
{
"code": null,
"e": 27710,
"s": 27702,
"text": "Python3"
},
{
"code": "# Python program to# print current date from datetime import date # calling the today# function of date classtoday = date.today() print(\"Today's date is\", today) # Converting the date to the stringStr = date.isoformat(today)print(\"String Representation\", Str)print(type(Str))",
"e": 27986,
"s": 27710,
"text": null
},
{
"code": null,
"e": 28060,
"s": 27986,
"text": "Today's date is 2021-07-23\nString Representation 2021-07-23\n<class 'str'>"
},
{
"code": null,
"e": 28136,
"s": 28060,
"text": "Example 2: Getting the weekday from the day and proleptic Gregorian ordinal"
},
{
"code": null,
"e": 28144,
"s": 28136,
"text": "Python3"
},
{
"code": "# Python program to# print current date from datetime import date # calling the today# function of date classtoday = date.today() # Getting Weekday using weekday()# methodprint(\"Weekday using weekday():\", today.weekday()) # Getting Weekday using isoweekday()# methodprint(\"Weekday using isoweekday():\", today.isoweekday()) # Getting the proleptic Gregorian# ordinalprint(\"proleptic Gregorian ordinal:\", today.toordinal()) # Getting the date from the ordinalprint(\"Date from ordinal\", date.fromordinal(737000))",
"e": 28654,
"s": 28144,
"text": null
},
{
"code": null,
"e": 28776,
"s": 28654,
"text": "Weekday using weekday(): 4\nWeekday using isoweekday(): 5\nproleptic Gregorian ordinal: 737994\nDate from ordinal 2018-11-02"
},
{
"code": null,
"e": 28857,
"s": 28776,
"text": "Note: For more information on Python Datetime, refer to Python Datetime Tutorial"
},
{
"code": null,
"e": 28870,
"s": 28857,
"text": "singghakshay"
},
{
"code": null,
"e": 28886,
"s": 28870,
"text": "simranarora5sos"
},
{
"code": null,
"e": 28902,
"s": 28886,
"text": "Python-datetime"
},
{
"code": null,
"e": 28909,
"s": 28902,
"text": "Python"
},
{
"code": null,
"e": 29007,
"s": 28909,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 29039,
"s": 29007,
"text": "How to Install PIP on Windows ?"
},
{
"code": null,
"e": 29081,
"s": 29039,
"text": "Check if element exists in list in Python"
},
{
"code": null,
"e": 29123,
"s": 29081,
"text": "How To Convert Python Dictionary To JSON?"
},
{
"code": null,
"e": 29150,
"s": 29123,
"text": "Python Classes and Objects"
},
{
"code": null,
"e": 29206,
"s": 29150,
"text": "How to drop one or multiple columns in Pandas Dataframe"
},
{
"code": null,
"e": 29228,
"s": 29206,
"text": "Defaultdict in Python"
},
{
"code": null,
"e": 29267,
"s": 29228,
"text": "Python | Get unique values from a list"
},
{
"code": null,
"e": 29298,
"s": 29267,
"text": "Python | os.path.join() method"
},
{
"code": null,
"e": 29327,
"s": 29298,
"text": "Create a directory in Python"
}
] |
Find the unique rows in R DataFrame - GeeksforGeeks | 07 Apr, 2021
In an R data frame, a unique row means that none of the elements in that row are replicated in the whole data frame with the same combination. In simple terms, if we have a data frame called df with four columns and five rows, we can assume that none of the values in one row are replicated in every other row.
If we have many redundant rows in our data collection, we can need to look for certain types of rows. We can use the dplyr package’s group_by_all function to achieve this. It will group all the redundant rows and return unique rows with their count.
Example 1:
R
library("dplyr") df = data.frame(x = as.integer(c(1, 1, 2, 2, 3, 4, 4)), y = as.integer(c(1, 1, 2, 2, 3, 4, 4))) print("dataset is ")print(df) ans = df%>%group_by_all%>%countprint("unique rows with count are")print(ans)
Output:
Example 2:
R
library("dplyr") df = data.frame(x = as.integer( c(10,10,20,20,30,40,40) ), y = c("rahul", "rahul", "mohan","mohan", "rohit", "rohan", "rohan")) print("dataset is ")print(df) ans = df%>%group_by_all%>%countprint("unique rows with count are")print(ans)
Output:
Picked
R DataFrame-Programs
R-DataFrame
R Language
R Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Change Color of Bars in Barchart using ggplot2 in R
Group by function in R using Dplyr
How to Change Axis Scales in R Plots?
How to Split Column Into Multiple Columns in R DataFrame?
Replace Specific Characters in String in R
How to Split Column Into Multiple Columns in R DataFrame?
Replace Specific Characters in String in R
How to filter R DataFrame by values in a column?
How to filter R dataframe by multiple conditions?
Convert Matrix to Dataframe in R | [
{
"code": null,
"e": 26487,
"s": 26459,
"text": "\n07 Apr, 2021"
},
{
"code": null,
"e": 26798,
"s": 26487,
"text": "In an R data frame, a unique row means that none of the elements in that row are replicated in the whole data frame with the same combination. In simple terms, if we have a data frame called df with four columns and five rows, we can assume that none of the values in one row are replicated in every other row."
},
{
"code": null,
"e": 27048,
"s": 26798,
"text": "If we have many redundant rows in our data collection, we can need to look for certain types of rows. We can use the dplyr package’s group_by_all function to achieve this. It will group all the redundant rows and return unique rows with their count."
},
{
"code": null,
"e": 27059,
"s": 27048,
"text": "Example 1:"
},
{
"code": null,
"e": 27061,
"s": 27059,
"text": "R"
},
{
"code": "library(\"dplyr\") df = data.frame(x = as.integer(c(1, 1, 2, 2, 3, 4, 4)), y = as.integer(c(1, 1, 2, 2, 3, 4, 4))) print(\"dataset is \")print(df) ans = df%>%group_by_all%>%countprint(\"unique rows with count are\")print(ans)",
"e": 27300,
"s": 27061,
"text": null
},
{
"code": null,
"e": 27308,
"s": 27300,
"text": "Output:"
},
{
"code": null,
"e": 27319,
"s": 27308,
"text": "Example 2:"
},
{
"code": null,
"e": 27321,
"s": 27319,
"text": "R"
},
{
"code": "library(\"dplyr\") df = data.frame(x = as.integer( c(10,10,20,20,30,40,40) ), y = c(\"rahul\", \"rahul\", \"mohan\",\"mohan\", \"rohit\", \"rohan\", \"rohan\")) print(\"dataset is \")print(df) ans = df%>%group_by_all%>%countprint(\"unique rows with count are\")print(ans)",
"e": 27591,
"s": 27321,
"text": null
},
{
"code": null,
"e": 27599,
"s": 27591,
"text": "Output:"
},
{
"code": null,
"e": 27606,
"s": 27599,
"text": "Picked"
},
{
"code": null,
"e": 27627,
"s": 27606,
"text": "R DataFrame-Programs"
},
{
"code": null,
"e": 27639,
"s": 27627,
"text": "R-DataFrame"
},
{
"code": null,
"e": 27650,
"s": 27639,
"text": "R Language"
},
{
"code": null,
"e": 27661,
"s": 27650,
"text": "R Programs"
},
{
"code": null,
"e": 27759,
"s": 27661,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 27811,
"s": 27759,
"text": "Change Color of Bars in Barchart using ggplot2 in R"
},
{
"code": null,
"e": 27846,
"s": 27811,
"text": "Group by function in R using Dplyr"
},
{
"code": null,
"e": 27884,
"s": 27846,
"text": "How to Change Axis Scales in R Plots?"
},
{
"code": null,
"e": 27942,
"s": 27884,
"text": "How to Split Column Into Multiple Columns in R DataFrame?"
},
{
"code": null,
"e": 27985,
"s": 27942,
"text": "Replace Specific Characters in String in R"
},
{
"code": null,
"e": 28043,
"s": 27985,
"text": "How to Split Column Into Multiple Columns in R DataFrame?"
},
{
"code": null,
"e": 28086,
"s": 28043,
"text": "Replace Specific Characters in String in R"
},
{
"code": null,
"e": 28135,
"s": 28086,
"text": "How to filter R DataFrame by values in a column?"
},
{
"code": null,
"e": 28185,
"s": 28135,
"text": "How to filter R dataframe by multiple conditions?"
}
] |
How to make a voice unlock system in Python? - GeeksforGeeks | 18 Feb, 2022
A voice-based unlock system for our computer will be the application that will take our voice as input and process that voice converts it into a text-based instruction for our computer and then perform an action based on that instruction. This process uses The State-of-the-art process in a speech to text, Natural Language Understanding, and Deep Learning in the text to speech.
The first step to build a voice-based application in our application is to listen to the user’s voice constantly and then transcribe that voice into text-based instruction.
This is difficult to create a voice to text transcription engine with the higher accuracy as we need to train our data model for that also there are a lot of industry leaders are available as Google, Microsoft, Apple, and some others are providing their API based services which can be easily integrated with the applications. Google also offers voice action which is an API-based service to perform an action within the app seamlessly using voice.
If you are interested to develop your own speech-to-text application, please go through it. Now for building your own python based application please do follow these steps :
1. Import libraries
Python3
import sysimport ctypesimport speech_recognition as speech
Library ctypes is a foreign function library for Python. Which provides C compatible data types and allows calling functions in DLLs or shared libraries. It can be used to wrap these libraries in pure Python.
Speech Recognition is an important feature in several applications used such as home automation, artificial intelligence, etc.
2. Audio by the Microphone
Now obtain the audio from your microphone using the Recognizer() function of python’s speech_recognition module. In this way, we have captured the voice command from our system.
Python3
voice = speech.Recognizer()with speech.Microphone() as source: print("Say something!") voice_command = voice.listen(source)
3. Check command
Now the time is to use the Google speech recognition engine note this point instead of using this API you can use your own voice recognition system. And you need to handle some exceptions via your code for errors coming from the Google engine.
Python3
try: command=voice.recognize_google(voice_command) # handle the exceptionsexcept speech.UnknownValueError: print("Google Speech Recognition system could not understand your \ instructions please give instructions carefully") except speech.RequestError as e: print("Could not request results from Google Speech Recognition\ service; {0}".format(e))
4. Validate Command
Now the time is to match and compare the pattern of the voice command. And load and execute the command to lock the PC. This Function for locking the pc is available in the default library (user32.dll) of windows. And you can use Linux also but the command will be different for this operation and the default library will be available on (cell.user32) as well.
Python3
if command == "lock my PC": ctypes.windll.user32.LockWorkStation() elif command == "stop": sys.exit(0) else: print("Not a command.") fxn()
Below is the Implementation.
Here, we will form a function (method) that repeatedly calls itself until the required commands.
If the command is to lock pc then it locks pc.
If the command is a stop the program then it stops the program.
Otherwise, It says not a coded command and runs again.
Python3
# importing packagesimport sysimport ctypesimport speech_recognition as speech # define functiondef fxn(): # voice recognizer object voice = speech.Recognizer() # use microphone with speech.Microphone() as source: print("Say something!") voice_command = voice.listen(source) # check input try: command = voice.recognize_google(voice_command) print(command) # handle the exceptions except speech.UnknownValueError: print("Google Speech Recognition system could not\ understand your instructions please give instructions carefully") except speech.RequestError as e: print( "Could not request results from Google Speech Recognition \ service; {0}".format(e)) # validate input if command == "lock my PC": ctypes.windll.user32.LockWorkStation() elif command == "stop": sys.exit(0) else: print("Not a command.") fxn() # executefxn()
Output:
sumitgumber28
varshagumber28
Picked
python-utility
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
Python Classes and Objects
How to drop one or multiple columns in Pandas Dataframe
Defaultdict in Python
Python | Get unique values from a list
Python | os.path.join() method
Create a directory in Python
Python | Pandas dataframe.groupby() | [
{
"code": null,
"e": 25537,
"s": 25509,
"text": "\n18 Feb, 2022"
},
{
"code": null,
"e": 25917,
"s": 25537,
"text": "A voice-based unlock system for our computer will be the application that will take our voice as input and process that voice converts it into a text-based instruction for our computer and then perform an action based on that instruction. This process uses The State-of-the-art process in a speech to text, Natural Language Understanding, and Deep Learning in the text to speech."
},
{
"code": null,
"e": 26090,
"s": 25917,
"text": "The first step to build a voice-based application in our application is to listen to the user’s voice constantly and then transcribe that voice into text-based instruction."
},
{
"code": null,
"e": 26539,
"s": 26090,
"text": "This is difficult to create a voice to text transcription engine with the higher accuracy as we need to train our data model for that also there are a lot of industry leaders are available as Google, Microsoft, Apple, and some others are providing their API based services which can be easily integrated with the applications. Google also offers voice action which is an API-based service to perform an action within the app seamlessly using voice."
},
{
"code": null,
"e": 26713,
"s": 26539,
"text": "If you are interested to develop your own speech-to-text application, please go through it. Now for building your own python based application please do follow these steps :"
},
{
"code": null,
"e": 26733,
"s": 26713,
"text": "1. Import libraries"
},
{
"code": null,
"e": 26741,
"s": 26733,
"text": "Python3"
},
{
"code": "import sysimport ctypesimport speech_recognition as speech",
"e": 26800,
"s": 26741,
"text": null
},
{
"code": null,
"e": 27009,
"s": 26800,
"text": "Library ctypes is a foreign function library for Python. Which provides C compatible data types and allows calling functions in DLLs or shared libraries. It can be used to wrap these libraries in pure Python."
},
{
"code": null,
"e": 27136,
"s": 27009,
"text": "Speech Recognition is an important feature in several applications used such as home automation, artificial intelligence, etc."
},
{
"code": null,
"e": 27163,
"s": 27136,
"text": "2. Audio by the Microphone"
},
{
"code": null,
"e": 27341,
"s": 27163,
"text": "Now obtain the audio from your microphone using the Recognizer() function of python’s speech_recognition module. In this way, we have captured the voice command from our system."
},
{
"code": null,
"e": 27349,
"s": 27341,
"text": "Python3"
},
{
"code": "voice = speech.Recognizer()with speech.Microphone() as source: print(\"Say something!\") voice_command = voice.listen(source)",
"e": 27479,
"s": 27349,
"text": null
},
{
"code": null,
"e": 27496,
"s": 27479,
"text": "3. Check command"
},
{
"code": null,
"e": 27740,
"s": 27496,
"text": "Now the time is to use the Google speech recognition engine note this point instead of using this API you can use your own voice recognition system. And you need to handle some exceptions via your code for errors coming from the Google engine."
},
{
"code": null,
"e": 27748,
"s": 27740,
"text": "Python3"
},
{
"code": "try: command=voice.recognize_google(voice_command) # handle the exceptionsexcept speech.UnknownValueError: print(\"Google Speech Recognition system could not understand your \\ instructions please give instructions carefully\") except speech.RequestError as e: print(\"Could not request results from Google Speech Recognition\\ service; {0}\".format(e))",
"e": 28115,
"s": 27748,
"text": null
},
{
"code": null,
"e": 28135,
"s": 28115,
"text": "4. Validate Command"
},
{
"code": null,
"e": 28497,
"s": 28135,
"text": "Now the time is to match and compare the pattern of the voice command. And load and execute the command to lock the PC. This Function for locking the pc is available in the default library (user32.dll) of windows. And you can use Linux also but the command will be different for this operation and the default library will be available on (cell.user32) as well."
},
{
"code": null,
"e": 28505,
"s": 28497,
"text": "Python3"
},
{
"code": "if command == \"lock my PC\": ctypes.windll.user32.LockWorkStation() elif command == \"stop\": sys.exit(0) else: print(\"Not a command.\") fxn()",
"e": 28664,
"s": 28505,
"text": null
},
{
"code": null,
"e": 28693,
"s": 28664,
"text": "Below is the Implementation."
},
{
"code": null,
"e": 28790,
"s": 28693,
"text": "Here, we will form a function (method) that repeatedly calls itself until the required commands."
},
{
"code": null,
"e": 28837,
"s": 28790,
"text": "If the command is to lock pc then it locks pc."
},
{
"code": null,
"e": 28901,
"s": 28837,
"text": "If the command is a stop the program then it stops the program."
},
{
"code": null,
"e": 28956,
"s": 28901,
"text": "Otherwise, It says not a coded command and runs again."
},
{
"code": null,
"e": 28964,
"s": 28956,
"text": "Python3"
},
{
"code": "# importing packagesimport sysimport ctypesimport speech_recognition as speech # define functiondef fxn(): # voice recognizer object voice = speech.Recognizer() # use microphone with speech.Microphone() as source: print(\"Say something!\") voice_command = voice.listen(source) # check input try: command = voice.recognize_google(voice_command) print(command) # handle the exceptions except speech.UnknownValueError: print(\"Google Speech Recognition system could not\\ understand your instructions please give instructions carefully\") except speech.RequestError as e: print( \"Could not request results from Google Speech Recognition \\ service; {0}\".format(e)) # validate input if command == \"lock my PC\": ctypes.windll.user32.LockWorkStation() elif command == \"stop\": sys.exit(0) else: print(\"Not a command.\") fxn() # executefxn()",
"e": 29971,
"s": 28964,
"text": null
},
{
"code": null,
"e": 29980,
"s": 29971,
"text": "Output: "
},
{
"code": null,
"e": 29994,
"s": 29980,
"text": "sumitgumber28"
},
{
"code": null,
"e": 30009,
"s": 29994,
"text": "varshagumber28"
},
{
"code": null,
"e": 30016,
"s": 30009,
"text": "Picked"
},
{
"code": null,
"e": 30031,
"s": 30016,
"text": "python-utility"
},
{
"code": null,
"e": 30038,
"s": 30031,
"text": "Python"
},
{
"code": null,
"e": 30136,
"s": 30038,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 30168,
"s": 30136,
"text": "How to Install PIP on Windows ?"
},
{
"code": null,
"e": 30210,
"s": 30168,
"text": "Check if element exists in list in Python"
},
{
"code": null,
"e": 30252,
"s": 30210,
"text": "How To Convert Python Dictionary To JSON?"
},
{
"code": null,
"e": 30279,
"s": 30252,
"text": "Python Classes and Objects"
},
{
"code": null,
"e": 30335,
"s": 30279,
"text": "How to drop one or multiple columns in Pandas Dataframe"
},
{
"code": null,
"e": 30357,
"s": 30335,
"text": "Defaultdict in Python"
},
{
"code": null,
"e": 30396,
"s": 30357,
"text": "Python | Get unique values from a list"
},
{
"code": null,
"e": 30427,
"s": 30396,
"text": "Python | os.path.join() method"
},
{
"code": null,
"e": 30456,
"s": 30427,
"text": "Create a directory in Python"
}
] |
How to check if a Variable Is Not Null in JavaScript ? - GeeksforGeeks | 10 May, 2021
You can easily check if a variable Is Null or Not Null in JavaScript by applying simple if-else condition to the given variable.
There are two ways to check if a variable is null or not. First I will discuss the wrong way that seems to be right to you at first, then we will discuss the correct way to check if a variable is null or not.
Method 1: The wrong way that seems to be right.
Condition:
if(my_var) {
....
}
Note: When a variable is null, there is an absence of any object value in a variable. Null is often retrieved in a place where an object can be expected, but no object is relevant.
By the above condition, if my_var is null then given if condition will not execute because null is a falsy value in JavaScript, but in JavaScript there are many pre-defined falsy values like
undefined
null
0
“” ( empty string)
false
NaN
So if my_var is equal to any of the above pre-defined falsy values then if condition would not execute or vice-versa.
Example 1:
HTML
<!DOCTYPE html><html> <body style="text-align:center;"> <h2 style="color:green;"> GeeksforGeeks </h2> <p> variable-name : GFG_Var </p> <button onclick="myGeeks()"> Check for vowel </button> <h3 id="div" style="color:green;">HTML</h3> <!-- Script to check existence of variable --> <script> function myGeeks() { var h3 = document.getElementById("div"); var GFG_Var = h3.innerHTML; // check if GFG_Var variable contain any vowels // HTML text contains no vowels, // so variable my_var will be assigned null const my_var = GFG_Var.match(/[aeiou]/gi); if (my_var ) { h3.innerHTML = "Variable is not null"; } else { h3.innerHTML = "Variable is NULL"; } } </script></body></html>
Output:
Check for vowel
Method 2: The following code shows the correct way to check if variable is null or not.
Condition:
if(my_var !== null)
{
....
}
The above condition is actually the correct way to check if a variable is null or not. The if condition will execute if my_var is any value other than a null i.e
If my_var is undefined then the condition will execute.
If my_var is 0 then the condition will execute.
If my_var is ” (empty string) then the condition will execute.
...
This condition will check the exact value of the variable whether it is null or not.
Example 2:
HTML
<!DOCTYPE html><html><body style="text-align:center;"> <h2 style="color:green;" > GeeksforGeeks </h2> <p> variable-name : GFG_Var </p> <button onclick="myGeeks()"> Check for vowel </button> <h3 id="div" style="color:green;">HTML</h3> <!-- Script to check existence of variable --> <script> function myGeeks() { var h3 = document.getElementById("div"); var GFG_Var = h3.innerHTML; // check if GFG_Var variable contain any vowels // HTML text contain no vowels // so variable my_var will assign null const my_var = GFG_Var.match(/[aeiou]/gi); // this will check exactly whether variable is null or not if (my_var !== null ) { h3.innerHTML = "Variable is not null"; } else { h3.innerHTML = "Variable is NULL"; } } </script></body> </html>
Output: The output is the same as in the first example but with the proper condition in the JavaScript code.
javascript-basics
JavaScript-Questions
Picked
JavaScript
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Remove elements from a JavaScript Array
Difference between var, let and const keywords in JavaScript
Difference Between PUT and PATCH Request
JavaScript | Promises
How to get character array from string in JavaScript?
Remove elements from a JavaScript Array
Installation of Node.js on Linux
How to fetch data from an API in ReactJS ?
How to insert spaces/tabs in text using HTML/CSS?
Difference between var, let and const keywords in JavaScript | [
{
"code": null,
"e": 26545,
"s": 26517,
"text": "\n10 May, 2021"
},
{
"code": null,
"e": 26675,
"s": 26545,
"text": "You can easily check if a variable Is Null or Not Null in JavaScript by applying simple if-else condition to the given variable. "
},
{
"code": null,
"e": 26884,
"s": 26675,
"text": "There are two ways to check if a variable is null or not. First I will discuss the wrong way that seems to be right to you at first, then we will discuss the correct way to check if a variable is null or not."
},
{
"code": null,
"e": 26932,
"s": 26884,
"text": "Method 1: The wrong way that seems to be right."
},
{
"code": null,
"e": 26943,
"s": 26932,
"text": "Condition:"
},
{
"code": null,
"e": 26967,
"s": 26943,
"text": "if(my_var) {\n ....\n}"
},
{
"code": null,
"e": 27148,
"s": 26967,
"text": "Note: When a variable is null, there is an absence of any object value in a variable. Null is often retrieved in a place where an object can be expected, but no object is relevant."
},
{
"code": null,
"e": 27339,
"s": 27148,
"text": "By the above condition, if my_var is null then given if condition will not execute because null is a falsy value in JavaScript, but in JavaScript there are many pre-defined falsy values like"
},
{
"code": null,
"e": 27349,
"s": 27339,
"text": "undefined"
},
{
"code": null,
"e": 27354,
"s": 27349,
"text": "null"
},
{
"code": null,
"e": 27356,
"s": 27354,
"text": "0"
},
{
"code": null,
"e": 27375,
"s": 27356,
"text": "“” ( empty string)"
},
{
"code": null,
"e": 27381,
"s": 27375,
"text": "false"
},
{
"code": null,
"e": 27385,
"s": 27381,
"text": "NaN"
},
{
"code": null,
"e": 27504,
"s": 27385,
"text": "So if my_var is equal to any of the above pre-defined falsy values then if condition would not execute or vice-versa. "
},
{
"code": null,
"e": 27515,
"s": 27504,
"text": "Example 1:"
},
{
"code": null,
"e": 27520,
"s": 27515,
"text": "HTML"
},
{
"code": "<!DOCTYPE html><html> <body style=\"text-align:center;\"> <h2 style=\"color:green;\"> GeeksforGeeks </h2> <p> variable-name : GFG_Var </p> <button onclick=\"myGeeks()\"> Check for vowel </button> <h3 id=\"div\" style=\"color:green;\">HTML</h3> <!-- Script to check existence of variable --> <script> function myGeeks() { var h3 = document.getElementById(\"div\"); var GFG_Var = h3.innerHTML; // check if GFG_Var variable contain any vowels // HTML text contains no vowels, // so variable my_var will be assigned null const my_var = GFG_Var.match(/[aeiou]/gi); if (my_var ) { h3.innerHTML = \"Variable is not null\"; } else { h3.innerHTML = \"Variable is NULL\"; } } </script></body></html> ",
"e": 28509,
"s": 27520,
"text": null
},
{
"code": null,
"e": 28517,
"s": 28509,
"text": "Output:"
},
{
"code": null,
"e": 28533,
"s": 28517,
"text": "Check for vowel"
},
{
"code": null,
"e": 28622,
"s": 28533,
"text": "Method 2: The following code shows the correct way to check if variable is null or not."
},
{
"code": null,
"e": 28633,
"s": 28622,
"text": "Condition:"
},
{
"code": null,
"e": 28666,
"s": 28633,
"text": "if(my_var !== null)\n{\n ....\n}"
},
{
"code": null,
"e": 28829,
"s": 28666,
"text": "The above condition is actually the correct way to check if a variable is null or not. The if condition will execute if my_var is any value other than a null i.e "
},
{
"code": null,
"e": 28885,
"s": 28829,
"text": "If my_var is undefined then the condition will execute."
},
{
"code": null,
"e": 28933,
"s": 28885,
"text": "If my_var is 0 then the condition will execute."
},
{
"code": null,
"e": 28996,
"s": 28933,
"text": "If my_var is ” (empty string) then the condition will execute."
},
{
"code": null,
"e": 29000,
"s": 28996,
"text": "..."
},
{
"code": null,
"e": 29085,
"s": 29000,
"text": "This condition will check the exact value of the variable whether it is null or not."
},
{
"code": null,
"e": 29096,
"s": 29085,
"text": "Example 2:"
},
{
"code": null,
"e": 29101,
"s": 29096,
"text": "HTML"
},
{
"code": "<!DOCTYPE html><html><body style=\"text-align:center;\"> <h2 style=\"color:green;\" > GeeksforGeeks </h2> <p> variable-name : GFG_Var </p> <button onclick=\"myGeeks()\"> Check for vowel </button> <h3 id=\"div\" style=\"color:green;\">HTML</h3> <!-- Script to check existence of variable --> <script> function myGeeks() { var h3 = document.getElementById(\"div\"); var GFG_Var = h3.innerHTML; // check if GFG_Var variable contain any vowels // HTML text contain no vowels // so variable my_var will assign null const my_var = GFG_Var.match(/[aeiou]/gi); // this will check exactly whether variable is null or not if (my_var !== null ) { h3.innerHTML = \"Variable is not null\"; } else { h3.innerHTML = \"Variable is NULL\"; } } </script></body> </html> ",
"e": 30168,
"s": 29101,
"text": null
},
{
"code": null,
"e": 30277,
"s": 30168,
"text": "Output: The output is the same as in the first example but with the proper condition in the JavaScript code."
},
{
"code": null,
"e": 30295,
"s": 30277,
"text": "javascript-basics"
},
{
"code": null,
"e": 30316,
"s": 30295,
"text": "JavaScript-Questions"
},
{
"code": null,
"e": 30323,
"s": 30316,
"text": "Picked"
},
{
"code": null,
"e": 30334,
"s": 30323,
"text": "JavaScript"
},
{
"code": null,
"e": 30351,
"s": 30334,
"text": "Web Technologies"
},
{
"code": null,
"e": 30449,
"s": 30351,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 30489,
"s": 30449,
"text": "Remove elements from a JavaScript Array"
},
{
"code": null,
"e": 30550,
"s": 30489,
"text": "Difference between var, let and const keywords in JavaScript"
},
{
"code": null,
"e": 30591,
"s": 30550,
"text": "Difference Between PUT and PATCH Request"
},
{
"code": null,
"e": 30613,
"s": 30591,
"text": "JavaScript | Promises"
},
{
"code": null,
"e": 30667,
"s": 30613,
"text": "How to get character array from string in JavaScript?"
},
{
"code": null,
"e": 30707,
"s": 30667,
"text": "Remove elements from a JavaScript Array"
},
{
"code": null,
"e": 30740,
"s": 30707,
"text": "Installation of Node.js on Linux"
},
{
"code": null,
"e": 30783,
"s": 30740,
"text": "How to fetch data from an API in ReactJS ?"
},
{
"code": null,
"e": 30833,
"s": 30783,
"text": "How to insert spaces/tabs in text using HTML/CSS?"
}
] |
Python Itertools - GeeksforGeeks | 13 Sep, 2021
Python’s Itertool is a module that provides various functions that work on iterators to produce complex iterators. This module works as a fast, memory-efficient tool that is used either by themselves or in combination to form iterator algebra. For example, let’s suppose there are two lists and you want to multiply their elements. There can be several ways of achieving this. One can be using the naive approach i.e by iterating through the elements of both the list simultaneously and multiply them. And another approach can be using the map function i.e by passing the mul operator as a first parameter to the map function and Lists as the second and third parameter to this function. Let’s see the time taken by each approach.
Python3
# Python program to demonstrate# iterator module import operatorimport time # Defining listsL1 = [1, 2, 3]L2 = [2, 3, 4] # Starting time before map# functiont1 = time.time() # Calculating resulta, b, c = map(operator.mul, L1, L2) # Ending time after map# functiont2 = time.time() # Time taken by map functionprint("Result:", a, b, c)print("Time taken by map function: %.6f" %(t2 - t1)) # Starting time before naive# methodt1 = time.time() # Calculating result using for loopprint("Result:", end = " ")for i in range(3): print(L1[i] * L2[i], end = " ") # Ending time after naive# methodt2 = time.time()print("\nTime taken by for loop: %.6f" %(t2 - t1))
Output:
Result: 2 6 12
Time taken by map function: 0.000005
Result: 2 6 12
Time taken by for loop: 0.000014
In the above example, it can be seen that the time taken by the map function is approximately half than the time taken by for loop. This shows that itertools are fast, memory-efficient tools.
Different types of iterators provided by this module are:
Infinite iterators
Combinatoric iterators
Terminating iterators
Iterator in Python is any Python type that can be used with a ‘for in loop’. Python lists, tuples, dictionaries, and sets are all examples of inbuilt iterators. But it is not necessary that an iterator object has to exhaust, sometimes it can be infinite. Such types of iterators are known as Infinite iterators.
Python provides three types of infinite iterators:
count(start, step): This iterator starts printing from the “start” number and prints infinitely. If steps are mentioned, the numbers are skipped else step is 1 by default. See the below example for its use with for in loop.Example:
Python3
# Python program to demonstrate# infinite iterators import itertools # for in loopfor i in itertools.count(5, 5): if i == 35: break else: print(i, end =" ")
Output:
5 10 15 20 25 30
cycle(iterable): This iterator prints all values in order from the passed container. It restarts printing from the beginning again when all elements are printed in a cyclic manner.Example 1:
Python3
# Python program to demonstrate# infinite iterators import itertools count = 0 # for in loopfor i in itertools.cycle('AB'): if count > 7: break else: print(i, end = " ") count += 1
Output:
A B A B A B A B
Example 2: Using the next function.
Python3
# Python program to demonstrate# infinite iterators import itertools l = ['Geeks', 'for', 'Geeks'] # defining iteratoriterators = itertools.cycle(l) # for in loopfor i in range(6): # Using next function print(next(iterators), end = " ")
Combinatoric iterators Output:
Geeks for Geeks Geeks for Geeks
repeat(val, num): This iterator repeatedly prints the passed value an infinite number of times. If the optional keyword num is mentioned, then it repeatedly prints num number of times.Example:
Python3
# Python code to demonstrate the working of # repeat() # importing "itertools" for iterator operations import itertools # using repeat() to repeatedly print number print ("Printing the numbers repeatedly : ") print (list(itertools.repeat(25, 4)))
Output:
Printing the numbers repeatedly :
[25, 25, 25, 25]
The recursive generators that are used to simplify combinatorial constructs such as permutations, combinations, and Cartesian products are called combinatoric iterators.In Python there are 4 combinatoric iterators:
Product(): This tool computes the cartesian product of input iterables. To compute the product of an iterable with itself, we use the optional repeat keyword argument to specify the number of repetitions. The output of this function is tuples in sorted order.Example:
Python3
# import the product function from itertools modulefrom itertools import product print("The cartesian product using repeat:")print(list(product([1, 2], repeat = 2)))print() print("The cartesian product of the containers:")print(list(product(['geeks', 'for', 'geeks'], '2')))print() print("The cartesian product of the containers:")print(list(product('AB', [3, 4])))
Output:
The cartesian product using repeat:
[(1, 1), (1, 2), (2, 1), (2, 2)]
The cartesian product of the containers:
[('geeks', '2'), ('for', '2'), ('geeks', '2')]
The cartesian product of the containers:
[('A', 3), ('A', 4), ('B', 3), ('B', 4)]
Permutations(): Permutations() as the name speaks for itself is used to generate all possible permutations of an iterable. All elements are treated as unique based on their position and not their values. This function takes an iterable and group_size, if the value of group_size is not specified or is equal to None then the value of group_size becomes the length of the iterable.Example:
Python3
# import the product function from itertools modulefrom itertools import permutations print ("All the permutations of the given list is:") print (list(permutations([1, 'geeks'], 2)))print() Terminating iteratorsprint ("All the permutations of the given string is:") print (list(permutations('AB')))print() print ("All the permutations of the given container is:") print(list(permutations(range(3), 2)))
Output:
All the permutations of the given list is:
[(1, 'geeks'), ('geeks', 1)]
All the permutations of the given string is:
[('A', 'B'), ('B', 'A')]
All the permutations of the given container is:
[(0, 1), (0, 2), (1, 0), (1, 2), (2, 0), (2, 1)]
Combinations(): This iterator prints all the possible combinations(without replacement) of the container passed in arguments in the specified group size in sorted order.Example:
Python3
# import combinations from itertools module from itertools import combinations print ("All the combination of list in sorted order(without replacement) is:") print(list(combinations(['A', 2], 2)))print() print ("All the combination of string in sorted order(without replacement) is:")print(list(combinations('AB', 2)))print() print ("All the combination of list in sorted order(without replacement) is:")print(list(combinations(range(2), 1)))
Output:
All the combination of list in sorted order(without replacement) is:
[('A', 2)]
All the combination of string in sorted order(without replacement) is:
[('A', 'B')]
All the combination of list in sorted order(without replacement) is:
[(0, ), (1, )]
Combinations_with_replacement(): This function returns a subsequence of length n from the elements of the iterable where n is the argument that the function takes determining the length of the subsequences generated by the function. Individual elements may repeat itself in combinations_with_replacement function.Example:
Python3
# import combinations from itertools module from itertools import combinations_with_replacement print ("All the combination of string in sorted order(with replacement) is:")print(list(combinations_with_replacement("AB", 2)))print() print ("All the combination of list in sorted order(with replacement) is:")print(list(combinations_with_replacement([1, 2], 2)))print() print ("All the combination of container in sorted order(with replacement) is:")print(list(combinations_with_replacement(range(2), 1)))
Output:
All the combination of string in sorted order(with replacement) is:
[('A', 'A'), ('A', 'B'), ('B', 'B')]
All the combination of list in sorted order(with replacement) is:
[(1, 1), (1, 2), (2, 2)]
All the combination of container in sorted order(with replacement) is:
[(0, ), (1, )]Terminating iterators
Terminating iterators are used to work on the short input sequences and produce the output based on the functionality of the method used.
Different types of terminating iterators are:
accumulate(iter, func): This iterator takes two arguments, iterable target and the function which would be followed at each iteration of value in target. If no function is passed, addition takes place by default. If the input iterable is empty, the output iterable will also be empty.Example:
Python3
# Python code to demonstrate the working of # accumulate() import itertoolsimport operator # initializing list 1li1 = [1, 4, 5, 7] # using accumulate()# prints the successive summation of elementsprint ("The sum after each iteration is : ", end ="")print (list(itertools.accumulate(li1))) # using accumulate()# prints the successive multiplication of elementsprint ("The product after each iteration is : ", end ="")print (list(itertools.accumulate(li1, operator.mul))) # using accumulate()# prints the successive summation of elementsprint ("The sum after each iteration is : ", end ="")print (list(itertools.accumulate(li1))) # using accumulate()# prints the successive multiplication of elementsprint ("The product after each iteration is : ", end ="")print (list(itertools.accumulate(li1, operator.mul)))
Output:
The sum after each iteration is : [1, 5, 10, 17]
The product after each iteration is : [1, 4, 20, 140]
The sum after each iteration is : [1, 5, 10, 17]
The product after each iteration is : [1, 4, 20, 140]
chain(iter1, iter2..): This function is used to print all the values in iterable targets one after another mentioned in its arguments.Example:
Python3
# Python code to demonstrate the working of # and chain() import itertools # initializing list 1li1 = [1, 4, 5, 7] # initializing list 2li2 = [1, 6, 5, 9] # initializing list 3li3 = [8, 10, 5, 4] # using chain() to print all elements of listsprint ("All values in mentioned chain are : ", end ="")print (list(itertools.chain(li1, li2, li3)))
Output:
All values in mentioned chain are : [1, 4, 5, 7, 1, 6, 5, 9, 8, 10, 5, 4]
chain.from_iterable(): This function is implemented similarly as a chain() but the argument here is a list of lists or any other iterable container.Example:
Python3
# Python code to demonstrate the working of # chain.from_iterable() import itertools # initializing list 1li1 = [1, 4, 5, 7] # initializing list 2li2 = [1, 6, 5, 9] # initializing list 3li3 = [8, 10, 5, 4] # initializing list of listli4 = [li1, li2, li3] # using chain.from_iterable() to print all elements of listsprint ("All values in mentioned chain are : ", end ="")print (list(itertools.chain.from_iterable(li4)))
Output:
All values in mentioned chain are : [1, 4, 5, 7, 1, 6, 5, 9, 8, 10, 5, 4]
compress(iter, selector): This iterator selectively picks the values to print from the passed container according to the boolean list value passed as other arguments. The arguments corresponding to boolean true are printed else all are skipped.Example:
Python3
# Python code to demonstrate the working of # and compress() import itertools # using compress() selectively print data valuesprint ("The compressed values in string are : ", end ="")print (list(itertools.compress('GEEKSFORGEEKS', [1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0])))
Output:
The compressed values in string are : ['G', 'F', 'G']
dropwhile(func, seq): This iterator starts printing the characters only after the func. in argument returns false for the first time.Example:
Python3
# Python code to demonstrate the working of # dropwhile() import itertools # initializing list li = [2, 4, 5, 7, 8] # using dropwhile() to start displaying after condition is falseprint ("The values after condition returns false : ", end ="")print (list(itertools.dropwhile(lambda x : x % 2 == 0, li)))
Output:
The values after condition returns false : [5, 7, 8]
filterfalse(func, seq): As the name suggests, this iterator prints only values that return false for the passed function.Example:
Python3
# Python code to demonstrate the working of # filterfalse() import itertools # initializing list li = [2, 4, 5, 7, 8] # using filterfalse() to print false valuesprint ("The values that return false to function are : ", end ="")print (list(itertools.filterfalse(lambda x : x % 2 == 0, li)))
Output:
The values that return false to function are : [5, 7]
islice(iterable, start, stop, step): This iterator selectively prints the values mentioned in its iterable container passed as argument. This iterator takes 4 arguments, iterable container, starting pos., ending position and step.Example:
Python3
# Python code to demonstrate the working of # islice() import itertools # initializing list li = [2, 4, 5, 7, 8, 10, 20] # using islice() to slice the list acc. to need# starts printing from 2nd index till 6th skipping 2print ("The sliced list values are : ", end ="")print (list(itertools.islice(li, 1, 6, 2)))
Output:
The sliced list values are : [4, 7, 10]
starmap(func., tuple list): This iterator takes a function and tuple list as argument and returns the value according to the function from each tuple of the list.Example:
Python3
# Python code to demonstrate the working of # starmap() import itertools # initializing tuple listli = [ (1, 10, 5), (8, 4, 1), (5, 4, 9), (11, 10, 1) ] # using starmap() for selection value acc. to function# selects min of all tuple valuesprint ("The values acc. to function are : ", end ="")print (list(itertools.starmap(min, li)))
Output:
The values acc. to function are : [1, 1, 4, 1]
takewhile(func, iterable): This iterator is the opposite of dropwhile(), it prints the values till the function returns false for 1st time.Example:
Python3
# Python code to demonstrate the working of # takewhile() import itertools # initializing list li = [2, 4, 6, 7, 8, 10, 20] # using takewhile() to print values till condition is false.print ("The list values till 1st false value are : ", end ="")print (list(itertools.takewhile(lambda x : x % 2 == 0, li )))
Output:
The list values till 1st false value are : [2, 4, 6]
tee(iterator, count):- This iterator splits the container into a number of iterators mentioned in the argument.Example:
Python3
# Python code to demonstrate the working of # tee() import itertools # initializing list li = [2, 4, 6, 7, 8, 10, 20] # storing list in iteratoriti = iter(li) # using tee() to make a list of iterators# makes list of 3 iterators having same values.it = itertools.tee(iti, 3) # printing the values of iteratorsprint ("The iterators are : ")for i in range (0, 3): print (list(it[i]))
Output:
The iterators are :
[2, 4, 6, 7, 8, 10, 20]
[2, 4, 6, 7, 8, 10, 20]
[2, 4, 6, 7, 8, 10, 20]
zip_longest( iterable1, iterable2, fillval): This iterator prints the values of iterables alternatively in sequence. If one of the iterables is printed fully, the remaining values are filled by the values assigned to fillvalue.Example:
Python3
# Python code to demonstrate the working of # zip_longest() import itertools # using zip_longest() to combine two iterables.print ("The combined values of iterables is : ")print (*(itertools.zip_longest('GesoGes', 'ekfrek', fillvalue ='_' )))
Output:
The combined values of iterables is :
('G', 'e') ('e', 'k') ('s', 'f') ('o', 'r') ('G', 'e') ('e', 'k') ('s', '_')
simranarora5sos
surindertarika1234
sg4ipiafwot258z3lh6xa2mjq2qtxd89f49zgt7g
Python-itertools
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Read a file line by line in Python
How to Install PIP on Windows ?
Different ways to create Pandas Dataframe
Python String | replace()
*args and **kwargs in Python
Reading and Writing to text files in Python
Create a Pandas DataFrame from Lists
Convert integer to string in Python
Check if element exists in list in Python | [
{
"code": null,
"e": 25757,
"s": 25729,
"text": "\n13 Sep, 2021"
},
{
"code": null,
"e": 26489,
"s": 25757,
"text": "Python’s Itertool is a module that provides various functions that work on iterators to produce complex iterators. This module works as a fast, memory-efficient tool that is used either by themselves or in combination to form iterator algebra. For example, let’s suppose there are two lists and you want to multiply their elements. There can be several ways of achieving this. One can be using the naive approach i.e by iterating through the elements of both the list simultaneously and multiply them. And another approach can be using the map function i.e by passing the mul operator as a first parameter to the map function and Lists as the second and third parameter to this function. Let’s see the time taken by each approach. "
},
{
"code": null,
"e": 26497,
"s": 26489,
"text": "Python3"
},
{
"code": "# Python program to demonstrate# iterator module import operatorimport time # Defining listsL1 = [1, 2, 3]L2 = [2, 3, 4] # Starting time before map# functiont1 = time.time() # Calculating resulta, b, c = map(operator.mul, L1, L2) # Ending time after map# functiont2 = time.time() # Time taken by map functionprint(\"Result:\", a, b, c)print(\"Time taken by map function: %.6f\" %(t2 - t1)) # Starting time before naive# methodt1 = time.time() # Calculating result using for loopprint(\"Result:\", end = \" \")for i in range(3): print(L1[i] * L2[i], end = \" \") # Ending time after naive# methodt2 = time.time()print(\"\\nTime taken by for loop: %.6f\" %(t2 - t1))",
"e": 27157,
"s": 26497,
"text": null
},
{
"code": null,
"e": 27165,
"s": 27157,
"text": "Output:"
},
{
"code": null,
"e": 27266,
"s": 27165,
"text": "Result: 2 6 12\nTime taken by map function: 0.000005\nResult: 2 6 12 \nTime taken by for loop: 0.000014"
},
{
"code": null,
"e": 27458,
"s": 27266,
"text": "In the above example, it can be seen that the time taken by the map function is approximately half than the time taken by for loop. This shows that itertools are fast, memory-efficient tools."
},
{
"code": null,
"e": 27517,
"s": 27458,
"text": "Different types of iterators provided by this module are: "
},
{
"code": null,
"e": 27536,
"s": 27517,
"text": "Infinite iterators"
},
{
"code": null,
"e": 27559,
"s": 27536,
"text": "Combinatoric iterators"
},
{
"code": null,
"e": 27581,
"s": 27559,
"text": "Terminating iterators"
},
{
"code": null,
"e": 27893,
"s": 27581,
"text": "Iterator in Python is any Python type that can be used with a ‘for in loop’. Python lists, tuples, dictionaries, and sets are all examples of inbuilt iterators. But it is not necessary that an iterator object has to exhaust, sometimes it can be infinite. Such types of iterators are known as Infinite iterators."
},
{
"code": null,
"e": 27945,
"s": 27893,
"text": "Python provides three types of infinite iterators: "
},
{
"code": null,
"e": 28177,
"s": 27945,
"text": "count(start, step): This iterator starts printing from the “start” number and prints infinitely. If steps are mentioned, the numbers are skipped else step is 1 by default. See the below example for its use with for in loop.Example:"
},
{
"code": null,
"e": 28185,
"s": 28177,
"text": "Python3"
},
{
"code": "# Python program to demonstrate# infinite iterators import itertools # for in loopfor i in itertools.count(5, 5): if i == 35: break else: print(i, end =\" \")",
"e": 28366,
"s": 28185,
"text": null
},
{
"code": null,
"e": 28374,
"s": 28366,
"text": "Output:"
},
{
"code": null,
"e": 28391,
"s": 28374,
"text": "5 10 15 20 25 30"
},
{
"code": null,
"e": 28582,
"s": 28391,
"text": "cycle(iterable): This iterator prints all values in order from the passed container. It restarts printing from the beginning again when all elements are printed in a cyclic manner.Example 1:"
},
{
"code": null,
"e": 28590,
"s": 28582,
"text": "Python3"
},
{
"code": "# Python program to demonstrate# infinite iterators import itertools count = 0 # for in loopfor i in itertools.cycle('AB'): if count > 7: break else: print(i, end = \" \") count += 1",
"e": 28804,
"s": 28590,
"text": null
},
{
"code": null,
"e": 28812,
"s": 28804,
"text": "Output:"
},
{
"code": null,
"e": 28829,
"s": 28812,
"text": "A B A B A B A B "
},
{
"code": null,
"e": 28865,
"s": 28829,
"text": "Example 2: Using the next function."
},
{
"code": null,
"e": 28873,
"s": 28865,
"text": "Python3"
},
{
"code": "# Python program to demonstrate# infinite iterators import itertools l = ['Geeks', 'for', 'Geeks'] # defining iteratoriterators = itertools.cycle(l) # for in loopfor i in range(6): # Using next function print(next(iterators), end = \" \")",
"e": 29131,
"s": 28873,
"text": null
},
{
"code": null,
"e": 29162,
"s": 29131,
"text": "Combinatoric iterators Output:"
},
{
"code": null,
"e": 29195,
"s": 29162,
"text": "Geeks for Geeks Geeks for Geeks "
},
{
"code": null,
"e": 29388,
"s": 29195,
"text": "repeat(val, num): This iterator repeatedly prints the passed value an infinite number of times. If the optional keyword num is mentioned, then it repeatedly prints num number of times.Example:"
},
{
"code": null,
"e": 29396,
"s": 29388,
"text": "Python3"
},
{
"code": "# Python code to demonstrate the working of # repeat() # importing \"itertools\" for iterator operations import itertools # using repeat() to repeatedly print number print (\"Printing the numbers repeatedly : \") print (list(itertools.repeat(25, 4)))",
"e": 29654,
"s": 29396,
"text": null
},
{
"code": null,
"e": 29662,
"s": 29654,
"text": "Output:"
},
{
"code": null,
"e": 29714,
"s": 29662,
"text": "Printing the numbers repeatedly : \n[25, 25, 25, 25]"
},
{
"code": null,
"e": 29930,
"s": 29714,
"text": "The recursive generators that are used to simplify combinatorial constructs such as permutations, combinations, and Cartesian products are called combinatoric iterators.In Python there are 4 combinatoric iterators: "
},
{
"code": null,
"e": 30198,
"s": 29930,
"text": "Product(): This tool computes the cartesian product of input iterables. To compute the product of an iterable with itself, we use the optional repeat keyword argument to specify the number of repetitions. The output of this function is tuples in sorted order.Example:"
},
{
"code": null,
"e": 30206,
"s": 30198,
"text": "Python3"
},
{
"code": "# import the product function from itertools modulefrom itertools import product print(\"The cartesian product using repeat:\")print(list(product([1, 2], repeat = 2)))print() print(\"The cartesian product of the containers:\")print(list(product(['geeks', 'for', 'geeks'], '2')))print() print(\"The cartesian product of the containers:\")print(list(product('AB', [3, 4])))",
"e": 30578,
"s": 30206,
"text": null
},
{
"code": null,
"e": 30586,
"s": 30578,
"text": "Output:"
},
{
"code": null,
"e": 30827,
"s": 30586,
"text": "The cartesian product using repeat:\n[(1, 1), (1, 2), (2, 1), (2, 2)]\n\nThe cartesian product of the containers:\n[('geeks', '2'), ('for', '2'), ('geeks', '2')]\n\nThe cartesian product of the containers:\n[('A', 3), ('A', 4), ('B', 3), ('B', 4)]"
},
{
"code": null,
"e": 31216,
"s": 30827,
"text": "Permutations(): Permutations() as the name speaks for itself is used to generate all possible permutations of an iterable. All elements are treated as unique based on their position and not their values. This function takes an iterable and group_size, if the value of group_size is not specified or is equal to None then the value of group_size becomes the length of the iterable.Example:"
},
{
"code": null,
"e": 31224,
"s": 31216,
"text": "Python3"
},
{
"code": "# import the product function from itertools modulefrom itertools import permutations print (\"All the permutations of the given list is:\") print (list(permutations([1, 'geeks'], 2)))print() Terminating iteratorsprint (\"All the permutations of the given string is:\") print (list(permutations('AB')))print() print (\"All the permutations of the given container is:\") print(list(permutations(range(3), 2)))",
"e": 31632,
"s": 31224,
"text": null
},
{
"code": null,
"e": 31640,
"s": 31632,
"text": "Output:"
},
{
"code": null,
"e": 31881,
"s": 31640,
"text": "All the permutations of the given list is:\n[(1, 'geeks'), ('geeks', 1)]\n\nAll the permutations of the given string is:\n[('A', 'B'), ('B', 'A')]\n\nAll the permutations of the given container is:\n[(0, 1), (0, 2), (1, 0), (1, 2), (2, 0), (2, 1)]"
},
{
"code": null,
"e": 32059,
"s": 31881,
"text": "Combinations(): This iterator prints all the possible combinations(without replacement) of the container passed in arguments in the specified group size in sorted order.Example:"
},
{
"code": null,
"e": 32067,
"s": 32059,
"text": "Python3"
},
{
"code": "# import combinations from itertools module from itertools import combinations print (\"All the combination of list in sorted order(without replacement) is:\") print(list(combinations(['A', 2], 2)))print() print (\"All the combination of string in sorted order(without replacement) is:\")print(list(combinations('AB', 2)))print() print (\"All the combination of list in sorted order(without replacement) is:\")print(list(combinations(range(2), 1)))",
"e": 32518,
"s": 32067,
"text": null
},
{
"code": null,
"e": 32526,
"s": 32518,
"text": "Output:"
},
{
"code": null,
"e": 32776,
"s": 32526,
"text": "All the combination of list in sorted order(without replacement) is:\n[('A', 2)]\n\nAll the combination of string in sorted order(without replacement) is:\n[('A', 'B')]\n\nAll the combination of list in sorted order(without replacement) is:\n[(0, ), (1, )]"
},
{
"code": null,
"e": 33098,
"s": 32776,
"text": "Combinations_with_replacement(): This function returns a subsequence of length n from the elements of the iterable where n is the argument that the function takes determining the length of the subsequences generated by the function. Individual elements may repeat itself in combinations_with_replacement function.Example:"
},
{
"code": null,
"e": 33106,
"s": 33098,
"text": "Python3"
},
{
"code": "# import combinations from itertools module from itertools import combinations_with_replacement print (\"All the combination of string in sorted order(with replacement) is:\")print(list(combinations_with_replacement(\"AB\", 2)))print() print (\"All the combination of list in sorted order(with replacement) is:\")print(list(combinations_with_replacement([1, 2], 2)))print() print (\"All the combination of container in sorted order(with replacement) is:\")print(list(combinations_with_replacement(range(2), 1)))",
"e": 33618,
"s": 33106,
"text": null
},
{
"code": null,
"e": 33626,
"s": 33618,
"text": "Output:"
},
{
"code": null,
"e": 33931,
"s": 33626,
"text": "All the combination of string in sorted order(with replacement) is:\n[('A', 'A'), ('A', 'B'), ('B', 'B')]\n\nAll the combination of list in sorted order(with replacement) is:\n[(1, 1), (1, 2), (2, 2)]\n\nAll the combination of container in sorted order(with replacement) is:\n[(0, ), (1, )]Terminating iterators"
},
{
"code": null,
"e": 34069,
"s": 33931,
"text": "Terminating iterators are used to work on the short input sequences and produce the output based on the functionality of the method used."
},
{
"code": null,
"e": 34116,
"s": 34069,
"text": "Different types of terminating iterators are: "
},
{
"code": null,
"e": 34409,
"s": 34116,
"text": "accumulate(iter, func): This iterator takes two arguments, iterable target and the function which would be followed at each iteration of value in target. If no function is passed, addition takes place by default. If the input iterable is empty, the output iterable will also be empty.Example:"
},
{
"code": null,
"e": 34417,
"s": 34409,
"text": "Python3"
},
{
"code": "# Python code to demonstrate the working of # accumulate() import itertoolsimport operator # initializing list 1li1 = [1, 4, 5, 7] # using accumulate()# prints the successive summation of elementsprint (\"The sum after each iteration is : \", end =\"\")print (list(itertools.accumulate(li1))) # using accumulate()# prints the successive multiplication of elementsprint (\"The product after each iteration is : \", end =\"\")print (list(itertools.accumulate(li1, operator.mul))) # using accumulate()# prints the successive summation of elementsprint (\"The sum after each iteration is : \", end =\"\")print (list(itertools.accumulate(li1))) # using accumulate()# prints the successive multiplication of elementsprint (\"The product after each iteration is : \", end =\"\")print (list(itertools.accumulate(li1, operator.mul)))",
"e": 35235,
"s": 34417,
"text": null
},
{
"code": null,
"e": 35243,
"s": 35235,
"text": "Output:"
},
{
"code": null,
"e": 35449,
"s": 35243,
"text": "The sum after each iteration is : [1, 5, 10, 17]\nThe product after each iteration is : [1, 4, 20, 140]\nThe sum after each iteration is : [1, 5, 10, 17]\nThe product after each iteration is : [1, 4, 20, 140]"
},
{
"code": null,
"e": 35592,
"s": 35449,
"text": "chain(iter1, iter2..): This function is used to print all the values in iterable targets one after another mentioned in its arguments.Example:"
},
{
"code": null,
"e": 35600,
"s": 35592,
"text": "Python3"
},
{
"code": "# Python code to demonstrate the working of # and chain() import itertools # initializing list 1li1 = [1, 4, 5, 7] # initializing list 2li2 = [1, 6, 5, 9] # initializing list 3li3 = [8, 10, 5, 4] # using chain() to print all elements of listsprint (\"All values in mentioned chain are : \", end =\"\")print (list(itertools.chain(li1, li2, li3)))",
"e": 35949,
"s": 35600,
"text": null
},
{
"code": null,
"e": 35957,
"s": 35949,
"text": "Output:"
},
{
"code": null,
"e": 36031,
"s": 35957,
"text": "All values in mentioned chain are : [1, 4, 5, 7, 1, 6, 5, 9, 8, 10, 5, 4]"
},
{
"code": null,
"e": 36188,
"s": 36031,
"text": "chain.from_iterable(): This function is implemented similarly as a chain() but the argument here is a list of lists or any other iterable container.Example:"
},
{
"code": null,
"e": 36196,
"s": 36188,
"text": "Python3"
},
{
"code": "# Python code to demonstrate the working of # chain.from_iterable() import itertools # initializing list 1li1 = [1, 4, 5, 7] # initializing list 2li2 = [1, 6, 5, 9] # initializing list 3li3 = [8, 10, 5, 4] # initializing list of listli4 = [li1, li2, li3] # using chain.from_iterable() to print all elements of listsprint (\"All values in mentioned chain are : \", end =\"\")print (list(itertools.chain.from_iterable(li4)))",
"e": 36623,
"s": 36196,
"text": null
},
{
"code": null,
"e": 36631,
"s": 36623,
"text": "Output:"
},
{
"code": null,
"e": 36705,
"s": 36631,
"text": "All values in mentioned chain are : [1, 4, 5, 7, 1, 6, 5, 9, 8, 10, 5, 4]"
},
{
"code": null,
"e": 36958,
"s": 36705,
"text": "compress(iter, selector): This iterator selectively picks the values to print from the passed container according to the boolean list value passed as other arguments. The arguments corresponding to boolean true are printed else all are skipped.Example:"
},
{
"code": null,
"e": 36966,
"s": 36958,
"text": "Python3"
},
{
"code": "# Python code to demonstrate the working of # and compress() import itertools # using compress() selectively print data valuesprint (\"The compressed values in string are : \", end =\"\")print (list(itertools.compress('GEEKSFORGEEKS', [1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0])))",
"e": 37242,
"s": 36966,
"text": null
},
{
"code": null,
"e": 37250,
"s": 37242,
"text": "Output:"
},
{
"code": null,
"e": 37304,
"s": 37250,
"text": "The compressed values in string are : ['G', 'F', 'G']"
},
{
"code": null,
"e": 37446,
"s": 37304,
"text": "dropwhile(func, seq): This iterator starts printing the characters only after the func. in argument returns false for the first time.Example:"
},
{
"code": null,
"e": 37454,
"s": 37446,
"text": "Python3"
},
{
"code": "# Python code to demonstrate the working of # dropwhile() import itertools # initializing list li = [2, 4, 5, 7, 8] # using dropwhile() to start displaying after condition is falseprint (\"The values after condition returns false : \", end =\"\")print (list(itertools.dropwhile(lambda x : x % 2 == 0, li)))",
"e": 37761,
"s": 37454,
"text": null
},
{
"code": null,
"e": 37769,
"s": 37761,
"text": "Output:"
},
{
"code": null,
"e": 37822,
"s": 37769,
"text": "The values after condition returns false : [5, 7, 8]"
},
{
"code": null,
"e": 37952,
"s": 37822,
"text": "filterfalse(func, seq): As the name suggests, this iterator prints only values that return false for the passed function.Example:"
},
{
"code": null,
"e": 37960,
"s": 37952,
"text": "Python3"
},
{
"code": "# Python code to demonstrate the working of # filterfalse() import itertools # initializing list li = [2, 4, 5, 7, 8] # using filterfalse() to print false valuesprint (\"The values that return false to function are : \", end =\"\")print (list(itertools.filterfalse(lambda x : x % 2 == 0, li)))",
"e": 38255,
"s": 37960,
"text": null
},
{
"code": null,
"e": 38263,
"s": 38255,
"text": "Output:"
},
{
"code": null,
"e": 38317,
"s": 38263,
"text": "The values that return false to function are : [5, 7]"
},
{
"code": null,
"e": 38556,
"s": 38317,
"text": "islice(iterable, start, stop, step): This iterator selectively prints the values mentioned in its iterable container passed as argument. This iterator takes 4 arguments, iterable container, starting pos., ending position and step.Example:"
},
{
"code": null,
"e": 38564,
"s": 38556,
"text": "Python3"
},
{
"code": "# Python code to demonstrate the working of # islice() import itertools # initializing list li = [2, 4, 5, 7, 8, 10, 20] # using islice() to slice the list acc. to need# starts printing from 2nd index till 6th skipping 2print (\"The sliced list values are : \", end =\"\")print (list(itertools.islice(li, 1, 6, 2)))",
"e": 38886,
"s": 38564,
"text": null
},
{
"code": null,
"e": 38894,
"s": 38886,
"text": "Output:"
},
{
"code": null,
"e": 38934,
"s": 38894,
"text": "The sliced list values are : [4, 7, 10]"
},
{
"code": null,
"e": 39105,
"s": 38934,
"text": "starmap(func., tuple list): This iterator takes a function and tuple list as argument and returns the value according to the function from each tuple of the list.Example:"
},
{
"code": null,
"e": 39113,
"s": 39105,
"text": "Python3"
},
{
"code": "# Python code to demonstrate the working of # starmap() import itertools # initializing tuple listli = [ (1, 10, 5), (8, 4, 1), (5, 4, 9), (11, 10, 1) ] # using starmap() for selection value acc. to function# selects min of all tuple valuesprint (\"The values acc. to function are : \", end =\"\")print (list(itertools.starmap(min, li)))",
"e": 39457,
"s": 39113,
"text": null
},
{
"code": null,
"e": 39465,
"s": 39457,
"text": "Output:"
},
{
"code": null,
"e": 39512,
"s": 39465,
"text": "The values acc. to function are : [1, 1, 4, 1]"
},
{
"code": null,
"e": 39660,
"s": 39512,
"text": "takewhile(func, iterable): This iterator is the opposite of dropwhile(), it prints the values till the function returns false for 1st time.Example:"
},
{
"code": null,
"e": 39668,
"s": 39660,
"text": "Python3"
},
{
"code": "# Python code to demonstrate the working of # takewhile() import itertools # initializing list li = [2, 4, 6, 7, 8, 10, 20] # using takewhile() to print values till condition is false.print (\"The list values till 1st false value are : \", end =\"\")print (list(itertools.takewhile(lambda x : x % 2 == 0, li )))",
"e": 39983,
"s": 39668,
"text": null
},
{
"code": null,
"e": 39991,
"s": 39983,
"text": "Output:"
},
{
"code": null,
"e": 40044,
"s": 39991,
"text": "The list values till 1st false value are : [2, 4, 6]"
},
{
"code": null,
"e": 40164,
"s": 40044,
"text": "tee(iterator, count):- This iterator splits the container into a number of iterators mentioned in the argument.Example:"
},
{
"code": null,
"e": 40172,
"s": 40164,
"text": "Python3"
},
{
"code": "# Python code to demonstrate the working of # tee() import itertools # initializing list li = [2, 4, 6, 7, 8, 10, 20] # storing list in iteratoriti = iter(li) # using tee() to make a list of iterators# makes list of 3 iterators having same values.it = itertools.tee(iti, 3) # printing the values of iteratorsprint (\"The iterators are : \")for i in range (0, 3): print (list(it[i]))",
"e": 40568,
"s": 40172,
"text": null
},
{
"code": null,
"e": 40576,
"s": 40568,
"text": "Output:"
},
{
"code": null,
"e": 40669,
"s": 40576,
"text": "The iterators are : \n[2, 4, 6, 7, 8, 10, 20]\n[2, 4, 6, 7, 8, 10, 20]\n[2, 4, 6, 7, 8, 10, 20]"
},
{
"code": null,
"e": 40905,
"s": 40669,
"text": "zip_longest( iterable1, iterable2, fillval): This iterator prints the values of iterables alternatively in sequence. If one of the iterables is printed fully, the remaining values are filled by the values assigned to fillvalue.Example:"
},
{
"code": null,
"e": 40913,
"s": 40905,
"text": "Python3"
},
{
"code": "# Python code to demonstrate the working of # zip_longest() import itertools # using zip_longest() to combine two iterables.print (\"The combined values of iterables is : \")print (*(itertools.zip_longest('GesoGes', 'ekfrek', fillvalue ='_' )))",
"e": 41162,
"s": 40913,
"text": null
},
{
"code": null,
"e": 41170,
"s": 41162,
"text": "Output:"
},
{
"code": null,
"e": 41287,
"s": 41170,
"text": "The combined values of iterables is : \n('G', 'e') ('e', 'k') ('s', 'f') ('o', 'r') ('G', 'e') ('e', 'k') ('s', '_')"
},
{
"code": null,
"e": 41307,
"s": 41291,
"text": "simranarora5sos"
},
{
"code": null,
"e": 41326,
"s": 41307,
"text": "surindertarika1234"
},
{
"code": null,
"e": 41367,
"s": 41326,
"text": "sg4ipiafwot258z3lh6xa2mjq2qtxd89f49zgt7g"
},
{
"code": null,
"e": 41384,
"s": 41367,
"text": "Python-itertools"
},
{
"code": null,
"e": 41391,
"s": 41384,
"text": "Python"
},
{
"code": null,
"e": 41489,
"s": 41391,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 41507,
"s": 41489,
"text": "Python Dictionary"
},
{
"code": null,
"e": 41542,
"s": 41507,
"text": "Read a file line by line in Python"
},
{
"code": null,
"e": 41574,
"s": 41542,
"text": "How to Install PIP on Windows ?"
},
{
"code": null,
"e": 41616,
"s": 41574,
"text": "Different ways to create Pandas Dataframe"
},
{
"code": null,
"e": 41642,
"s": 41616,
"text": "Python String | replace()"
},
{
"code": null,
"e": 41671,
"s": 41642,
"text": "*args and **kwargs in Python"
},
{
"code": null,
"e": 41715,
"s": 41671,
"text": "Reading and Writing to text files in Python"
},
{
"code": null,
"e": 41752,
"s": 41715,
"text": "Create a Pandas DataFrame from Lists"
},
{
"code": null,
"e": 41788,
"s": 41752,
"text": "Convert integer to string in Python"
}
] |
Hashtable size() Method in Java - GeeksforGeeks | 28 Jun, 2018
The java.util.Hashtable.size() method of Hashtable class is used to get the size of the table which refers to the number of the key-value pair or mappings in the Table.
Syntax:
Hash_Table.size()
Parameters: The method does not take any parameters.
Return Value: The method returns the size of the table which also means the number of key-value pairs present in the table.
Below programs illustrates the working of java.util.Hashtable.size():Program 1:
// Java code to illustrate the size() methodimport java.util.*; public class Hash_Table_Demo { public static void main(String[] args) { // Creating an empty Hashtable Hashtable<Integer, String> hash_table = new Hashtable<Integer, String>(); // Inserting elements into the table hash_table.put(10, "Geeks"); hash_table.put(15, "4"); hash_table.put(20, "Geeks"); hash_table.put(25, "Welcomes"); hash_table.put(30, "You"); // Displaying the Hashtable System.out.println("Initial table is: " + hash_table); // Displaying the size of the table System.out.println("The size of the table is " + hash_table.size()); }}
Initial table is: {10=Geeks, 20=Geeks, 30=You, 15=4, 25=Welcomes}
The size of the table is 5
Program 2:
// Java code to illustrate the size() methodimport java.util.*; public class Hash_Table_Demo { public static void main(String[] args) { // Creating an empty Hashtable Hashtable<String, Integer> hash_table = new Hashtable<String, Integer>(); // Inserting elements into the table hash_table.put("Geeks", 10); hash_table.put("4", 15); hash_table.put("Geeks", 20); hash_table.put("Welcomes", 25); hash_table.put("You", 30); // Displaying the Hashtable System.out.println("Initial Table is: " + hash_table); // Displaying the size of the table System.out.println("The size of the table is " + hash_table.size()); }}
Initial Table is: {You=30, Welcomes=25, 4=15, Geeks=20}
The size of the table is 4
Note: The same operation can be performed with any type of variation and combination of different data types.
Java-HashTable
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Arrays in Java
Split() String method in Java with examples
For-each loop in Java
Object Oriented Programming (OOPs) Concept in Java
Arrays.sort() in Java with examples
Reverse a string in Java
HashMap in Java with Examples
Interfaces in Java
Stream In Java
How to iterate any Map in Java | [
{
"code": null,
"e": 24813,
"s": 24785,
"text": "\n28 Jun, 2018"
},
{
"code": null,
"e": 24982,
"s": 24813,
"text": "The java.util.Hashtable.size() method of Hashtable class is used to get the size of the table which refers to the number of the key-value pair or mappings in the Table."
},
{
"code": null,
"e": 24990,
"s": 24982,
"text": "Syntax:"
},
{
"code": null,
"e": 25008,
"s": 24990,
"text": "Hash_Table.size()"
},
{
"code": null,
"e": 25061,
"s": 25008,
"text": "Parameters: The method does not take any parameters."
},
{
"code": null,
"e": 25185,
"s": 25061,
"text": "Return Value: The method returns the size of the table which also means the number of key-value pairs present in the table."
},
{
"code": null,
"e": 25265,
"s": 25185,
"text": "Below programs illustrates the working of java.util.Hashtable.size():Program 1:"
},
{
"code": "// Java code to illustrate the size() methodimport java.util.*; public class Hash_Table_Demo { public static void main(String[] args) { // Creating an empty Hashtable Hashtable<Integer, String> hash_table = new Hashtable<Integer, String>(); // Inserting elements into the table hash_table.put(10, \"Geeks\"); hash_table.put(15, \"4\"); hash_table.put(20, \"Geeks\"); hash_table.put(25, \"Welcomes\"); hash_table.put(30, \"You\"); // Displaying the Hashtable System.out.println(\"Initial table is: \" + hash_table); // Displaying the size of the table System.out.println(\"The size of the table is \" + hash_table.size()); }}",
"e": 25994,
"s": 25265,
"text": null
},
{
"code": null,
"e": 26088,
"s": 25994,
"text": "Initial table is: {10=Geeks, 20=Geeks, 30=You, 15=4, 25=Welcomes}\nThe size of the table is 5\n"
},
{
"code": null,
"e": 26099,
"s": 26088,
"text": "Program 2:"
},
{
"code": "// Java code to illustrate the size() methodimport java.util.*; public class Hash_Table_Demo { public static void main(String[] args) { // Creating an empty Hashtable Hashtable<String, Integer> hash_table = new Hashtable<String, Integer>(); // Inserting elements into the table hash_table.put(\"Geeks\", 10); hash_table.put(\"4\", 15); hash_table.put(\"Geeks\", 20); hash_table.put(\"Welcomes\", 25); hash_table.put(\"You\", 30); // Displaying the Hashtable System.out.println(\"Initial Table is: \" + hash_table); // Displaying the size of the table System.out.println(\"The size of the table is \" + hash_table.size()); }}",
"e": 26828,
"s": 26099,
"text": null
},
{
"code": null,
"e": 26912,
"s": 26828,
"text": "Initial Table is: {You=30, Welcomes=25, 4=15, Geeks=20}\nThe size of the table is 4\n"
},
{
"code": null,
"e": 27022,
"s": 26912,
"text": "Note: The same operation can be performed with any type of variation and combination of different data types."
},
{
"code": null,
"e": 27037,
"s": 27022,
"text": "Java-HashTable"
},
{
"code": null,
"e": 27042,
"s": 27037,
"text": "Java"
},
{
"code": null,
"e": 27047,
"s": 27042,
"text": "Java"
},
{
"code": null,
"e": 27145,
"s": 27047,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 27160,
"s": 27145,
"text": "Arrays in Java"
},
{
"code": null,
"e": 27204,
"s": 27160,
"text": "Split() String method in Java with examples"
},
{
"code": null,
"e": 27226,
"s": 27204,
"text": "For-each loop in Java"
},
{
"code": null,
"e": 27277,
"s": 27226,
"text": "Object Oriented Programming (OOPs) Concept in Java"
},
{
"code": null,
"e": 27313,
"s": 27277,
"text": "Arrays.sort() in Java with examples"
},
{
"code": null,
"e": 27338,
"s": 27313,
"text": "Reverse a string in Java"
},
{
"code": null,
"e": 27368,
"s": 27338,
"text": "HashMap in Java with Examples"
},
{
"code": null,
"e": 27387,
"s": 27368,
"text": "Interfaces in Java"
},
{
"code": null,
"e": 27402,
"s": 27387,
"text": "Stream In Java"
}
] |
How to Create Group BarChart in Android? - GeeksforGeeks | 01 Feb, 2021
As we have seen how we can create a beautiful bar chart in Android but what if we have to represent data in the form of groups in our bar chart. So that we can plot a group of data in our bar chart. So we will be creating a Group Bar Chart in our Android app in this article.
We will be building a simple application in which we will be displaying a bar chart with multiple sets of data in our Android application. We will display the data in the form of the group in our bar chart. A sample GIF is given below to get an idea about what we are going to do in this article. Note that we are going to implement this project using the Java language.
Step 1: Create a New Project
To create a new project in Android Studio please refer to How to Create/Start a New Project in Android Studio. Note that select Java as the programming language.
Step 2: Add dependency and JitPack Repository
Navigate to the Gradle Scripts > build.gradle(Module:app) and add the below dependency in the dependencies section.
implementation ‘com.github.PhilJay:MPAndroidChart:v3.1.0’
Add the JitPack repository to your build file. Add it to your root build.gradle at the end of repositories inside the allprojects{ } section.
allprojects {
repositories {
...
maven { url “https://jitpack.io” }
}
}
After adding this dependency sync your project and now we will move towards its implementation.
Step 3: Working with the activity_main.xml file
Navigate to the app > res > layout > activity_main.xml and add the below code to that file. Below is the code for the activity_main.xml file.
XML
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity"> <!--Ui component for our bar chart--> <com.github.mikephil.charting.charts.BarChart android:id="@+id/idBarChart" android:layout_width="match_parent" android:layout_height="match_parent" /> </RelativeLayout>
Step 4: Working with the MainActivity.java file
Go to the MainActivity.java file and refer to the following code. Below is the code for the MainActivity.java file. Comments are added inside the code to understand the code in more detail.
Java
import android.graphics.Color;import android.os.Bundle; import androidx.appcompat.app.AppCompatActivity; import com.github.mikephil.charting.charts.BarChart;import com.github.mikephil.charting.components.XAxis;import com.github.mikephil.charting.data.BarData;import com.github.mikephil.charting.data.BarDataSet;import com.github.mikephil.charting.data.BarEntry;import com.github.mikephil.charting.formatter.IndexAxisValueFormatter; import java.util.ArrayList; public class MainActivity extends AppCompatActivity { // variable for our bar chart BarChart barChart; // variable for our bar data set. BarDataSet barDataSet1, barDataSet2; // array list for storing entries. ArrayList barEntries; // creating a string array for displaying days. String[] days = new String[]{"Sunday", "Monday", "Tuesday", "Thursday", "Friday", "Saturday"}; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // initializing variable for bar chart. barChart = findViewById(R.id.idBarChart); // creating a new bar data set. barDataSet1 = new BarDataSet(getBarEntriesOne(), "First Set"); barDataSet1.setColor(getApplicationContext().getResources().getColor(R.color.purple_200)); barDataSet2 = new BarDataSet(getBarEntriesTwo(), "Second Set"); barDataSet2.setColor(Color.BLUE); // below line is to add bar data set to our bar data. BarData data = new BarData(barDataSet1, barDataSet2); // after adding data to our bar data we // are setting that data to our bar chart. barChart.setData(data); // below line is to remove description // label of our bar chart. barChart.getDescription().setEnabled(false); // below line is to get x axis // of our bar chart. XAxis xAxis = barChart.getXAxis(); // below line is to set value formatter to our x-axis and // we are adding our days to our x axis. xAxis.setValueFormatter(new IndexAxisValueFormatter(days)); // below line is to set center axis // labels to our bar chart. xAxis.setCenterAxisLabels(true); // below line is to set position // to our x-axis to bottom. xAxis.setPosition(XAxis.XAxisPosition.BOTTOM); // below line is to set granularity // to our x axis labels. xAxis.setGranularity(1); // below line is to enable // granularity to our x axis. xAxis.setGranularityEnabled(true); // below line is to make our // bar chart as draggable. barChart.setDragEnabled(true); // below line is to make visible // range for our bar chart. barChart.setVisibleXRangeMaximum(3); // below line is to add bar // space to our chart. float barSpace = 0.1f; // below line is use to add group // spacing to our bar chart. float groupSpace = 0.5f; // we are setting width of // bar in below line. data.setBarWidth(0.15f); // below line is to set minimum // axis to our chart. barChart.getXAxis().setAxisMinimum(0); // below line is to // animate our chart. barChart.animate(); // below line is to group bars // and add spacing to it. barChart.groupBars(0, groupSpace, barSpace); // below line is to invalidate // our bar chart. barChart.invalidate(); } // array list for first set private ArrayList<BarEntry> getBarEntriesOne() { // creating a new array list barEntries = new ArrayList<>(); // adding new entry to our array list with bar // entry and passing x and y axis value to it. barEntries.add(new BarEntry(1f, 4)); barEntries.add(new BarEntry(2f, 6)); barEntries.add(new BarEntry(3f, 8)); barEntries.add(new BarEntry(4f, 2)); barEntries.add(new BarEntry(5f, 4)); barEntries.add(new BarEntry(6f, 1)); return barEntries; } // array list for second set. private ArrayList<BarEntry> getBarEntriesTwo() { // creating a new array list barEntries = new ArrayList<>(); // adding new entry to our array list with bar // entry and passing x and y axis value to it. barEntries.add(new BarEntry(1f, 8)); barEntries.add(new BarEntry(2f, 12)); barEntries.add(new BarEntry(3f, 4)); barEntries.add(new BarEntry(4f, 1)); barEntries.add(new BarEntry(5f, 7)); barEntries.add(new BarEntry(6f, 3)); return barEntries; }}
Now run your app and see the output of the app.
android
Technical Scripter 2020
Android
Java
Technical Scripter
Java
Android
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Resource Raw Folder in Android Studio
Flutter - Custom Bottom Navigation Bar
How to Read Data from SQLite Database in Android?
How to Post Data to API using Retrofit in Android?
Retrofit with Kotlin Coroutine in Android
Arrays in Java
Split() String method in Java with examples
For-each loop in Java
Object Oriented Programming (OOPs) Concept in Java
Arrays.sort() in Java with examples | [
{
"code": null,
"e": 26381,
"s": 26353,
"text": "\n01 Feb, 2021"
},
{
"code": null,
"e": 26658,
"s": 26381,
"text": "As we have seen how we can create a beautiful bar chart in Android but what if we have to represent data in the form of groups in our bar chart. So that we can plot a group of data in our bar chart. So we will be creating a Group Bar Chart in our Android app in this article. "
},
{
"code": null,
"e": 27029,
"s": 26658,
"text": "We will be building a simple application in which we will be displaying a bar chart with multiple sets of data in our Android application. We will display the data in the form of the group in our bar chart. A sample GIF is given below to get an idea about what we are going to do in this article. Note that we are going to implement this project using the Java language."
},
{
"code": null,
"e": 27058,
"s": 27029,
"text": "Step 1: Create a New Project"
},
{
"code": null,
"e": 27220,
"s": 27058,
"text": "To create a new project in Android Studio please refer to How to Create/Start a New Project in Android Studio. Note that select Java as the programming language."
},
{
"code": null,
"e": 27266,
"s": 27220,
"text": "Step 2: Add dependency and JitPack Repository"
},
{
"code": null,
"e": 27385,
"s": 27266,
"text": "Navigate to the Gradle Scripts > build.gradle(Module:app) and add the below dependency in the dependencies section. "
},
{
"code": null,
"e": 27443,
"s": 27385,
"text": "implementation ‘com.github.PhilJay:MPAndroidChart:v3.1.0’"
},
{
"code": null,
"e": 27585,
"s": 27443,
"text": "Add the JitPack repository to your build file. Add it to your root build.gradle at the end of repositories inside the allprojects{ } section."
},
{
"code": null,
"e": 27599,
"s": 27585,
"text": "allprojects {"
},
{
"code": null,
"e": 27615,
"s": 27599,
"text": " repositories {"
},
{
"code": null,
"e": 27622,
"s": 27615,
"text": " ..."
},
{
"code": null,
"e": 27660,
"s": 27622,
"text": " maven { url “https://jitpack.io” }"
},
{
"code": null,
"e": 27667,
"s": 27660,
"text": " }"
},
{
"code": null,
"e": 27669,
"s": 27667,
"text": "}"
},
{
"code": null,
"e": 27767,
"s": 27669,
"text": "After adding this dependency sync your project and now we will move towards its implementation. "
},
{
"code": null,
"e": 27815,
"s": 27767,
"text": "Step 3: Working with the activity_main.xml file"
},
{
"code": null,
"e": 27958,
"s": 27815,
"text": "Navigate to the app > res > layout > activity_main.xml and add the below code to that file. Below is the code for the activity_main.xml file. "
},
{
"code": null,
"e": 27962,
"s": 27958,
"text": "XML"
},
{
"code": "<?xml version=\"1.0\" encoding=\"utf-8\"?><RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\" xmlns:tools=\"http://schemas.android.com/tools\" android:layout_width=\"match_parent\" android:layout_height=\"match_parent\" tools:context=\".MainActivity\"> <!--Ui component for our bar chart--> <com.github.mikephil.charting.charts.BarChart android:id=\"@+id/idBarChart\" android:layout_width=\"match_parent\" android:layout_height=\"match_parent\" /> </RelativeLayout>",
"e": 28479,
"s": 27962,
"text": null
},
{
"code": null,
"e": 28527,
"s": 28479,
"text": "Step 4: Working with the MainActivity.java file"
},
{
"code": null,
"e": 28717,
"s": 28527,
"text": "Go to the MainActivity.java file and refer to the following code. Below is the code for the MainActivity.java file. Comments are added inside the code to understand the code in more detail."
},
{
"code": null,
"e": 28722,
"s": 28717,
"text": "Java"
},
{
"code": "import android.graphics.Color;import android.os.Bundle; import androidx.appcompat.app.AppCompatActivity; import com.github.mikephil.charting.charts.BarChart;import com.github.mikephil.charting.components.XAxis;import com.github.mikephil.charting.data.BarData;import com.github.mikephil.charting.data.BarDataSet;import com.github.mikephil.charting.data.BarEntry;import com.github.mikephil.charting.formatter.IndexAxisValueFormatter; import java.util.ArrayList; public class MainActivity extends AppCompatActivity { // variable for our bar chart BarChart barChart; // variable for our bar data set. BarDataSet barDataSet1, barDataSet2; // array list for storing entries. ArrayList barEntries; // creating a string array for displaying days. String[] days = new String[]{\"Sunday\", \"Monday\", \"Tuesday\", \"Thursday\", \"Friday\", \"Saturday\"}; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // initializing variable for bar chart. barChart = findViewById(R.id.idBarChart); // creating a new bar data set. barDataSet1 = new BarDataSet(getBarEntriesOne(), \"First Set\"); barDataSet1.setColor(getApplicationContext().getResources().getColor(R.color.purple_200)); barDataSet2 = new BarDataSet(getBarEntriesTwo(), \"Second Set\"); barDataSet2.setColor(Color.BLUE); // below line is to add bar data set to our bar data. BarData data = new BarData(barDataSet1, barDataSet2); // after adding data to our bar data we // are setting that data to our bar chart. barChart.setData(data); // below line is to remove description // label of our bar chart. barChart.getDescription().setEnabled(false); // below line is to get x axis // of our bar chart. XAxis xAxis = barChart.getXAxis(); // below line is to set value formatter to our x-axis and // we are adding our days to our x axis. xAxis.setValueFormatter(new IndexAxisValueFormatter(days)); // below line is to set center axis // labels to our bar chart. xAxis.setCenterAxisLabels(true); // below line is to set position // to our x-axis to bottom. xAxis.setPosition(XAxis.XAxisPosition.BOTTOM); // below line is to set granularity // to our x axis labels. xAxis.setGranularity(1); // below line is to enable // granularity to our x axis. xAxis.setGranularityEnabled(true); // below line is to make our // bar chart as draggable. barChart.setDragEnabled(true); // below line is to make visible // range for our bar chart. barChart.setVisibleXRangeMaximum(3); // below line is to add bar // space to our chart. float barSpace = 0.1f; // below line is use to add group // spacing to our bar chart. float groupSpace = 0.5f; // we are setting width of // bar in below line. data.setBarWidth(0.15f); // below line is to set minimum // axis to our chart. barChart.getXAxis().setAxisMinimum(0); // below line is to // animate our chart. barChart.animate(); // below line is to group bars // and add spacing to it. barChart.groupBars(0, groupSpace, barSpace); // below line is to invalidate // our bar chart. barChart.invalidate(); } // array list for first set private ArrayList<BarEntry> getBarEntriesOne() { // creating a new array list barEntries = new ArrayList<>(); // adding new entry to our array list with bar // entry and passing x and y axis value to it. barEntries.add(new BarEntry(1f, 4)); barEntries.add(new BarEntry(2f, 6)); barEntries.add(new BarEntry(3f, 8)); barEntries.add(new BarEntry(4f, 2)); barEntries.add(new BarEntry(5f, 4)); barEntries.add(new BarEntry(6f, 1)); return barEntries; } // array list for second set. private ArrayList<BarEntry> getBarEntriesTwo() { // creating a new array list barEntries = new ArrayList<>(); // adding new entry to our array list with bar // entry and passing x and y axis value to it. barEntries.add(new BarEntry(1f, 8)); barEntries.add(new BarEntry(2f, 12)); barEntries.add(new BarEntry(3f, 4)); barEntries.add(new BarEntry(4f, 1)); barEntries.add(new BarEntry(5f, 7)); barEntries.add(new BarEntry(6f, 3)); return barEntries; }}",
"e": 33646,
"s": 28722,
"text": null
},
{
"code": null,
"e": 33694,
"s": 33646,
"text": "Now run your app and see the output of the app."
},
{
"code": null,
"e": 33702,
"s": 33694,
"text": "android"
},
{
"code": null,
"e": 33726,
"s": 33702,
"text": "Technical Scripter 2020"
},
{
"code": null,
"e": 33734,
"s": 33726,
"text": "Android"
},
{
"code": null,
"e": 33739,
"s": 33734,
"text": "Java"
},
{
"code": null,
"e": 33758,
"s": 33739,
"text": "Technical Scripter"
},
{
"code": null,
"e": 33763,
"s": 33758,
"text": "Java"
},
{
"code": null,
"e": 33771,
"s": 33763,
"text": "Android"
},
{
"code": null,
"e": 33869,
"s": 33771,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 33907,
"s": 33869,
"text": "Resource Raw Folder in Android Studio"
},
{
"code": null,
"e": 33946,
"s": 33907,
"text": "Flutter - Custom Bottom Navigation Bar"
},
{
"code": null,
"e": 33996,
"s": 33946,
"text": "How to Read Data from SQLite Database in Android?"
},
{
"code": null,
"e": 34047,
"s": 33996,
"text": "How to Post Data to API using Retrofit in Android?"
},
{
"code": null,
"e": 34089,
"s": 34047,
"text": "Retrofit with Kotlin Coroutine in Android"
},
{
"code": null,
"e": 34104,
"s": 34089,
"text": "Arrays in Java"
},
{
"code": null,
"e": 34148,
"s": 34104,
"text": "Split() String method in Java with examples"
},
{
"code": null,
"e": 34170,
"s": 34148,
"text": "For-each loop in Java"
},
{
"code": null,
"e": 34221,
"s": 34170,
"text": "Object Oriented Programming (OOPs) Concept in Java"
}
] |
C Program to Check Whether a Number is Prime or not - GeeksforGeeks | 17 Sep, 2021
Given a positive integer N. The task is to write a C program to check if the number is prime or not.
Definition:
A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. The first few prime numbers are {2, 3, 5, 7, 11, ....}
The idea to solve this problem is to iterate through all the numbers starting from 2 to sqrt(N) using a for loop and for every number check if it divides N. If we find any number that divides, we return false. If we did not find any number between 2 and sqrt(N) which divides N then it means that N is prime and we will return True. Why did we choose sqrt(N)? The reason is that the smallest and greater than one factor of a number cannot be more than the sqrt of N. And we stop as soon as we find a factor. For example, if N is 49, the smallest factor is 7. For 15, smallest factor is 3.Below is the C program to check if a number is prime:
C++
C
// C++ program to check if a// number is prime#include <iostream>#include <math.h>using namespace std; int main(){ int n, i, flag = 1; // Ask user for input cout <<"Enter a number: \n"; // Store input number in a variable cin >> n ; // Iterate from 2 to sqrt(n) for (i = 2; i <= sqrt(n); i++) { // If n is divisible by any number between // 2 and n/2, it is not prime if (n % i == 0) { flag = 0; break; } } if (n <= 1) flag = 0; if (flag == 1) { cout << n <<" is a prime number"; } else { cout << n <<" is not a prime number"; } return 0;} // This code is contributed by shivanisinghss2110.
// C program to check if a// number is prime #include <math.h>#include <stdio.h>int main(){ int n, i, flag = 1; // Ask user for input printf("Enter a number: \n"); // Store input number in a variable scanf("%d", &n); // Iterate from 2 to sqrt(n) for (i = 2; i <= sqrt(n); i++) { // If n is divisible by any number between // 2 and n/2, it is not prime if (n % i == 0) { flag = 0; break; } } if (n <= 1) flag = 0; if (flag == 1) { printf("%d is a prime number", n); } else { printf("%d is not a prime number", n); } return 0;}
Output:
Enter a number: 11
11 is a prime number
Time Complexity: O(n1/2)
Auxiliary Space: O(1)
AkshatJain19
supriyoss18
neerajratnawat
harshitntiwari
subhammahato348
shivanisinghss2110
Prime Number
school-programming
C Programs
Prime Number
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
C Program to read contents of Whole File
Header files in C/C++ and its uses
Program to print ASCII Value of a character
How to return multiple values from a function in C or C++?
How to Append a Character to a String in C
C program to sort an array in ascending order
time() function in C
C Program to Swap two Numbers
Producer Consumer Problem in C
Program to find Prime Numbers Between given Interval | [
{
"code": null,
"e": 25935,
"s": 25907,
"text": "\n17 Sep, 2021"
},
{
"code": null,
"e": 26037,
"s": 25935,
"text": "Given a positive integer N. The task is to write a C program to check if the number is prime or not. "
},
{
"code": null,
"e": 26050,
"s": 26037,
"text": "Definition: "
},
{
"code": null,
"e": 26210,
"s": 26050,
"text": "A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. The first few prime numbers are {2, 3, 5, 7, 11, ....}"
},
{
"code": null,
"e": 26853,
"s": 26210,
"text": "The idea to solve this problem is to iterate through all the numbers starting from 2 to sqrt(N) using a for loop and for every number check if it divides N. If we find any number that divides, we return false. If we did not find any number between 2 and sqrt(N) which divides N then it means that N is prime and we will return True. Why did we choose sqrt(N)? The reason is that the smallest and greater than one factor of a number cannot be more than the sqrt of N. And we stop as soon as we find a factor. For example, if N is 49, the smallest factor is 7. For 15, smallest factor is 3.Below is the C program to check if a number is prime: "
},
{
"code": null,
"e": 26857,
"s": 26853,
"text": "C++"
},
{
"code": null,
"e": 26859,
"s": 26857,
"text": "C"
},
{
"code": "// C++ program to check if a// number is prime#include <iostream>#include <math.h>using namespace std; int main(){ int n, i, flag = 1; // Ask user for input cout <<\"Enter a number: \\n\"; // Store input number in a variable cin >> n ; // Iterate from 2 to sqrt(n) for (i = 2; i <= sqrt(n); i++) { // If n is divisible by any number between // 2 and n/2, it is not prime if (n % i == 0) { flag = 0; break; } } if (n <= 1) flag = 0; if (flag == 1) { cout << n <<\" is a prime number\"; } else { cout << n <<\" is not a prime number\"; } return 0;} // This code is contributed by shivanisinghss2110.",
"e": 27570,
"s": 26859,
"text": null
},
{
"code": "// C program to check if a// number is prime #include <math.h>#include <stdio.h>int main(){ int n, i, flag = 1; // Ask user for input printf(\"Enter a number: \\n\"); // Store input number in a variable scanf(\"%d\", &n); // Iterate from 2 to sqrt(n) for (i = 2; i <= sqrt(n); i++) { // If n is divisible by any number between // 2 and n/2, it is not prime if (n % i == 0) { flag = 0; break; } } if (n <= 1) flag = 0; if (flag == 1) { printf(\"%d is a prime number\", n); } else { printf(\"%d is not a prime number\", n); } return 0;}",
"e": 28216,
"s": 27570,
"text": null
},
{
"code": null,
"e": 28225,
"s": 28216,
"text": "Output: "
},
{
"code": null,
"e": 28265,
"s": 28225,
"text": "Enter a number: 11\n11 is a prime number"
},
{
"code": null,
"e": 28290,
"s": 28265,
"text": "Time Complexity: O(n1/2)"
},
{
"code": null,
"e": 28312,
"s": 28290,
"text": "Auxiliary Space: O(1)"
},
{
"code": null,
"e": 28325,
"s": 28312,
"text": "AkshatJain19"
},
{
"code": null,
"e": 28337,
"s": 28325,
"text": "supriyoss18"
},
{
"code": null,
"e": 28352,
"s": 28337,
"text": "neerajratnawat"
},
{
"code": null,
"e": 28367,
"s": 28352,
"text": "harshitntiwari"
},
{
"code": null,
"e": 28383,
"s": 28367,
"text": "subhammahato348"
},
{
"code": null,
"e": 28402,
"s": 28383,
"text": "shivanisinghss2110"
},
{
"code": null,
"e": 28415,
"s": 28402,
"text": "Prime Number"
},
{
"code": null,
"e": 28434,
"s": 28415,
"text": "school-programming"
},
{
"code": null,
"e": 28445,
"s": 28434,
"text": "C Programs"
},
{
"code": null,
"e": 28458,
"s": 28445,
"text": "Prime Number"
},
{
"code": null,
"e": 28556,
"s": 28458,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 28597,
"s": 28556,
"text": "C Program to read contents of Whole File"
},
{
"code": null,
"e": 28632,
"s": 28597,
"text": "Header files in C/C++ and its uses"
},
{
"code": null,
"e": 28676,
"s": 28632,
"text": "Program to print ASCII Value of a character"
},
{
"code": null,
"e": 28735,
"s": 28676,
"text": "How to return multiple values from a function in C or C++?"
},
{
"code": null,
"e": 28778,
"s": 28735,
"text": "How to Append a Character to a String in C"
},
{
"code": null,
"e": 28824,
"s": 28778,
"text": "C program to sort an array in ascending order"
},
{
"code": null,
"e": 28845,
"s": 28824,
"text": "time() function in C"
},
{
"code": null,
"e": 28875,
"s": 28845,
"text": "C Program to Swap two Numbers"
},
{
"code": null,
"e": 28906,
"s": 28875,
"text": "Producer Consumer Problem in C"
}
] |
How to Install Atom Text Editor in Linux? - GeeksforGeeks | 06 Oct, 2021
“Atom – A Hackable Text Editor of 21st Century“, as the line indicates Atom is an open-source, cross-platform, feature enrich text editor developed by Github. Atom has attractive features like cross-platform editing, built-in package manager, smart auto-completion, file-system browser, and many more. Apart from features, its beautiful sleek design makes it one of the best text editors for developers.
In this article, we will discuss all possible ways for installing atom text-editor in Linux operating system. There are different ways in which we can install atom in our favorite Linux distribution. We will discuss them here one by one.
The Easiest way to install Atom is using snap-packages. Snap-packages are available in all popular Linux distributions such as Ubuntu, Linux Mint, Debian and Fedora, Kali Linux, etc. Snap-packages contain the binary of the application and all dependencies which are needed in order to run the application.
This makes snaps huge and sometimes it is observed that snap application takes more time to start, but snaps are easy to install, update and upgrade that’s why it is not the recommended way.
We can install snap-version of Atom using the following command:
sudo snap install atom --classic
Installing Atom Text Editor using snap
We will need admin rights to install the application that’s why we are using ‘sudo’ here.
Atom can be installed easily using .deb/ .rpm packages based on your Linux Distribution. Ubuntu, Kali Linux, Linux Mint these are deb-based Linux Systems, so they support .deb packages. On the other side Fedora uses .rpm packages. .deb/ .rpm package can be downloaded from the official website .
Official Atom Website
Just double-click the downloaded file and follow the on-screen instructions, Atom will be installed shortly.
Installing Atom Text-Editor using .deb/.rpm files
.deb/ .rpm packages are available only for 64-bit distributions. So before downloading them, please make sure whether you have a 64-bit or 32-bitOS.
For 32-bit Debain Linux users, they can install atom via PPA. PPA is Personal Package Archive which allows developers to create the repository and distribute the software.
We can install atom using the following commands:
sudo add-apt-repository ppa:webupd8team/atom
sudo apt-get update
sudo apt-get install atom
Installing Atom Text-Editor using PPA : For 32-bit Systems
In this way, we can install atoms in 32-bit systems also.
Atom can be installed using Ubuntu’s Software Center also. This is just the snap-version of Atom which is mentioned above, hence it is not recommended.
Installing Atom Text-Editor Using Ubuntu’s Software Center
These are the ways in which we can install Atom Text-Editor in any kind of Linux Operating System.
We can launch Atom just by typing “atom” in the terminal.
Launching Atom from Terminal
We can also launch Atom from our Applications Menu.
Launching Atom from Applications Menu
how-to-install
Picked
Technical Scripter 2020
How To
Installation Guide
Linux-Unix
Technical Scripter
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install FFmpeg on Windows?
How to Add External JAR File to an IntelliJ IDEA Project?
How to Set Git Username and Password in GitBash?
How to create a nested RecyclerView in Android
How to Install Jupyter Notebook on MacOS?
Installation of Node.js on Linux
How to Install FFmpeg on Windows?
How to Install Pygame on Windows ?
How to Add External JAR File to an IntelliJ IDEA Project?
How to Install Jupyter Notebook on MacOS? | [
{
"code": null,
"e": 26223,
"s": 26195,
"text": "\n06 Oct, 2021"
},
{
"code": null,
"e": 26628,
"s": 26223,
"text": "“Atom – A Hackable Text Editor of 21st Century“, as the line indicates Atom is an open-source, cross-platform, feature enrich text editor developed by Github. Atom has attractive features like cross-platform editing, built-in package manager, smart auto-completion, file-system browser, and many more. Apart from features, its beautiful sleek design makes it one of the best text editors for developers. "
},
{
"code": null,
"e": 26866,
"s": 26628,
"text": "In this article, we will discuss all possible ways for installing atom text-editor in Linux operating system. There are different ways in which we can install atom in our favorite Linux distribution. We will discuss them here one by one."
},
{
"code": null,
"e": 27173,
"s": 26866,
"text": "The Easiest way to install Atom is using snap-packages. Snap-packages are available in all popular Linux distributions such as Ubuntu, Linux Mint, Debian and Fedora, Kali Linux, etc. Snap-packages contain the binary of the application and all dependencies which are needed in order to run the application. "
},
{
"code": null,
"e": 27364,
"s": 27173,
"text": "This makes snaps huge and sometimes it is observed that snap application takes more time to start, but snaps are easy to install, update and upgrade that’s why it is not the recommended way."
},
{
"code": null,
"e": 27430,
"s": 27364,
"text": "We can install snap-version of Atom using the following command: "
},
{
"code": null,
"e": 27463,
"s": 27430,
"text": "sudo snap install atom --classic"
},
{
"code": null,
"e": 27502,
"s": 27463,
"text": "Installing Atom Text Editor using snap"
},
{
"code": null,
"e": 27592,
"s": 27502,
"text": "We will need admin rights to install the application that’s why we are using ‘sudo’ here."
},
{
"code": null,
"e": 27888,
"s": 27592,
"text": "Atom can be installed easily using .deb/ .rpm packages based on your Linux Distribution. Ubuntu, Kali Linux, Linux Mint these are deb-based Linux Systems, so they support .deb packages. On the other side Fedora uses .rpm packages. .deb/ .rpm package can be downloaded from the official website ."
},
{
"code": null,
"e": 27910,
"s": 27888,
"text": "Official Atom Website"
},
{
"code": null,
"e": 28021,
"s": 27912,
"text": "Just double-click the downloaded file and follow the on-screen instructions, Atom will be installed shortly."
},
{
"code": null,
"e": 28071,
"s": 28021,
"text": "Installing Atom Text-Editor using .deb/.rpm files"
},
{
"code": null,
"e": 28220,
"s": 28071,
"text": ".deb/ .rpm packages are available only for 64-bit distributions. So before downloading them, please make sure whether you have a 64-bit or 32-bitOS."
},
{
"code": null,
"e": 28392,
"s": 28220,
"text": "For 32-bit Debain Linux users, they can install atom via PPA. PPA is Personal Package Archive which allows developers to create the repository and distribute the software."
},
{
"code": null,
"e": 28443,
"s": 28392,
"text": "We can install atom using the following commands: "
},
{
"code": null,
"e": 28534,
"s": 28443,
"text": "sudo add-apt-repository ppa:webupd8team/atom\nsudo apt-get update\nsudo apt-get install atom"
},
{
"code": null,
"e": 28593,
"s": 28534,
"text": "Installing Atom Text-Editor using PPA : For 32-bit Systems"
},
{
"code": null,
"e": 28651,
"s": 28593,
"text": "In this way, we can install atoms in 32-bit systems also."
},
{
"code": null,
"e": 28803,
"s": 28651,
"text": "Atom can be installed using Ubuntu’s Software Center also. This is just the snap-version of Atom which is mentioned above, hence it is not recommended."
},
{
"code": null,
"e": 28862,
"s": 28803,
"text": "Installing Atom Text-Editor Using Ubuntu’s Software Center"
},
{
"code": null,
"e": 28961,
"s": 28862,
"text": "These are the ways in which we can install Atom Text-Editor in any kind of Linux Operating System."
},
{
"code": null,
"e": 29019,
"s": 28961,
"text": "We can launch Atom just by typing “atom” in the terminal."
},
{
"code": null,
"e": 29048,
"s": 29019,
"text": "Launching Atom from Terminal"
},
{
"code": null,
"e": 29100,
"s": 29048,
"text": "We can also launch Atom from our Applications Menu."
},
{
"code": null,
"e": 29138,
"s": 29100,
"text": "Launching Atom from Applications Menu"
},
{
"code": null,
"e": 29153,
"s": 29138,
"text": "how-to-install"
},
{
"code": null,
"e": 29160,
"s": 29153,
"text": "Picked"
},
{
"code": null,
"e": 29184,
"s": 29160,
"text": "Technical Scripter 2020"
},
{
"code": null,
"e": 29191,
"s": 29184,
"text": "How To"
},
{
"code": null,
"e": 29210,
"s": 29191,
"text": "Installation Guide"
},
{
"code": null,
"e": 29221,
"s": 29210,
"text": "Linux-Unix"
},
{
"code": null,
"e": 29240,
"s": 29221,
"text": "Technical Scripter"
},
{
"code": null,
"e": 29338,
"s": 29240,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 29372,
"s": 29338,
"text": "How to Install FFmpeg on Windows?"
},
{
"code": null,
"e": 29430,
"s": 29372,
"text": "How to Add External JAR File to an IntelliJ IDEA Project?"
},
{
"code": null,
"e": 29479,
"s": 29430,
"text": "How to Set Git Username and Password in GitBash?"
},
{
"code": null,
"e": 29526,
"s": 29479,
"text": "How to create a nested RecyclerView in Android"
},
{
"code": null,
"e": 29568,
"s": 29526,
"text": "How to Install Jupyter Notebook on MacOS?"
},
{
"code": null,
"e": 29601,
"s": 29568,
"text": "Installation of Node.js on Linux"
},
{
"code": null,
"e": 29635,
"s": 29601,
"text": "How to Install FFmpeg on Windows?"
},
{
"code": null,
"e": 29670,
"s": 29635,
"text": "How to Install Pygame on Windows ?"
},
{
"code": null,
"e": 29728,
"s": 29670,
"text": "How to Add External JAR File to an IntelliJ IDEA Project?"
}
] |
Python | Popup widget in Kivy - GeeksforGeeks | 06 Feb, 2020
Kivy is a platform independent GUI tool in Python. As it can be run on Android, IOS, linux and Windows etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktops applications.
Kivy Tutorial – Learn Kivy with Examples.
The Popup widget is used to create popups. By default, the popup will cover the whole “parent” window. When you are creating a popup, you must at least set a Popup.title and Popup.content.
Popup dialogs are used ]when we have to convey certain obvious messages to the user. Messages to the user through status bars as well for specific messages which need to be told with emphasis can still be done through popup dialogs.
Keep one thing in mind that the default size of a widget is size_hint=(1, 1).
If you don’t want your popup to be on the full screen you must gave either size hints with values less than 1 (for instance size_hint=(.8, .8)) or deactivate the size_hint and use fixed size attributes.
To use popup you must have to import :
from kivy.uix.popup import Popup
Note: Popup is a special widget. Don’t try to add it as a child to any other widget. If you do, Popup will be handled like an ordinary widget and won’t be created hidden in the background.
Basic Approach :
1) import kivy
2) import kivyApp
3) import Label
4) import button
5) import Gridlayout
6) import popup
7) Set minimum version(optional)
8) create App class
9) return Layout/widget/Class(according to requirement)
10) In the App class create the popup
11) Run an instance of the class
# Kivy example for the Popup widget # Program to Show how to create a switch# import kivy module import kivy # base Class of your App inherits from the App class. # app:always refers to the instance of your application from kivy.app import App # this restrict the kivy version i.e # below this kivy version you cannot # use the app or software kivy.require('1.9.0') # The Button is a Label with associated actions# that is triggered when the button# is pressed (or released after a click/touch).from kivy.uix.button import Button # The GridLayout arranges children in a matrix.# It takes the available space and# divides it into columns and rows,# then adds widgets to the resulting “cells”.from kivy.uix.gridlayout import GridLayout # Popup widget is used to create popups.# By default, the popup will cover# the whole “parent” window.# When you are creating a popup,# you must at least set a Popup.title and Popup.content.from kivy.uix.popup import Popup # The Label widget is for rendering text. from kivy.uix.label import Label # to change the kivy default settings we use this module configfrom kivy.config import Config # 0 being off 1 being on as in true / false# you can use 0 or 1 && True or FalseConfig.set('graphics', 'resizable', True) # Make an app by deriving from the kivy provided app classclass PopupExample(App): # override the build method and return the root widget of this App def build(self): # Define a grid layout for this App self.layout = GridLayout(cols = 1, padding = 10) # Add a button self.button = Button(text ="Click for pop-up") self.layout.add_widget(self.button) # Attach a callback for the button press event self.button.bind(on_press = self.onButtonPress) return self.layout # On button press - Create a popup dialog with a label and a close button def onButtonPress(self, button): layout = GridLayout(cols = 1, padding = 10) popupLabel = Label(text = "Click for pop-up") closeButton = Button(text = "Close the pop-up") layout.add_widget(popupLabel) layout.add_widget(closeButton) # Instantiate the modal popup and display popup = Popup(title ='Demo Popup', content = layout) popup.open() # Attach close button press with popup.dismiss action closeButton.bind(on_press = popup.dismiss) # Run the appif __name__ == '__main__': PopupExample().run()
Output:
When click on screen popup will open like this:
When click on Close the popup it will close.
Code #2:In the second code when we use the size_hint and the size we can give the size accordingly. In this just add something as in the below code in line number 75.
# Kivy example for the Popup widget # Program to Show how to create a switch# import kivy module import kivy # base Class of your App inherits from the App class. # app:always refers to the instance of your application from kivy.app import App # this restrict the kivy version i.e # below this kivy version you cannot # use the app or software kivy.require('1.9.0') # The Button is a Label with associated actions# that is triggered when the button# is pressed (or released after a click/touch).from kivy.uix.button import Button # The GridLayout arranges children in a matrix.# It takes the available space and# divides it into columns and rows,# then adds widgets to the resulting “cells”.from kivy.uix.gridlayout import GridLayout # Popup widget is used to create popups.# By default, the popup will cover# the whole “parent” window.# When you are creating a popup,# you must at least set a Popup.title and Popup.content.from kivy.uix.popup import Popup # The Label widget is for rendering text. from kivy.uix.label import Label # to change the kivy default settings we use this module configfrom kivy.config import Config # 0 being off 1 being on as in true / false# you can use 0 or 1 && True or FalseConfig.set('graphics', 'resizable', True) # Make an app by deriving from the kivy provided app classclass PopupExample(App): # override the build method and return the root widget of this App def build(self): # Define a grid layout for this App self.layout = GridLayout(cols = 1, padding = 10) # Add a button self.button = Button(text ="Click for pop-up") self.layout.add_widget(self.button) # Attach a callback for the button press event self.button.bind(on_press = self.onButtonPress) return self.layout # On button press - Create a popup dialog with a label and a close button def onButtonPress(self, button): layout = GridLayout(cols = 1, padding = 10) popupLabel = Label(text = "Click for pop-up") closeButton = Button(text = "Close the pop-up") layout.add_widget(popupLabel) layout.add_widget(closeButton) # Instantiate the modal popup and display popup = Popup(title ='Demo Popup', content = layout, size_hint =(None, None), size =(200, 200)) popup.open() # Attach close button press with popup.dismiss action closeButton.bind(on_press = popup.dismiss) # Run the appif __name__ == '__main__': PopupExample().run()
Output:Popup size will be smaller than the window size.
Reference : https://kivy.org/doc/stable/api-kivy.uix.popup.html
Python-gui
Python-kivy
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Read JSON file using Python
Adding new column to existing DataFrame in Pandas
Python map() function
How to get column names in Pandas dataframe
Read a file line by line in Python
How to Install PIP on Windows ?
Enumerate() in Python
Different ways to create Pandas Dataframe
Iterate over a list in Python
Python String | replace() | [
{
"code": null,
"e": 42651,
"s": 42623,
"text": "\n06 Feb, 2020"
},
{
"code": null,
"e": 42887,
"s": 42651,
"text": "Kivy is a platform independent GUI tool in Python. As it can be run on Android, IOS, linux and Windows etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktops applications."
},
{
"code": null,
"e": 42930,
"s": 42887,
"text": " Kivy Tutorial – Learn Kivy with Examples."
},
{
"code": null,
"e": 43119,
"s": 42930,
"text": "The Popup widget is used to create popups. By default, the popup will cover the whole “parent” window. When you are creating a popup, you must at least set a Popup.title and Popup.content."
},
{
"code": null,
"e": 43352,
"s": 43119,
"text": "Popup dialogs are used ]when we have to convey certain obvious messages to the user. Messages to the user through status bars as well for specific messages which need to be told with emphasis can still be done through popup dialogs."
},
{
"code": null,
"e": 43430,
"s": 43352,
"text": "Keep one thing in mind that the default size of a widget is size_hint=(1, 1)."
},
{
"code": null,
"e": 43633,
"s": 43430,
"text": "If you don’t want your popup to be on the full screen you must gave either size hints with values less than 1 (for instance size_hint=(.8, .8)) or deactivate the size_hint and use fixed size attributes."
},
{
"code": null,
"e": 43672,
"s": 43633,
"text": "To use popup you must have to import :"
},
{
"code": null,
"e": 43705,
"s": 43672,
"text": "from kivy.uix.popup import Popup"
},
{
"code": null,
"e": 43894,
"s": 43705,
"text": "Note: Popup is a special widget. Don’t try to add it as a child to any other widget. If you do, Popup will be handled like an ordinary widget and won’t be created hidden in the background."
},
{
"code": null,
"e": 44195,
"s": 43894,
"text": "Basic Approach :\n\n1) import kivy\n2) import kivyApp\n3) import Label\n4) import button\n5) import Gridlayout\n6) import popup\n7) Set minimum version(optional)\n8) create App class\n9) return Layout/widget/Class(according to requirement)\n10) In the App class create the popup\n11) Run an instance of the class"
},
{
"code": "# Kivy example for the Popup widget # Program to Show how to create a switch# import kivy module import kivy # base Class of your App inherits from the App class. # app:always refers to the instance of your application from kivy.app import App # this restrict the kivy version i.e # below this kivy version you cannot # use the app or software kivy.require('1.9.0') # The Button is a Label with associated actions# that is triggered when the button# is pressed (or released after a click/touch).from kivy.uix.button import Button # The GridLayout arranges children in a matrix.# It takes the available space and# divides it into columns and rows,# then adds widgets to the resulting “cells”.from kivy.uix.gridlayout import GridLayout # Popup widget is used to create popups.# By default, the popup will cover# the whole “parent” window.# When you are creating a popup,# you must at least set a Popup.title and Popup.content.from kivy.uix.popup import Popup # The Label widget is for rendering text. from kivy.uix.label import Label # to change the kivy default settings we use this module configfrom kivy.config import Config # 0 being off 1 being on as in true / false# you can use 0 or 1 && True or FalseConfig.set('graphics', 'resizable', True) # Make an app by deriving from the kivy provided app classclass PopupExample(App): # override the build method and return the root widget of this App def build(self): # Define a grid layout for this App self.layout = GridLayout(cols = 1, padding = 10) # Add a button self.button = Button(text =\"Click for pop-up\") self.layout.add_widget(self.button) # Attach a callback for the button press event self.button.bind(on_press = self.onButtonPress) return self.layout # On button press - Create a popup dialog with a label and a close button def onButtonPress(self, button): layout = GridLayout(cols = 1, padding = 10) popupLabel = Label(text = \"Click for pop-up\") closeButton = Button(text = \"Close the pop-up\") layout.add_widget(popupLabel) layout.add_widget(closeButton) # Instantiate the modal popup and display popup = Popup(title ='Demo Popup', content = layout) popup.open() # Attach close button press with popup.dismiss action closeButton.bind(on_press = popup.dismiss) # Run the appif __name__ == '__main__': PopupExample().run()",
"e": 46717,
"s": 44195,
"text": null
},
{
"code": null,
"e": 46725,
"s": 46717,
"text": "Output:"
},
{
"code": null,
"e": 46773,
"s": 46725,
"text": "When click on screen popup will open like this:"
},
{
"code": null,
"e": 46818,
"s": 46773,
"text": "When click on Close the popup it will close."
},
{
"code": null,
"e": 46986,
"s": 46818,
"text": " Code #2:In the second code when we use the size_hint and the size we can give the size accordingly. In this just add something as in the below code in line number 75."
},
{
"code": "# Kivy example for the Popup widget # Program to Show how to create a switch# import kivy module import kivy # base Class of your App inherits from the App class. # app:always refers to the instance of your application from kivy.app import App # this restrict the kivy version i.e # below this kivy version you cannot # use the app or software kivy.require('1.9.0') # The Button is a Label with associated actions# that is triggered when the button# is pressed (or released after a click/touch).from kivy.uix.button import Button # The GridLayout arranges children in a matrix.# It takes the available space and# divides it into columns and rows,# then adds widgets to the resulting “cells”.from kivy.uix.gridlayout import GridLayout # Popup widget is used to create popups.# By default, the popup will cover# the whole “parent” window.# When you are creating a popup,# you must at least set a Popup.title and Popup.content.from kivy.uix.popup import Popup # The Label widget is for rendering text. from kivy.uix.label import Label # to change the kivy default settings we use this module configfrom kivy.config import Config # 0 being off 1 being on as in true / false# you can use 0 or 1 && True or FalseConfig.set('graphics', 'resizable', True) # Make an app by deriving from the kivy provided app classclass PopupExample(App): # override the build method and return the root widget of this App def build(self): # Define a grid layout for this App self.layout = GridLayout(cols = 1, padding = 10) # Add a button self.button = Button(text =\"Click for pop-up\") self.layout.add_widget(self.button) # Attach a callback for the button press event self.button.bind(on_press = self.onButtonPress) return self.layout # On button press - Create a popup dialog with a label and a close button def onButtonPress(self, button): layout = GridLayout(cols = 1, padding = 10) popupLabel = Label(text = \"Click for pop-up\") closeButton = Button(text = \"Close the pop-up\") layout.add_widget(popupLabel) layout.add_widget(closeButton) # Instantiate the modal popup and display popup = Popup(title ='Demo Popup', content = layout, size_hint =(None, None), size =(200, 200)) popup.open() # Attach close button press with popup.dismiss action closeButton.bind(on_press = popup.dismiss) # Run the appif __name__ == '__main__': PopupExample().run()",
"e": 49572,
"s": 46986,
"text": null
},
{
"code": null,
"e": 49628,
"s": 49572,
"text": "Output:Popup size will be smaller than the window size."
},
{
"code": null,
"e": 49692,
"s": 49628,
"text": "Reference : https://kivy.org/doc/stable/api-kivy.uix.popup.html"
},
{
"code": null,
"e": 49703,
"s": 49692,
"text": "Python-gui"
},
{
"code": null,
"e": 49715,
"s": 49703,
"text": "Python-kivy"
},
{
"code": null,
"e": 49722,
"s": 49715,
"text": "Python"
},
{
"code": null,
"e": 49820,
"s": 49722,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 49848,
"s": 49820,
"text": "Read JSON file using Python"
},
{
"code": null,
"e": 49898,
"s": 49848,
"text": "Adding new column to existing DataFrame in Pandas"
},
{
"code": null,
"e": 49920,
"s": 49898,
"text": "Python map() function"
},
{
"code": null,
"e": 49964,
"s": 49920,
"text": "How to get column names in Pandas dataframe"
},
{
"code": null,
"e": 49999,
"s": 49964,
"text": "Read a file line by line in Python"
},
{
"code": null,
"e": 50031,
"s": 49999,
"text": "How to Install PIP on Windows ?"
},
{
"code": null,
"e": 50053,
"s": 50031,
"text": "Enumerate() in Python"
},
{
"code": null,
"e": 50095,
"s": 50053,
"text": "Different ways to create Pandas Dataframe"
},
{
"code": null,
"e": 50125,
"s": 50095,
"text": "Iterate over a list in Python"
}
] |
Interpolation Search | 18 Jun, 2022
Given a sorted array of n uniformly distributed values arr[], write a function to search for a particular element x in the array. Linear Search finds the element in O(n) time, Jump Search takes O(√ n) time and Binary Search takes O(log n) time. The Interpolation Search is an improvement over Binary Search for instances, where the values in a sorted array are uniformly distributed. Interpolation constructs new data points within the range of a discrete set of known data points. Binary Search always goes to the middle element to check. On the other hand, interpolation search may go to different locations according to the value of the key being searched. For example, if the value of the key is closer to the last element, interpolation search is likely to start search toward the end side.To find the position to be searched, it uses the following formula.
// The idea of formula is to return higher value of pos
// when element to be searched is closer to arr[hi]. And
// smaller value when closer to arr[lo]
arr[] ==> Array where elements need to be searched
x ==> Element to be searched
lo ==> Starting index in arr[]
hi ==> Ending index in arr[]
There are many different interpolation methods and one such is known as linear interpolation. Linear interpolation takes two data points which we assume as (x1,y1) and (x2,y2) and the formula is : at point(x,y).
This algorithm works in a way we search for a word in a dictionary. The interpolation search algorithm improves the binary search algorithm. The formula for finding a value is: K = data-low/high-low.
K is a constant which is used to narrow the search space. In the case of binary search, the value for this constant is: K=(low+high)/2.
The formula for pos can be derived as follows.
Let's assume that the elements of the array are linearly distributed.
General equation of line : y = m*x + c.
y is the value in the array and x is its index.
Now putting value of lo,hi and x in the equation
arr[hi] = m*hi+c ----(1)
arr[lo] = m*lo+c ----(2)
x = m*pos + c ----(3)
m = (arr[hi] - arr[lo] )/ (hi - lo)
subtracting eqxn (2) from (3)
x - arr[lo] = m * (pos - lo)
lo + (x - arr[lo])/m = pos
pos = lo + (x - arr[lo]) *(hi - lo)/(arr[hi] - arr[lo])
Algorithm The rest of the Interpolation algorithm is the same except for the above partition logic. Step1: In a loop, calculate the value of “pos” using the probe position formula. Step2: If it is a match, return the index of the item, and exit. Step3: If the item is less than arr[pos], calculate the probe position of the left sub-array. Otherwise, calculate the same in the right sub-array. Step4: Repeat until a match is found or the sub-array reduces to zero.Below is the implementation of the algorithm.
C++
C++
C
Java
Python3
C#
Javascript
// C++ program to implement interpolation search#include<bits/stdc++.h>using namespace std; // If x is present in arr[0..n-1], then returns// index of it, else returns -1.int interpolationSearch(int arr[], int n, int x){ // Find indexes of two corners int lo = 0, hi = (n - 1); // Since array is sorted, an element present // in array must be in range defined by corner while (lo <= hi && x >= arr[lo] && x <= arr[hi]) { if (lo == hi) { if (arr[lo] == x) return lo; return -1; } // Probing the position with keeping // uniform distribution in mind. int pos = lo + (((double)(hi - lo) / (arr[hi] - arr[lo])) * (x - arr[lo])); // Condition of target found if (arr[pos] == x) return pos; // If x is larger, x is in upper part if (arr[pos] < x) lo = pos + 1; // If x is smaller, x is in the lower part else hi = pos - 1; } return -1;} // Driver Codeint main(){ // Array of items on which search will // be conducted. int arr[] = {10, 12, 13, 16, 18, 19, 20, 21, 22, 23, 24, 33, 35, 42, 47}; int n = sizeof(arr)/sizeof(arr[0]); int x = 18; // Element to be searched int index = interpolationSearch(arr, n, x); // If element was found if (index != -1) cout << "Element found at index " << index; else cout << "Element not found."; return 0;} // This code is contributed by Mukul Singh.
// C++ program to implement interpolation// search with recursion#include <bits/stdc++.h>using namespace std; // If x is present in arr[0..n-1], then returns// index of it, else returns -1.int interpolationSearch(int arr[], int lo, int hi, int x){ int pos; // Since array is sorted, an element present // in array must be in range defined by corner if (lo <= hi && x >= arr[lo] && x <= arr[hi]) { // Probing the position with keeping // uniform distribution in mind. pos = lo + (((double)(hi - lo) / (arr[hi] - arr[lo])) * (x - arr[lo])); // Condition of target found if (arr[pos] == x) return pos; // If x is larger, x is in right sub array if (arr[pos] < x) return interpolationSearch(arr, pos + 1, hi, x); // If x is smaller, x is in left sub array if (arr[pos] > x) return interpolationSearch(arr, lo, pos - 1, x); } return -1;} // Driver Codeint main(){ // Array of items on which search will // be conducted. int arr[] = { 10, 12, 13, 16, 18, 19, 20, 21, 22, 23, 24, 33, 35, 42, 47 }; int n = sizeof(arr) / sizeof(arr[0]); // Element to be searched int x = 18; int index = interpolationSearch(arr, 0, n - 1, x); // If element was found if (index != -1) cout << "Element found at index " << index; else cout << "Element not found."; return 0;} // This code is contributed by equbalzeeshan
// C program to implement interpolation search// with recursion#include <stdio.h> // If x is present in arr[0..n-1], then returns// index of it, else returns -1.int interpolationSearch(int arr[], int lo, int hi, int x){ int pos; // Since array is sorted, an element present // in array must be in range defined by corner if (lo <= hi && x >= arr[lo] && x <= arr[hi]) { // Probing the position with keeping // uniform distribution in mind. pos = lo + (((double)(hi - lo) / (arr[hi] - arr[lo])) * (x - arr[lo])); // Condition of target found if (arr[pos] == x) return pos; // If x is larger, x is in right sub array if (arr[pos] < x) return interpolationSearch(arr, pos + 1, hi, x); // If x is smaller, x is in left sub array if (arr[pos] > x) return interpolationSearch(arr, lo, pos - 1, x); } return -1;} // Driver Codeint main(){ // Array of items on which search will // be conducted. int arr[] = { 10, 12, 13, 16, 18, 19, 20, 21, 22, 23, 24, 33, 35, 42, 47 }; int n = sizeof(arr) / sizeof(arr[0]); int x = 18; // Element to be searched int index = interpolationSearch(arr, 0, n - 1, x); // If element was found if (index != -1) printf("Element found at index %d", index); else printf("Element not found."); return 0;}
// Java program to implement interpolation// search with recursionimport java.util.*; class GFG { // If x is present in arr[0..n-1], then returns // index of it, else returns -1. public static int interpolationSearch(int arr[], int lo, int hi, int x) { int pos; // Since array is sorted, an element // present in array must be in range // defined by corner if (lo <= hi && x >= arr[lo] && x <= arr[hi]) { // Probing the position with keeping // uniform distribution in mind. pos = lo + (((hi - lo) / (arr[hi] - arr[lo])) * (x - arr[lo])); // Condition of target found if (arr[pos] == x) return pos; // If x is larger, x is in right sub array if (arr[pos] < x) return interpolationSearch(arr, pos + 1, hi, x); // If x is smaller, x is in left sub array if (arr[pos] > x) return interpolationSearch(arr, lo, pos - 1, x); } return -1; } // Driver Code public static void main(String[] args) { // Array of items on which search will // be conducted. int arr[] = { 10, 12, 13, 16, 18, 19, 20, 21, 22, 23, 24, 33, 35, 42, 47 }; int n = arr.length; // Element to be searched int x = 18; int index = interpolationSearch(arr, 0, n - 1, x); // If element was found if (index != -1) System.out.println("Element found at index " + index); else System.out.println("Element not found."); }} // This code is contributed by equbalzeeshan
# Python3 program to implement# interpolation search# with recursion # If x is present in arr[0..n-1], then# returns index of it, else returns -1. def interpolationSearch(arr, lo, hi, x): # Since array is sorted, an element present # in array must be in range defined by corner if (lo <= hi and x >= arr[lo] and x <= arr[hi]): # Probing the position with keeping # uniform distribution in mind. pos = lo + ((hi - lo) // (arr[hi] - arr[lo]) * (x - arr[lo])) # Condition of target found if arr[pos] == x: return pos # If x is larger, x is in right subarray if arr[pos] < x: return interpolationSearch(arr, pos + 1, hi, x) # If x is smaller, x is in left subarray if arr[pos] > x: return interpolationSearch(arr, lo, pos - 1, x) return -1 # Driver code # Array of items in which# search will be conductedarr = [10, 12, 13, 16, 18, 19, 20, 21, 22, 23, 24, 33, 35, 42, 47]n = len(arr) # Element to be searchedx = 18index = interpolationSearch(arr, 0, n - 1, x) if index != -1: print("Element found at index", index)else: print("Element not found") # This code is contributed by Hardik Jain
// C# program to implement // interpolation searchusing System; class GFG{ // If x is present in // arr[0..n-1], then // returns index of it, // else returns -1.static int interpolationSearch(int []arr, int lo, int hi, int x){ int pos; // Since array is sorted, an element // present in array must be in range // defined by corner if (lo <= hi && x >= arr[lo] && x <= arr[hi]) { // Probing the position // with keeping uniform // distribution in mind. pos = lo + (((hi - lo) / (arr[hi] - arr[lo])) * (x - arr[lo])); // Condition of // target found if(arr[pos] == x) return pos; // If x is larger, x is in right sub array if(arr[pos] < x) return interpolationSearch(arr, pos + 1, hi, x); // If x is smaller, x is in left sub array if(arr[pos] > x) return interpolationSearch(arr, lo, pos - 1, x); } return -1;} // Driver Code public static void Main() { // Array of items on which search will // be conducted. int []arr = new int[]{ 10, 12, 13, 16, 18, 19, 20, 21, 22, 23, 24, 33, 35, 42, 47 }; // Element to be searched int x = 18; int n = arr.Length; int index = interpolationSearch(arr, 0, n - 1, x); // If element was found if (index != -1) Console.WriteLine("Element found at index " + index); else Console.WriteLine("Element not found.");}} // This code is contributed by equbalzeeshan
<script>// Javascript program to implement Interpolation Search // If x is present in arr[0..n-1], then returns// index of it, else returns -1. function interpolationSearch(arr, lo, hi, x){ let pos; // Since array is sorted, an element present // in array must be in range defined by corner if (lo <= hi && x >= arr[lo] && x <= arr[hi]) { // Probing the position with keeping // uniform distribution in mind. pos = lo + Math.floor(((hi - lo) / (arr[hi] - arr[lo])) * (x - arr[lo]));; // Condition of target found if (arr[pos] == x){ return pos; } // If x is larger, x is in right sub array if (arr[pos] < x){ return interpolationSearch(arr, pos + 1, hi, x); } // If x is smaller, x is in left sub array if (arr[pos] > x){ return interpolationSearch(arr, lo, pos - 1, x); } } return -1;} // Driver Codelet arr = [10, 12, 13, 16, 18, 19, 20, 21, 22, 23, 24, 33, 35, 42, 47]; let n = arr.length; // Element to be searchedlet x = 18let index = interpolationSearch(arr, 0, n - 1, x); // If element was foundif (index != -1){ document.write(`Element found at index ${index}`)}else{ document.write("Element not found");} // This code is contributed by _saurabh_jaiswal</script>
Element found at index 4
This article is contributed by Aayu Sachdev. If you like GeeksforGeeks and would like to contribute, you can also write an article using write.geeksforgeeks.org or mail your article to [email protected]. See your article appearing on the GeeksforGeeks main page and help other Geeks.Please write comments if you find anything incorrect, or if you want to share more information about the topic discussed above.
vt_m
Saurabh Agarwal 10
DeepikaPathak
Code_Mech
UtkarshBehre
assasinationprattayan
hdkjain
equbalzeeshan
childemperor
_saurabh_jaiswal
amartyaghoshgfg
shreyasnaphad
satyajit1910
Searching
Technical Scripter
Searching
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Maximum and minimum of an array using minimum number of comparisons
K'th Smallest/Largest Element in Unsorted Array | Set 1
Search an element in a sorted and rotated array
Search, insert and delete in an unsorted array
Find the Missing Number
k largest(or smallest) elements in an array
Program to find largest element in an array
Two Pointers Technique
Given an array of size n and a number k, find all elements that appear more than n/k times
Search, insert and delete in a sorted array | [
{
"code": null,
"e": 52,
"s": 24,
"text": "\n18 Jun, 2022"
},
{
"code": null,
"e": 916,
"s": 52,
"text": "Given a sorted array of n uniformly distributed values arr[], write a function to search for a particular element x in the array. Linear Search finds the element in O(n) time, Jump Search takes O(√ n) time and Binary Search takes O(log n) time. The Interpolation Search is an improvement over Binary Search for instances, where the values in a sorted array are uniformly distributed. Interpolation constructs new data points within the range of a discrete set of known data points. Binary Search always goes to the middle element to check. On the other hand, interpolation search may go to different locations according to the value of the key being searched. For example, if the value of the key is closer to the last element, interpolation search is likely to start search toward the end side.To find the position to be searched, it uses the following formula. "
},
{
"code": null,
"e": 1222,
"s": 916,
"text": "// The idea of formula is to return higher value of pos\n// when element to be searched is closer to arr[hi]. And\n// smaller value when closer to arr[lo]\n\n\n\narr[] ==> Array where elements need to be searched\nx ==> Element to be searched\nlo ==> Starting index in arr[]\nhi ==> Ending index in arr[]"
},
{
"code": null,
"e": 1435,
"s": 1222,
"text": "There are many different interpolation methods and one such is known as linear interpolation. Linear interpolation takes two data points which we assume as (x1,y1) and (x2,y2) and the formula is : at point(x,y)."
},
{
"code": null,
"e": 1636,
"s": 1435,
"text": "This algorithm works in a way we search for a word in a dictionary. The interpolation search algorithm improves the binary search algorithm. The formula for finding a value is: K = data-low/high-low."
},
{
"code": null,
"e": 1772,
"s": 1636,
"text": "K is a constant which is used to narrow the search space. In the case of binary search, the value for this constant is: K=(low+high)/2."
},
{
"code": null,
"e": 1822,
"s": 1775,
"text": "The formula for pos can be derived as follows."
},
{
"code": null,
"e": 2288,
"s": 1822,
"text": "Let's assume that the elements of the array are linearly distributed. \n\nGeneral equation of line : y = m*x + c.\ny is the value in the array and x is its index.\n\nNow putting value of lo,hi and x in the equation\narr[hi] = m*hi+c ----(1)\narr[lo] = m*lo+c ----(2)\nx = m*pos + c ----(3)\n\nm = (arr[hi] - arr[lo] )/ (hi - lo)\n\nsubtracting eqxn (2) from (3)\nx - arr[lo] = m * (pos - lo)\nlo + (x - arr[lo])/m = pos\npos = lo + (x - arr[lo]) *(hi - lo)/(arr[hi] - arr[lo])"
},
{
"code": null,
"e": 2799,
"s": 2288,
"text": "Algorithm The rest of the Interpolation algorithm is the same except for the above partition logic. Step1: In a loop, calculate the value of “pos” using the probe position formula. Step2: If it is a match, return the index of the item, and exit. Step3: If the item is less than arr[pos], calculate the probe position of the left sub-array. Otherwise, calculate the same in the right sub-array. Step4: Repeat until a match is found or the sub-array reduces to zero.Below is the implementation of the algorithm. "
},
{
"code": null,
"e": 2803,
"s": 2799,
"text": "C++"
},
{
"code": null,
"e": 2807,
"s": 2803,
"text": "C++"
},
{
"code": null,
"e": 2809,
"s": 2807,
"text": "C"
},
{
"code": null,
"e": 2814,
"s": 2809,
"text": "Java"
},
{
"code": null,
"e": 2822,
"s": 2814,
"text": "Python3"
},
{
"code": null,
"e": 2825,
"s": 2822,
"text": "C#"
},
{
"code": null,
"e": 2836,
"s": 2825,
"text": "Javascript"
},
{
"code": "// C++ program to implement interpolation search#include<bits/stdc++.h>using namespace std; // If x is present in arr[0..n-1], then returns// index of it, else returns -1.int interpolationSearch(int arr[], int n, int x){ // Find indexes of two corners int lo = 0, hi = (n - 1); // Since array is sorted, an element present // in array must be in range defined by corner while (lo <= hi && x >= arr[lo] && x <= arr[hi]) { if (lo == hi) { if (arr[lo] == x) return lo; return -1; } // Probing the position with keeping // uniform distribution in mind. int pos = lo + (((double)(hi - lo) / (arr[hi] - arr[lo])) * (x - arr[lo])); // Condition of target found if (arr[pos] == x) return pos; // If x is larger, x is in upper part if (arr[pos] < x) lo = pos + 1; // If x is smaller, x is in the lower part else hi = pos - 1; } return -1;} // Driver Codeint main(){ // Array of items on which search will // be conducted. int arr[] = {10, 12, 13, 16, 18, 19, 20, 21, 22, 23, 24, 33, 35, 42, 47}; int n = sizeof(arr)/sizeof(arr[0]); int x = 18; // Element to be searched int index = interpolationSearch(arr, n, x); // If element was found if (index != -1) cout << \"Element found at index \" << index; else cout << \"Element not found.\"; return 0;} // This code is contributed by Mukul Singh.",
"e": 4365,
"s": 2836,
"text": null
},
{
"code": "// C++ program to implement interpolation// search with recursion#include <bits/stdc++.h>using namespace std; // If x is present in arr[0..n-1], then returns// index of it, else returns -1.int interpolationSearch(int arr[], int lo, int hi, int x){ int pos; // Since array is sorted, an element present // in array must be in range defined by corner if (lo <= hi && x >= arr[lo] && x <= arr[hi]) { // Probing the position with keeping // uniform distribution in mind. pos = lo + (((double)(hi - lo) / (arr[hi] - arr[lo])) * (x - arr[lo])); // Condition of target found if (arr[pos] == x) return pos; // If x is larger, x is in right sub array if (arr[pos] < x) return interpolationSearch(arr, pos + 1, hi, x); // If x is smaller, x is in left sub array if (arr[pos] > x) return interpolationSearch(arr, lo, pos - 1, x); } return -1;} // Driver Codeint main(){ // Array of items on which search will // be conducted. int arr[] = { 10, 12, 13, 16, 18, 19, 20, 21, 22, 23, 24, 33, 35, 42, 47 }; int n = sizeof(arr) / sizeof(arr[0]); // Element to be searched int x = 18; int index = interpolationSearch(arr, 0, n - 1, x); // If element was found if (index != -1) cout << \"Element found at index \" << index; else cout << \"Element not found.\"; return 0;} // This code is contributed by equbalzeeshan",
"e": 5889,
"s": 4365,
"text": null
},
{
"code": "// C program to implement interpolation search// with recursion#include <stdio.h> // If x is present in arr[0..n-1], then returns// index of it, else returns -1.int interpolationSearch(int arr[], int lo, int hi, int x){ int pos; // Since array is sorted, an element present // in array must be in range defined by corner if (lo <= hi && x >= arr[lo] && x <= arr[hi]) { // Probing the position with keeping // uniform distribution in mind. pos = lo + (((double)(hi - lo) / (arr[hi] - arr[lo])) * (x - arr[lo])); // Condition of target found if (arr[pos] == x) return pos; // If x is larger, x is in right sub array if (arr[pos] < x) return interpolationSearch(arr, pos + 1, hi, x); // If x is smaller, x is in left sub array if (arr[pos] > x) return interpolationSearch(arr, lo, pos - 1, x); } return -1;} // Driver Codeint main(){ // Array of items on which search will // be conducted. int arr[] = { 10, 12, 13, 16, 18, 19, 20, 21, 22, 23, 24, 33, 35, 42, 47 }; int n = sizeof(arr) / sizeof(arr[0]); int x = 18; // Element to be searched int index = interpolationSearch(arr, 0, n - 1, x); // If element was found if (index != -1) printf(\"Element found at index %d\", index); else printf(\"Element not found.\"); return 0;}",
"e": 7326,
"s": 5889,
"text": null
},
{
"code": "// Java program to implement interpolation// search with recursionimport java.util.*; class GFG { // If x is present in arr[0..n-1], then returns // index of it, else returns -1. public static int interpolationSearch(int arr[], int lo, int hi, int x) { int pos; // Since array is sorted, an element // present in array must be in range // defined by corner if (lo <= hi && x >= arr[lo] && x <= arr[hi]) { // Probing the position with keeping // uniform distribution in mind. pos = lo + (((hi - lo) / (arr[hi] - arr[lo])) * (x - arr[lo])); // Condition of target found if (arr[pos] == x) return pos; // If x is larger, x is in right sub array if (arr[pos] < x) return interpolationSearch(arr, pos + 1, hi, x); // If x is smaller, x is in left sub array if (arr[pos] > x) return interpolationSearch(arr, lo, pos - 1, x); } return -1; } // Driver Code public static void main(String[] args) { // Array of items on which search will // be conducted. int arr[] = { 10, 12, 13, 16, 18, 19, 20, 21, 22, 23, 24, 33, 35, 42, 47 }; int n = arr.length; // Element to be searched int x = 18; int index = interpolationSearch(arr, 0, n - 1, x); // If element was found if (index != -1) System.out.println(\"Element found at index \" + index); else System.out.println(\"Element not found.\"); }} // This code is contributed by equbalzeeshan",
"e": 9197,
"s": 7326,
"text": null
},
{
"code": "# Python3 program to implement# interpolation search# with recursion # If x is present in arr[0..n-1], then# returns index of it, else returns -1. def interpolationSearch(arr, lo, hi, x): # Since array is sorted, an element present # in array must be in range defined by corner if (lo <= hi and x >= arr[lo] and x <= arr[hi]): # Probing the position with keeping # uniform distribution in mind. pos = lo + ((hi - lo) // (arr[hi] - arr[lo]) * (x - arr[lo])) # Condition of target found if arr[pos] == x: return pos # If x is larger, x is in right subarray if arr[pos] < x: return interpolationSearch(arr, pos + 1, hi, x) # If x is smaller, x is in left subarray if arr[pos] > x: return interpolationSearch(arr, lo, pos - 1, x) return -1 # Driver code # Array of items in which# search will be conductedarr = [10, 12, 13, 16, 18, 19, 20, 21, 22, 23, 24, 33, 35, 42, 47]n = len(arr) # Element to be searchedx = 18index = interpolationSearch(arr, 0, n - 1, x) if index != -1: print(\"Element found at index\", index)else: print(\"Element not found\") # This code is contributed by Hardik Jain",
"e": 10518,
"s": 9197,
"text": null
},
{
"code": "// C# program to implement // interpolation searchusing System; class GFG{ // If x is present in // arr[0..n-1], then // returns index of it, // else returns -1.static int interpolationSearch(int []arr, int lo, int hi, int x){ int pos; // Since array is sorted, an element // present in array must be in range // defined by corner if (lo <= hi && x >= arr[lo] && x <= arr[hi]) { // Probing the position // with keeping uniform // distribution in mind. pos = lo + (((hi - lo) / (arr[hi] - arr[lo])) * (x - arr[lo])); // Condition of // target found if(arr[pos] == x) return pos; // If x is larger, x is in right sub array if(arr[pos] < x) return interpolationSearch(arr, pos + 1, hi, x); // If x is smaller, x is in left sub array if(arr[pos] > x) return interpolationSearch(arr, lo, pos - 1, x); } return -1;} // Driver Code public static void Main() { // Array of items on which search will // be conducted. int []arr = new int[]{ 10, 12, 13, 16, 18, 19, 20, 21, 22, 23, 24, 33, 35, 42, 47 }; // Element to be searched int x = 18; int n = arr.Length; int index = interpolationSearch(arr, 0, n - 1, x); // If element was found if (index != -1) Console.WriteLine(\"Element found at index \" + index); else Console.WriteLine(\"Element not found.\");}} // This code is contributed by equbalzeeshan",
"e": 12351,
"s": 10518,
"text": null
},
{
"code": "<script>// Javascript program to implement Interpolation Search // If x is present in arr[0..n-1], then returns// index of it, else returns -1. function interpolationSearch(arr, lo, hi, x){ let pos; // Since array is sorted, an element present // in array must be in range defined by corner if (lo <= hi && x >= arr[lo] && x <= arr[hi]) { // Probing the position with keeping // uniform distribution in mind. pos = lo + Math.floor(((hi - lo) / (arr[hi] - arr[lo])) * (x - arr[lo]));; // Condition of target found if (arr[pos] == x){ return pos; } // If x is larger, x is in right sub array if (arr[pos] < x){ return interpolationSearch(arr, pos + 1, hi, x); } // If x is smaller, x is in left sub array if (arr[pos] > x){ return interpolationSearch(arr, lo, pos - 1, x); } } return -1;} // Driver Codelet arr = [10, 12, 13, 16, 18, 19, 20, 21, 22, 23, 24, 33, 35, 42, 47]; let n = arr.length; // Element to be searchedlet x = 18let index = interpolationSearch(arr, 0, n - 1, x); // If element was foundif (index != -1){ document.write(`Element found at index ${index}`)}else{ document.write(\"Element not found\");} // This code is contributed by _saurabh_jaiswal</script>",
"e": 13675,
"s": 12351,
"text": null
},
{
"code": null,
"e": 13700,
"s": 13675,
"text": "Element found at index 4"
},
{
"code": null,
"e": 14124,
"s": 13700,
"text": "This article is contributed by Aayu Sachdev. If you like GeeksforGeeks and would like to contribute, you can also write an article using write.geeksforgeeks.org or mail your article to [email protected]. See your article appearing on the GeeksforGeeks main page and help other Geeks.Please write comments if you find anything incorrect, or if you want to share more information about the topic discussed above. "
},
{
"code": null,
"e": 14129,
"s": 14124,
"text": "vt_m"
},
{
"code": null,
"e": 14148,
"s": 14129,
"text": "Saurabh Agarwal 10"
},
{
"code": null,
"e": 14162,
"s": 14148,
"text": "DeepikaPathak"
},
{
"code": null,
"e": 14172,
"s": 14162,
"text": "Code_Mech"
},
{
"code": null,
"e": 14185,
"s": 14172,
"text": "UtkarshBehre"
},
{
"code": null,
"e": 14207,
"s": 14185,
"text": "assasinationprattayan"
},
{
"code": null,
"e": 14215,
"s": 14207,
"text": "hdkjain"
},
{
"code": null,
"e": 14229,
"s": 14215,
"text": "equbalzeeshan"
},
{
"code": null,
"e": 14242,
"s": 14229,
"text": "childemperor"
},
{
"code": null,
"e": 14259,
"s": 14242,
"text": "_saurabh_jaiswal"
},
{
"code": null,
"e": 14275,
"s": 14259,
"text": "amartyaghoshgfg"
},
{
"code": null,
"e": 14289,
"s": 14275,
"text": "shreyasnaphad"
},
{
"code": null,
"e": 14302,
"s": 14289,
"text": "satyajit1910"
},
{
"code": null,
"e": 14312,
"s": 14302,
"text": "Searching"
},
{
"code": null,
"e": 14331,
"s": 14312,
"text": "Technical Scripter"
},
{
"code": null,
"e": 14341,
"s": 14331,
"text": "Searching"
},
{
"code": null,
"e": 14439,
"s": 14341,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 14507,
"s": 14439,
"text": "Maximum and minimum of an array using minimum number of comparisons"
},
{
"code": null,
"e": 14563,
"s": 14507,
"text": "K'th Smallest/Largest Element in Unsorted Array | Set 1"
},
{
"code": null,
"e": 14611,
"s": 14563,
"text": "Search an element in a sorted and rotated array"
},
{
"code": null,
"e": 14658,
"s": 14611,
"text": "Search, insert and delete in an unsorted array"
},
{
"code": null,
"e": 14682,
"s": 14658,
"text": "Find the Missing Number"
},
{
"code": null,
"e": 14726,
"s": 14682,
"text": "k largest(or smallest) elements in an array"
},
{
"code": null,
"e": 14770,
"s": 14726,
"text": "Program to find largest element in an array"
},
{
"code": null,
"e": 14793,
"s": 14770,
"text": "Two Pointers Technique"
},
{
"code": null,
"e": 14884,
"s": 14793,
"text": "Given an array of size n and a number k, find all elements that appear more than n/k times"
}
] |
How to specify an alternate text for an image in HTML ? | 09 Sep, 2020
The alternative text for an image is useful when the image not displayed/loaded. If the image is not loaded the its alternative text is displayed on the web page. Alternative text is the alternative information for an image.
Example 1: In this example, the image path contains the image so it will display the image.
HTML
<!DOCTYPE html> <html> <head> <title> How to specify an alternate text for an image? </title> </head> <body> <h1 style="color:green;">GeeksforGeeks</h1> <h2> How to specify an alternate text for an image? </h2> <img src= "https://media.geeksforgeeks.org/wp-content/uploads/20190506164011/logo3.png" alt="GeeksforGeeks logo"> </body> </html>
Output:
Example 2: In this example, the image path is not correct so it will display alternative text information.
HTML
<!DOCTYPE html> <html> <head> <title> How to specify an alternate text for an image? </title> </head> <body> <h1 style="color:green;">GeeksforGeeks</h1> <h2> How to specify an alternate text for an image? </h2> <img src= "geeks.png" alt="GeeksforGeeks logo"> </body> </html>
Output:
CSS-Misc
HTML-Misc
CSS
HTML
Web Technologies
Web technologies Questions
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here. | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n09 Sep, 2020"
},
{
"code": null,
"e": 253,
"s": 28,
"text": "The alternative text for an image is useful when the image not displayed/loaded. If the image is not loaded the its alternative text is displayed on the web page. Alternative text is the alternative information for an image."
},
{
"code": null,
"e": 345,
"s": 253,
"text": "Example 1: In this example, the image path contains the image so it will display the image."
},
{
"code": null,
"e": 350,
"s": 345,
"text": "HTML"
},
{
"code": "<!DOCTYPE html> <html> <head> <title> How to specify an alternate text for an image? </title> </head> <body> <h1 style=\"color:green;\">GeeksforGeeks</h1> <h2> How to specify an alternate text for an image? </h2> <img src= \"https://media.geeksforgeeks.org/wp-content/uploads/20190506164011/logo3.png\" alt=\"GeeksforGeeks logo\"> </body> </html>",
"e": 762,
"s": 350,
"text": null
},
{
"code": null,
"e": 770,
"s": 762,
"text": "Output:"
},
{
"code": null,
"e": 877,
"s": 770,
"text": "Example 2: In this example, the image path is not correct so it will display alternative text information."
},
{
"code": null,
"e": 882,
"s": 877,
"text": "HTML"
},
{
"code": "<!DOCTYPE html> <html> <head> <title> How to specify an alternate text for an image? </title> </head> <body> <h1 style=\"color:green;\">GeeksforGeeks</h1> <h2> How to specify an alternate text for an image? </h2> <img src= \"geeks.png\" alt=\"GeeksforGeeks logo\"> </body> </html>",
"e": 1228,
"s": 882,
"text": null
},
{
"code": null,
"e": 1236,
"s": 1228,
"text": "Output:"
},
{
"code": null,
"e": 1245,
"s": 1236,
"text": "CSS-Misc"
},
{
"code": null,
"e": 1255,
"s": 1245,
"text": "HTML-Misc"
},
{
"code": null,
"e": 1259,
"s": 1255,
"text": "CSS"
},
{
"code": null,
"e": 1264,
"s": 1259,
"text": "HTML"
},
{
"code": null,
"e": 1281,
"s": 1264,
"text": "Web Technologies"
},
{
"code": null,
"e": 1308,
"s": 1281,
"text": "Web technologies Questions"
},
{
"code": null,
"e": 1313,
"s": 1308,
"text": "HTML"
}
] |
base64.b64decode() in Python | 26 Mar, 2020
With the help of base64.b64decode() method, we can decode the binary string into normal form.
Syntax : base64.b64decode(b_string)
Return : Return the decoded string.
Example #1 :In this example we can see that by using base64.b64decode() method, we are able to get the decoded string which can be in binary form by using this method.
# import base64from base64 import b64decodefrom base64 import b64encode s = b'GeeksForGeeks's = b64encode(s)# Using base64.b64decode() methodgfg = b64decode(s) print(gfg)
Output :
b’GeeksForGeeks’
Example #2 :
# import base64from base64 import b64decodefrom base64 import b64encode s = b'Hello World's = b64encode(s)# Using base64.b64decode() methodgfg = b64decode(s) print(gfg)
Output :
b’Hello World’
Python base64-module
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here. | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n26 Mar, 2020"
},
{
"code": null,
"e": 122,
"s": 28,
"text": "With the help of base64.b64decode() method, we can decode the binary string into normal form."
},
{
"code": null,
"e": 158,
"s": 122,
"text": "Syntax : base64.b64decode(b_string)"
},
{
"code": null,
"e": 194,
"s": 158,
"text": "Return : Return the decoded string."
},
{
"code": null,
"e": 362,
"s": 194,
"text": "Example #1 :In this example we can see that by using base64.b64decode() method, we are able to get the decoded string which can be in binary form by using this method."
},
{
"code": "# import base64from base64 import b64decodefrom base64 import b64encode s = b'GeeksForGeeks's = b64encode(s)# Using base64.b64decode() methodgfg = b64decode(s) print(gfg)",
"e": 535,
"s": 362,
"text": null
},
{
"code": null,
"e": 544,
"s": 535,
"text": "Output :"
},
{
"code": null,
"e": 561,
"s": 544,
"text": "b’GeeksForGeeks’"
},
{
"code": null,
"e": 574,
"s": 561,
"text": "Example #2 :"
},
{
"code": "# import base64from base64 import b64decodefrom base64 import b64encode s = b'Hello World's = b64encode(s)# Using base64.b64decode() methodgfg = b64decode(s) print(gfg)",
"e": 745,
"s": 574,
"text": null
},
{
"code": null,
"e": 754,
"s": 745,
"text": "Output :"
},
{
"code": null,
"e": 769,
"s": 754,
"text": "b’Hello World’"
},
{
"code": null,
"e": 790,
"s": 769,
"text": "Python base64-module"
},
{
"code": null,
"e": 797,
"s": 790,
"text": "Python"
}
] |
Dart – Data Types | 14 Jul, 2020
Like other languages (C, C++, Java), whenever a variable is created, each variable has an associated data type. In Dart language, there is the type of values that can be represented and manipulated in a programming language. The data type classification is as given below:
1. Number: The number in Dart Programming is the data type that is used to hold the numeric value. Dart numbers can be classified as:
The int data type is used to represent whole numbers.
The double data type is used to represent 64-bit floating-point numbers.
The num type is an inherited data type of the int and double types.
Dart
void main() { // declare an integer int num1 = 2; // declare a double value double num2 = 1.5; // print the values print(num1); print(num2); var a1 = num.parse("1"); var b1 = num.parse("2.34"); var c1 = a1+b1; print("Product = ${c1}"); }
Output:
2
1.5
Product = 3.34
2. String: It used to represent a sequence of characters. It is a sequence of UTF-16 code units. The keyword string is used to represent string literals. String values are embedded in either single or double-quotes.
Dart
void main() { String string = 'Geeks''for''Geeks'; String str = 'Coding is '; String str1 = 'Fun'; print (string); print (str + str1);}
Output:
GeeksforGeeks
Coding is Fun
3. Boolean: It represents Boolean values true and false. The keyword bool is used to represent a Boolean literal in DART.
Dart
void main() { String str = 'Coding is '; String str1 = 'Fun'; bool val = (str==str1); print (val); }
Output:
false
4. List: List data type is similar to arrays in other programming languages. A list is used to represent a collection of objects. It is an ordered group of objects.
Dart
void main() { List gfg = new List(3); gfg[0] = 'Geeks'; gfg[1] = 'For'; gfg[2] = 'Geeks'; print(gfg); print(gfg[0]); }
Output:
[Geeks, For, Geeks]
Geeks
5. Map: The Map object is a key and value pair. Keys and values on a map may be of any type. It is a dynamic collection.
Dart
void main() { Map gfg = new Map(); gfg['First'] = 'Geeks'; gfg['Second'] = 'For'; gfg['Third'] = 'Geeks'; print(gfg); }
Output:
{First: Geeks, Second: For, Third: Geeks}
Note: If the type of a variable is not specified, the variable’s type is dynamic. The dynamic keyword is used as a type annotation explicitly.
Dart Data-types
Dart-basics
Dart
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Flutter - DropDownButton Widget
Flutter - Custom Bottom Navigation Bar
Flutter - Row and Column Widgets
Flutter - Checkbox Widget
ListView Class in Flutter
Flutter - Stack Widget
Dart Tutorial
How to Append or Concatenate Strings in Dart?
Flutter - Search Bar
Container class in Flutter | [
{
"code": null,
"e": 53,
"s": 25,
"text": "\n14 Jul, 2020"
},
{
"code": null,
"e": 327,
"s": 53,
"text": "Like other languages (C, C++, Java), whenever a variable is created, each variable has an associated data type. In Dart language, there is the type of values that can be represented and manipulated in a programming language. The data type classification is as given below: "
},
{
"code": null,
"e": 462,
"s": 327,
"text": "1. Number: The number in Dart Programming is the data type that is used to hold the numeric value. Dart numbers can be classified as: "
},
{
"code": null,
"e": 516,
"s": 462,
"text": "The int data type is used to represent whole numbers."
},
{
"code": null,
"e": 589,
"s": 516,
"text": "The double data type is used to represent 64-bit floating-point numbers."
},
{
"code": null,
"e": 657,
"s": 589,
"text": "The num type is an inherited data type of the int and double types."
},
{
"code": null,
"e": 662,
"s": 657,
"text": "Dart"
},
{
"code": "void main() { // declare an integer int num1 = 2; // declare a double value double num2 = 1.5; // print the values print(num1); print(num2); var a1 = num.parse(\"1\"); var b1 = num.parse(\"2.34\"); var c1 = a1+b1; print(\"Product = ${c1}\"); }",
"e": 962,
"s": 662,
"text": null
},
{
"code": null,
"e": 973,
"s": 964,
"text": "Output: "
},
{
"code": null,
"e": 995,
"s": 973,
"text": "2\n1.5\nProduct = 3.34\n"
},
{
"code": null,
"e": 1213,
"s": 995,
"text": "2. String: It used to represent a sequence of characters. It is a sequence of UTF-16 code units. The keyword string is used to represent string literals. String values are embedded in either single or double-quotes. "
},
{
"code": null,
"e": 1218,
"s": 1213,
"text": "Dart"
},
{
"code": "void main() { String string = 'Geeks''for''Geeks'; String str = 'Coding is '; String str1 = 'Fun'; print (string); print (str + str1);}",
"e": 1378,
"s": 1218,
"text": null
},
{
"code": null,
"e": 1389,
"s": 1380,
"text": "Output: "
},
{
"code": null,
"e": 1418,
"s": 1389,
"text": "GeeksforGeeks\nCoding is Fun\n"
},
{
"code": null,
"e": 1542,
"s": 1418,
"text": "3. Boolean: It represents Boolean values true and false. The keyword bool is used to represent a Boolean literal in DART. "
},
{
"code": null,
"e": 1547,
"s": 1542,
"text": "Dart"
},
{
"code": "void main() { String str = 'Coding is '; String str1 = 'Fun'; bool val = (str==str1); print (val); }",
"e": 1659,
"s": 1547,
"text": null
},
{
"code": null,
"e": 1670,
"s": 1661,
"text": "Output: "
},
{
"code": null,
"e": 1677,
"s": 1670,
"text": "false\n"
},
{
"code": null,
"e": 1844,
"s": 1677,
"text": "4. List: List data type is similar to arrays in other programming languages. A list is used to represent a collection of objects. It is an ordered group of objects. "
},
{
"code": null,
"e": 1849,
"s": 1844,
"text": "Dart"
},
{
"code": "void main() { List gfg = new List(3); gfg[0] = 'Geeks'; gfg[1] = 'For'; gfg[2] = 'Geeks'; print(gfg); print(gfg[0]); } ",
"e": 1997,
"s": 1849,
"text": null
},
{
"code": null,
"e": 2009,
"s": 1999,
"text": "Output: "
},
{
"code": null,
"e": 2036,
"s": 2009,
"text": "[Geeks, For, Geeks]\nGeeks\n"
},
{
"code": null,
"e": 2159,
"s": 2036,
"text": "5. Map: The Map object is a key and value pair. Keys and values on a map may be of any type. It is a dynamic collection. "
},
{
"code": null,
"e": 2164,
"s": 2159,
"text": "Dart"
},
{
"code": "void main() { Map gfg = new Map(); gfg['First'] = 'Geeks'; gfg['Second'] = 'For'; gfg['Third'] = 'Geeks'; print(gfg); } ",
"e": 2295,
"s": 2164,
"text": null
},
{
"code": null,
"e": 2306,
"s": 2297,
"text": "Output: "
},
{
"code": null,
"e": 2349,
"s": 2306,
"text": "{First: Geeks, Second: For, Third: Geeks}\n"
},
{
"code": null,
"e": 2492,
"s": 2349,
"text": "Note: If the type of a variable is not specified, the variable’s type is dynamic. The dynamic keyword is used as a type annotation explicitly."
},
{
"code": null,
"e": 2508,
"s": 2492,
"text": "Dart Data-types"
},
{
"code": null,
"e": 2520,
"s": 2508,
"text": "Dart-basics"
},
{
"code": null,
"e": 2525,
"s": 2520,
"text": "Dart"
},
{
"code": null,
"e": 2623,
"s": 2525,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 2655,
"s": 2623,
"text": "Flutter - DropDownButton Widget"
},
{
"code": null,
"e": 2694,
"s": 2655,
"text": "Flutter - Custom Bottom Navigation Bar"
},
{
"code": null,
"e": 2727,
"s": 2694,
"text": "Flutter - Row and Column Widgets"
},
{
"code": null,
"e": 2753,
"s": 2727,
"text": "Flutter - Checkbox Widget"
},
{
"code": null,
"e": 2779,
"s": 2753,
"text": "ListView Class in Flutter"
},
{
"code": null,
"e": 2802,
"s": 2779,
"text": "Flutter - Stack Widget"
},
{
"code": null,
"e": 2816,
"s": 2802,
"text": "Dart Tutorial"
},
{
"code": null,
"e": 2862,
"s": 2816,
"text": "How to Append or Concatenate Strings in Dart?"
},
{
"code": null,
"e": 2883,
"s": 2862,
"text": "Flutter - Search Bar"
}
] |
What does built-in class attribute __name__ do in Python?
| This built-in attributes prints the name of the class, type, function, method, descriptor, or generator instance.
For example, if the python interpreter is running that module (the source file) as the main program, it sets the special __name__ variable to have a value "__main__". If this file is being imported from another module, __name__ will be set to the module's name.
The following code illustrates the use of __name__.
class Bar(object):
def foo():
""" This is an example of how a doc_string looks like.
This string gives useful information about the function being defined.
"""
pass
print foo.__name__
print Bar.__name__
This gives the output
foo
Bar | [
{
"code": null,
"e": 1176,
"s": 1062,
"text": "This built-in attributes prints the name of the class, type, function, method, descriptor, or generator instance."
},
{
"code": null,
"e": 1438,
"s": 1176,
"text": "For example, if the python interpreter is running that module (the source file) as the main program, it sets the special __name__ variable to have a value \"__main__\". If this file is being imported from another module, __name__ will be set to the module's name."
},
{
"code": null,
"e": 1490,
"s": 1438,
"text": "The following code illustrates the use of __name__."
},
{
"code": null,
"e": 1739,
"s": 1490,
"text": "class Bar(object):\n def foo():\n\n \"\"\" This is an example of how a doc_string looks like.\n\n This string gives useful information about the function being defined.\n\n \"\"\"\n\n pass\n\n print foo.__name__\nprint Bar.__name__"
},
{
"code": null,
"e": 1761,
"s": 1739,
"text": "This gives the output"
},
{
"code": null,
"e": 1769,
"s": 1761,
"text": "foo\nBar"
}
] |
Conversion of whole String to uppercase or lowercase using STL in C++ | In this tutorial, we will be discussing a program to understand conversion of whole string to uppercase or lowercase using STL in C++.
To perform this transformation, C++ STL provides toupper() and tolower() functions to convert to uppercase and lowercase respectively.
Live Demo
#include<bits/stdc++.h>
using namespace std;
int main(){
string su = "Tutorials point";
transform(su.begin(), su.end(), su.begin(), ::toupper);
cout << su << endl;
string sl = "Tutorials Point";
transform(sl.begin(), sl.end(), sl.begin(), ::tolower);
cout << sl << endl;
return 0;
}
TUTORIALS POINT
tutorials point | [
{
"code": null,
"e": 1197,
"s": 1062,
"text": "In this tutorial, we will be discussing a program to understand conversion of whole string to uppercase or lowercase using STL in C++."
},
{
"code": null,
"e": 1332,
"s": 1197,
"text": "To perform this transformation, C++ STL provides toupper() and tolower() functions to convert to uppercase and lowercase respectively."
},
{
"code": null,
"e": 1343,
"s": 1332,
"text": " Live Demo"
},
{
"code": null,
"e": 1647,
"s": 1343,
"text": "#include<bits/stdc++.h>\nusing namespace std;\nint main(){\n string su = \"Tutorials point\";\n transform(su.begin(), su.end(), su.begin(), ::toupper);\n cout << su << endl;\n string sl = \"Tutorials Point\";\n transform(sl.begin(), sl.end(), sl.begin(), ::tolower);\n cout << sl << endl;\n return 0;\n}"
},
{
"code": null,
"e": 1679,
"s": 1647,
"text": "TUTORIALS POINT\ntutorials point"
}
] |
Change every letter to next letter - JavaScript | We are required to write a JavaScript function that takes in a string and changes every letter of the string from the English alphabets to its succeeding element.
For example: If the string is −
const str = 'how are you';
Then the output should be −
const output = 'ipx bsf zpv'
Following is the code −
const str = 'how are you';
const isAlpha = code => (code >= 65 && code <= 90) || (code >= 97 && code
<= 122);
const isLast = code => code === 90 || code === 122;
const nextLetterString = str => {
const strArr = str.split('');
return strArr.reduce((acc, val) => {
const code = val.charCodeAt(0);
if(!isAlpha(code)){
return acc+val;
};
if(isLast(code)){
return acc+String.fromCharCode(code-25);
};
return acc+String.fromCharCode(code+1);
}, '');
};
console.log(nextLetterString(str));
Following is the output in the console −
ipx bsf zpv | [
{
"code": null,
"e": 1225,
"s": 1062,
"text": "We are required to write a JavaScript function that takes in a string and changes every letter of the string from the English alphabets to its succeeding element."
},
{
"code": null,
"e": 1257,
"s": 1225,
"text": "For example: If the string is −"
},
{
"code": null,
"e": 1284,
"s": 1257,
"text": "const str = 'how are you';"
},
{
"code": null,
"e": 1312,
"s": 1284,
"text": "Then the output should be −"
},
{
"code": null,
"e": 1341,
"s": 1312,
"text": "const output = 'ipx bsf zpv'"
},
{
"code": null,
"e": 1365,
"s": 1341,
"text": "Following is the code −"
},
{
"code": null,
"e": 1911,
"s": 1365,
"text": "const str = 'how are you';\nconst isAlpha = code => (code >= 65 && code <= 90) || (code >= 97 && code\n<= 122);\nconst isLast = code => code === 90 || code === 122;\nconst nextLetterString = str => {\n const strArr = str.split('');\n return strArr.reduce((acc, val) => {\n const code = val.charCodeAt(0);\n if(!isAlpha(code)){\n return acc+val;\n };\n if(isLast(code)){\n return acc+String.fromCharCode(code-25);\n };\n return acc+String.fromCharCode(code+1);\n }, '');\n};\nconsole.log(nextLetterString(str));"
},
{
"code": null,
"e": 1952,
"s": 1911,
"text": "Following is the output in the console −"
},
{
"code": null,
"e": 1964,
"s": 1952,
"text": "ipx bsf zpv"
}
] |
Updating Your Github Repository Using Python - Towards Data Science | At least twice a day I run the following commands:
>>>git fetch upstream master>>>git merge upstream/master -m 'Here we go again...again'>>>git push
At 10 words each time, run twice a day over the course of my 15 week bootcamp comes to 1500 words. To put that in perspective, that is the equivalent of three high quality blogs that I could be writing for you. Truly, something has to be done.
Git python creates a repo object that allows you to interact with either your own repositories or public repositories that your code is dependent on.
>>>pip3 install GitPython
The installation takes care to check the dependencies of the library for you. However, you should add your username and password to your git configuration.
You can simply place either of the following two code snippets at the top of your script to programmatically update your local repository.
If you want to update your code local repository from the remote origin, the code is simple:
However, if you want to update from a remote upstream repository, the code is a little bit different:
My previous article outlined how to make a command line tool using python. Let’s use that tutorial to build an “auto updater”.
>>>mv autoupdate.py autoupdate>>>chmod +x autoupdate>>>cp autoupdate ~/.local/bin/autoupdate>>>source ~/.zshrc>>>autoupdate
There we go, so much easier! New lecture? No problem. The New York Times updates their repository? My maps are updated next time I plot them. | [
{
"code": null,
"e": 98,
"s": 47,
"text": "At least twice a day I run the following commands:"
},
{
"code": null,
"e": 196,
"s": 98,
"text": ">>>git fetch upstream master>>>git merge upstream/master -m 'Here we go again...again'>>>git push"
},
{
"code": null,
"e": 440,
"s": 196,
"text": "At 10 words each time, run twice a day over the course of my 15 week bootcamp comes to 1500 words. To put that in perspective, that is the equivalent of three high quality blogs that I could be writing for you. Truly, something has to be done."
},
{
"code": null,
"e": 590,
"s": 440,
"text": "Git python creates a repo object that allows you to interact with either your own repositories or public repositories that your code is dependent on."
},
{
"code": null,
"e": 616,
"s": 590,
"text": ">>>pip3 install GitPython"
},
{
"code": null,
"e": 772,
"s": 616,
"text": "The installation takes care to check the dependencies of the library for you. However, you should add your username and password to your git configuration."
},
{
"code": null,
"e": 911,
"s": 772,
"text": "You can simply place either of the following two code snippets at the top of your script to programmatically update your local repository."
},
{
"code": null,
"e": 1004,
"s": 911,
"text": "If you want to update your code local repository from the remote origin, the code is simple:"
},
{
"code": null,
"e": 1106,
"s": 1004,
"text": "However, if you want to update from a remote upstream repository, the code is a little bit different:"
},
{
"code": null,
"e": 1233,
"s": 1106,
"text": "My previous article outlined how to make a command line tool using python. Let’s use that tutorial to build an “auto updater”."
},
{
"code": null,
"e": 1357,
"s": 1233,
"text": ">>>mv autoupdate.py autoupdate>>>chmod +x autoupdate>>>cp autoupdate ~/.local/bin/autoupdate>>>source ~/.zshrc>>>autoupdate"
}
] |
Management Concepts - Quick Guide | There are a number of costing models used in the domain of business and Activity-Based Costing is one of them. In activity-based costing, various activities in the organization are identified and assigned with a cost.
When it comes to pricing of products and services produced by the company, activity cost is calculated for activities that have been performed in the process of producing the products and services. In other words, activity-based costing assigns indirect costs to direct costs. These indirect costs are also known as overheads in the business world.
Let us take an example. There are a number of activities performed in a business organization and these activities belong to many departments and phases such as planning, manufacturing, or engineering. All these activities eventually contribute to producing products or offering services to the end clients.
Quality Control activity of a garment manufacturing company is one of the fine examples for such an activity. By identifying the cost for the Quality Control function, the management can recognize the costing for each product, service, or resource. This understanding helps the executive management to run the business organization smoothly.
Activity-based costing is more effective when used in long-term rather than in short-term.
When it comes to implementing activity-based costing in an organization, commitment of senior management is a must. Activity-based costing requires visionary leadership that should sustain long-term. Therefore, it is required that the senior management has comprehensive awareness of how activity-based costing works and management's interaction points with the process.
Before implementing activity-based costing for the entire organization, it is always a great idea to do a pilot run. The best candidate for this pilot run is the department that suffers from profit making deficiencies.
Although one might take it as risky, such departments may stand an opportunity to succeed when managed with activity-based costing. Lastly, this would give the organization a measurable illustration of activity-based costing and its success. In case, if no cost saving occurs after the pilot study is implemented, it is most likely that the model has not been properly implemented or the model does not suit the department or company as a whole.
If an organization is planning to impalement activity-based costing, commissioning a core team is of great advantage. If the organization is small in scale, a team can be commissioned with the help of volunteers, who will contribute their time on part-time basis. This team is responsible for identifying and assessing the activities that should be revised in order to optimize the product or service.
The team should ideally consist of professionals from all practices in the organization. However, hiring an external consultant could also become a plus.
When implementing activity-based costing, it is advantageous for an organization to use computer software for calculations and data storage. The computer software can be a simple database that will store the information such as customized ABC software for the organization or a general-purpose off-the-shelf software.
The procedure for successful implementation of activity-based costing in an organization is as follows:
Identification of a team that is responsible for implementing activity-based costing.
Identification of a team that is responsible for implementing activity-based costing.
The team identifies and assesses the activities that involve in products and services in question.
The team identifies and assesses the activities that involve in products and services in question.
The team selects a subset of activities that should be taken for activity-based costing.
The team selects a subset of activities that should be taken for activity-based costing.
The team identifies the elements of selected activities that cost too much money for the organization. The team should pay attention to detail in this step as many activities may shield their cost and may look innocent from the outside.
The team identifies the elements of selected activities that cost too much money for the organization. The team should pay attention to detail in this step as many activities may shield their cost and may look innocent from the outside.
The fixed costs and variable costs related to activities are identified.
The fixed costs and variable costs related to activities are identified.
The cost information gathered will be entered to the ABC software.
The cost information gathered will be entered to the ABC software.
The software then performs calculations and produces reports to support management decisions.
The software then performs calculations and produces reports to support management decisions.
Based on the reports, management can identify the steps that should be taken to increase profit margins in order to make the activities more efficient.
Based on the reports, management can identify the steps that should be taken to increase profit margins in order to make the activities more efficient.
The management steps and decisions taken after an activity-based costing experience is generally known as Activity-Based Management. In this process, the management makes business decisions to optimize certain activities and let some activities go.
Sometimes, organizations face the risk of spending too much time, money and resources on gathering and analysing data required for activity-based costing model. This can eventually lead to frustration and the organization may give up on ABC eventually.
Failure to connect the outcomes from the activity-based costing usually hinders the success of the implementation. This usually happens when the decision makers are not aware of the "big picture" of how activity-based costing can be used throughout the organization. Understanding the concepts and getting actively involved in the ABC implementation process can easily eliminate this.
If the business organization requires quick fixes, activity-based costing will not be the correct answer. Therefore, ABC should not be implemented for situations where quick wins are required.
Activity-based costing is a different way of looking at an organization's costs in order to optimize profit margins.
If ABC is implemented with the correct understanding for the correct purpose, it can return a great long-term value to the organization.
Agile Project Management is one of the revolutionary methods introduced for the practice of project management. This is one of the latest project management strategies that is mainly applied to project management practice in software development. Therefore, it is best to relate agile project management to the software development process when understanding it.
From the inception of software development as a business, there have been a number of processes following, such as the waterfall model. With the advancement of software development, technologies and business requirements, the traditional models are not robust enough to cater the demands.
Therefore, more flexible software development models were required in order to address the agility of the requirements. As a result of this, the information technology community developed agile software development models.
'Agile' is an umbrella term used for identifying various models used for agile development, such as Scrum. Since agile development model is different from conventional models, agile project management is a specialized area in project management.
It is required for one to have a good understanding of the agile development process in order to understand agile project management.
There are many differences in agile development model when compared to traditional models:
The agile model emphasizes on the fact that entire team should be a tightly integrated unit. This includes the developers, quality assurance, project management, and the customer.
The agile model emphasizes on the fact that entire team should be a tightly integrated unit. This includes the developers, quality assurance, project management, and the customer.
Frequent communication is one of the key factors that makes this integration possible. Therefore, daily meetings are held in order to determine the day's work and dependencies.
Frequent communication is one of the key factors that makes this integration possible. Therefore, daily meetings are held in order to determine the day's work and dependencies.
Deliveries are short-term. Usually a delivery cycle ranges from one week to four weeks. These are commonly known as sprints.
Deliveries are short-term. Usually a delivery cycle ranges from one week to four weeks. These are commonly known as sprints.
Agile project teams follow open communication techniques and tools which enable the team members (including the customer) to express their views and feedback openly and quickly. These comments are then taken into consideration when shaping the requirements and implementation of the software.
Agile project teams follow open communication techniques and tools which enable the team members (including the customer) to express their views and feedback openly and quickly. These comments are then taken into consideration when shaping the requirements and implementation of the software.
In an agile project, the entire team is responsible in managing the team and it is not just the project manager's responsibility. When it comes to processes and procedures, the common sense is used over the written policies.
This makes sure that there is no delay is management decision making and therefore things can progress faster.
In addition to being a manager, the agile project management function should also demonstrate the leadership and skills in motivating others. This helps retaining the spirit among the team members and gets the team to follow discipline.
Agile project manager is not the 'boss' of the software development team. Rather, this function facilitates and coordinates the activities and resources required for quality and speedy software development.
The responsibilities of an agile project management function are given below. From one project to another, these responsibilities can slightly change and are interpreted differently.
Responsible for maintaining the agile values and practices in the project team.
Responsible for maintaining the agile values and practices in the project team.
The agile project manager removes impediments as the core function of the role.
The agile project manager removes impediments as the core function of the role.
Helps the project team members to turn the requirements backlog into working software functionality.
Helps the project team members to turn the requirements backlog into working software functionality.
Facilitates and encourages effective and open communication within the team.
Facilitates and encourages effective and open communication within the team.
Responsible for holding agile meetings that discusses the short-term plans and plans to overcome obstacles.
Responsible for holding agile meetings that discusses the short-term plans and plans to overcome obstacles.
Enhances the tool and practices used in the development process.
Enhances the tool and practices used in the development process.
Agile project manager is the chief motivator of the team and plays the mentor role for the team members as well.
Agile project manager is the chief motivator of the team and plays the mentor role for the team members as well.
manage the software development team.
manage the software development team.
overrule the informed decisions taken by the team members.
overrule the informed decisions taken by the team members.
direct team members to perform tasks or routines.
direct team members to perform tasks or routines.
drive the team to achieve specific milestones or deliveries.
drive the team to achieve specific milestones or deliveries.
assign task to the team members.
assign task to the team members.
make decisions on behalf of the team.
make decisions on behalf of the team.
involve in technical decision making or deriving the product strategy.
involve in technical decision making or deriving the product strategy.
In agile projects, it is everyone's (developers, quality assurance engineers, designers, etc.) responsibility to manage the project to achieve the objectives of the project.
In addition to that, the agile project manager plays a key role in agile team in order to provide the resources, keep the team motivated, remove blocking issues, and resolve impediments as early as possible.
In this sense, an agile project manager is a mentor and a protector of an agile team, rather than a manager.
Management is a topic that is as vast as the sky. When it comes to the skills that are required to become a good manager, the list may be endless.
In everyday life, we observe many people considering management as - whatever that needs to be done in order to keep a company afloat - but in reality, it is far more complicated than the common belief.
So let us get down to the most basic skills that need to be acquired, if one is to become a successful manager.
You will understand that management involves managing people and thereby, managing the output garnered in favor of the company. According to Dr. Ken Blanchard, in his famous book "Putting the One minute Manager to Work", the ABC's of management world are as below:
Activators - The type of strategy followed by a manager before his workforce sets on with performance.
Activators - The type of strategy followed by a manager before his workforce sets on with performance.
Behaviors - How the workforce performs or behaves within the activity or situation as a result of activators or consequences.
Behaviors - How the workforce performs or behaves within the activity or situation as a result of activators or consequences.
Consequences - How the manager handles the workforce after the performance.
Consequences - How the manager handles the workforce after the performance.
Research shows that although we may be inclined to think that an activator's role brings about the most efficient behavior in a workforce, in effect; it is how managers handle the workforce after a particular behavior that influences future behavior or performance up to a great extent.
To quantify, activators' base behavior contribution is calculated to make up for 15 to 25 percent of behavior, while 75-85 percent of the behavior is known to be influenced by consequences.
Therefore, it is crucial that we understand and develop the basic management skills that will help bring out expected outcomes from a workforce.
This is where most managers either get stamped in to good or bad books. However, the type of decisions you make should not ideally make you a good or bad manager; rather how you make such decisions is what need to be the deciding factor.
You will need to know the basic ethics of problem solving and this should be thoroughly practiced in every occasion, even if the problem concerns you personally.
Unless otherwise, a manager becomes impartial and entirely professional, he/she may find it difficult to build a working relationship with co-workers in an organization.
The last thing you would want your co-workers to think is that you get by your working hours, cuddled up in an office chair, enjoying light music while doing nothing! Planning and Time management is essential for any manager; however, it is even more important for them to realize why these two aspects are important.
Although you may be entitled to certain privileges as a manager, that does not necessarily mean you could slay time as you please.
Assuming responsibility to manage the time is important so that you could become the first to roll the die which will soon become a chain reaction within the organization.
Having said that, when you conduct yourself with efficiency, you will also end up portraying yourself as a role model for co-workers which may add a lot of value as you move along with management duties in the company.
Planning ahead of time for events and activities that you foresee in your radar and taking the necessary initiatives as well as precautions as you move along are undoubtedly, some of the main expectations from managers.
If you could adapt a methodical style at your workplace and adapt effective techniques to carry out your duties with the least hindrance, you will soon build the sacred skills of planning and time management.
Having planned everything that lies ahead and having come up with a plan for time management, you may feel that you have got more than you could chew on your plate. This is where delegation should come into play.
Becoming a good manager does not mean carrying out every task by him/herself. Rather, it is about being able to delegate work effectively in order to complete the task on time.
Many managers mishandle delegation either because they do not have enough confidence in their co-workers and subordinates or because they do not master the techniques of delegation.
Therefore, the key for delegation would be to identify the individuals that are capable of carrying out the task, delegating the work with accurate instructions and providing enough moral support. Once the task is complete, you will get an opportunity to evaluate their performance and provide constructive feedback.
Nothing could be ever accomplished in the world of a manager without him or her being able to accurately, precisely and positively communicate their instructions, suggestions or feedback to others.
Therefore, you should be extremely careful in picking out your words. A 'Can-Do' attitude is something that can be easily portrayed through your words.
When your communication bears a positive note, it will run across your audience almost contagiously.
No matter how much charisma you may have in your personality or how good your positive communication skills may be, a manager never fails to be the one to communicate all things whether good or bad.
In your managerial position, you are exposed to both the executive layer and the working layer of an organization which makes you the ham in the sandwich.
Therefore, you may find yourself squashing and thrilling in between when it comes to many decisions.
The number one rule in managing yourself is to realize that you are a professional, who is being paid for the designation that you bear in the company. If you remember this fact, you will always remember never to take any issue personally.
Always draw a line between your managerial persona and your actual persona. It is good to bond with co-workers at a personal level while maintaining a distance in your profession. Therefore, you will also be required to draw a line somewhere.
And most importantly, you will become the sponge that absorbs heat from the higher strata of the company and delivers the minimum heat and pressure to the lower strata. Therefore, you will need to practice a fair share of diplomacy in your role.
Managing people and processes is a style in itself that requires dedication and experience-blended practice. The skills needed are as vast and deep as the ocean.
The basic management skills presented herein is only a doorway for you to get started on the management path that lies ahead.
Most organizations use quality tools for various purposes related to controlling and assuring quality.
Although a good number of quality tools specific are available for certain domains, fields and practices, some of the quality tools can be used across such domains. These quality tools are quite generic and can be applied to any condition.
There are seven basic quality tools used in organizations. These tools can provide much information about problems in the organization assisting to derive solutions for the same.
A number of these quality tools come with a price tag. A brief training, mostly a self-training, is sufficient for someone to start using the tools.
Let us have a look at the seven basic quality tools in brief.
This is one of the basic quality tool that can be used for analyzing a sequence of events.
The tool maps out a sequence of events that take place sequentially or in parallel. The flow chart can be used to understand a complex process in order to find the relationships and dependencies between events.
You can also get a brief idea about the critical path of the process and the events involved in the critical path.
Flow charts can be used for any field to illustrate complex processes in a simple way. There are specific software tools developed for drawing flow charts, such as MS Visio.
You can download some of the open source flow chart tools developed by the open source community.
Histogram is used for illustrating the frequency and the extent in the context of two variables.
Histogram is a chart with columns. This represents the distribution by mean. If the histogram is normal, the graph takes the shape of a bell curve.
If it is not normal, it may take different shapes based on the condition of the distribution. Histogram can be used to measure something against another thing. Always, it should be two variables.
Consider the following example: The following histogram shows morning attendance of a class. The X-axis is the number of students and the Y-axis the time of the day.
Cause and effect diagrams (Ishikawa Diagram) are used for understanding organizational or business problem causes.
Organizations face problems everyday and it is required to understand the causes of these problems in order to solve them effectively. Cause and effect diagrams exercise is usually a teamwork.
A brainstorming session is required in order to come up with an effective cause and effect diagram.
All the main components of a problem area are listed and possible causes from each area is listed.
Then, most likely causes of the problems are identified to carry out further analysis.
A check sheet can be introduced as the most basic tool for quality.
A check sheet is basically used for gathering and organizing data.
When this is done with the help of software packages such as Microsoft Excel, you can derive further analysis graphs and automate through macros available.
Therefore, it is always a good idea to use a software check sheet for information gathering and organizing needs.
One can always use a paper-based check sheet when the information gathered is only used for backup or storing purposes other than further processing.
When it comes to the values of two variables, scatter diagrams are the best way to present. Scatter diagrams present the relationship between two variables and illustrate the results on a Cartesian plane.
Then, further analysis, such as trend analysis can be performed on the values.
In these diagrams, one variable denotes one axis and another variable denotes the other axis.
Control chart is the best tool for monitoring the performance of a process. These types of charts can be used for monitoring any processes related to function of the organization.
These charts allow you to identify the following conditions related to the process that has been monitored.
Stability of the process
Stability of the process
Predictability of the process
Predictability of the process
Identification of common cause of variation
Identification of common cause of variation
Special conditions where the monitoring party needs to react
Special conditions where the monitoring party needs to react
Pareto charts are used for identifying a set of priorities. You can chart any number of issues/variables related to a specific concern and record the number of occurrences.
This way you can figure out the parameters that have the highest impact on the specific concern.
This helps you to work on the propriety issues in order to get the condition under control.
Above seven basic quality tools help you to address different concerns in an organization.
Therefore, use of such tools should be a basic practice in the organization in order to enhance the efficiency.
Trainings on these tools should be included in the organizational orientation program, so all the staff members get to learn these basic tools.
If a company is to be successful, it needs to evaluate its performance in a consistent manner.
In order to do so, businesses need to set standards for themselves and measure their processes and performance against recognized industry leaders or against best practices from other industries, which operate in a similar environment.
This is commonly referred to as benchmarking in management parlance.
The benchmarking process is relatively uncomplicated. Some knowledge and a practical dent is all that is needed to make such a process a success.
Therefore, for the benefit of corporate executives, students and the interested general populace, the key steps in the benchmarking process are highlighted below.
Following are the steps involved in benchmarking process:
Prior to engaging in benchmarking, it is imperative that corporate stakeholders identify the activities that need to be benchmarked.
For instance, the processes that merit such consideration would generally be core activities that have the potential to give the business in question a competitive edge.
Such processes would generally command a high cost, volume or value. For the optimal results of benchmarking to be reaped, the inputs and outputs need to be redefined; the activities chosen should be measurable and thereby easily comparable, and thus the benchmarking metrics needs to be arrived at.
Prior to engaging in the benchmarking process, the total process flow needs to be given due consideration. For instance, improving one core competency at the detriment to another proves to be of little use.
Therefore, many choose to document such processes in detail (a process flow chart is deemed to be ideal for this purpose), so that omissions and errors are minimized; thus enabling the company to obtain a clearer idea of its strategic goals, its primary business processes, customer expectations and critical success factors.
An honest appraisal of the company's strengths, weaknesses and problem areas would prove to be of immense use when fine-tuning such a process.
The next step in the planning process would be for the company to choose an appropriate benchmark against which their performance can be measured.
The benchmark can be a single entity or a collective group of companies, which operate at optimal efficiency.
As stated before, if such a company operates in a similar environment or if it adopts a comparable strategic approach to reach their goals, its relevance would, indeed, be greater.
Measures and practices used in such companies should be identified, so that business process alternatives can be examined.
Also, it is always prudent for a company to ascertain its objectives, prior to commencement of the benchmarking process.
The methodology adopted and the way in which output is documented should be given due consideration too. On such instances, a capable team should be found in order to carry out the benchmarking process, with a leader or leaders being duly appointed, so as to ensure the smooth, timely implementation of the project.
Information can be broadly classified under the sub texts of primary data and secondary data.
To clarify further, here, primary data refers to collection of data directly from the benchmarked company/companies itself, while secondary data refers to information garnered from the press, publications or websites.
Exploratory research, market research, quantitative research, informal conversations, interviews and questionnaires, are still, some of the most popular methods of collecting information.
When engaging in primary research, the company that is due to undertake the benchmarking process needs to redefine its data collection methodology.
Drafting a questionnaire or a standardized interview format, carrying out primary research via the telephone, e-mail or in face-to-face interviews, making on-site observations, and documenting such data in a systematic manner is vital, if the benchmarking process is to be a success.
Once sufficient data is collected, the proper analysis of such information is of foremost importance.
Data analysis, data presentation (preferably in graphical format, for easy reference), results projection, classifying the performance gaps in processes, and identifying the root cause that leads to the creation of such gaps (commonly referred to as enablers), need to be then carried out.
This is the stage in the benchmarking process where it becomes mandatory to walk the talk. This generally means that far-reaching changes need to be made, so that the performance gap between the ideal and the actual is narrowed and eliminated wherever possible.
A formal action plan that promotes change should ideally be formulated keeping the organization's culture in mind, so that the resistance that usually accompanies change is minimized.
Ensuring that the management and staff are fully committed to the process and that sufficient resources are in place to meet facilitate the necessary improvements would be critical in making the benchmarking process, a success.
As with most projects, in order to reap the maximum benefits of the benchmarking process, a systematic evaluation should be carried out on a regular basis.
Assimilating the required information, evaluating the progress made, re-iterating the impact of the changes and making any necessary adjustments, are all part of the monitoring process.
As is clearly apparent, benchmarking can add value to the organization's workflow and structure by identifying areas for improvement and rectification.
It is indeed invaluable in an organization's quest for continuous improvement.
There are a number of productivity and management tools used in business organizations. Cause and Effect Diagram, in other words, Ishikawa or Fishbone diagram, is one such management tool. Due to the popularity of this tool, majority of managers make use of this tool regardless of the scale of the organization.
Problems are meant to exist in organizations. That's why there should be a strong process and supporting tools for identifying the causes of the problems before the problems damage the organization.
Following are the steps that can be followed to successfully draw a cause and effect diagram:
Start articulating the exact problem you are facing. Sometimes, identification of the problem may not be straightforward. In such instances, write down all the effects and observations in detail. A short brainstorming session may be able to point out t the actual problem.
When it comes to properly identifying the problem, there are four properties to consider; who are involved, what the problem is, when it occurs, and where it occurs. Write down the problem in a box, which is located at the left hand corner (refer the example cause and effect diagram). From the box, draw a line horizontally to the right hand side. The arrangement will now look like the head and the spine of a fish.
In this step, the main factors of the problem are identified. For each factor, draw off a line from the fish's spine and properly label it. These factors can be various things such as people, material, machinery or external influences.
Think more and add as many as factors into the cause and effect diagram.
Brainstorming becomes quite useful in this phase, as people can look at the problem in different angles and identify different contributing factors.
The factors you added now become the bones of the fish.
Take one factor at a time when identifying possible causes. Brainstorm and try to identify all causes that apply to each factor. Add these causes horizontally off from the fish bones and label them.
If the cause is large in size or complex in nature, you can further breakdown and add them as sub causes to the main cause. These sub causes should come off from the relevant cause lines.
Spend more time in this step; the collection of causes should be comprehensive.
When this step starts, you have a diagram that indicates the problem, the contributing factors, and all possible causes for the problem.
Depending on the brainstorming ideas and nature of the problem, you can now prioritize the causes and look for the most likely cause.
This analysis may lead to further activities such as investigations, interviews and surveys. Refer the following sample cause and effect diagram:
When it comes to the use of cause and effect diagrams, brainstorming is a critical step. Without proper brainstorming, a fruitful cause and effect diagram cannot be derived.
Therefore, following considerations should be addressed in the process of deriving a cause and effect diagram:
There should be a problem statement that describes the problem accurately. Everyone in the brainstorming session should agree on the problem statement.
There should be a problem statement that describes the problem accurately. Everyone in the brainstorming session should agree on the problem statement.
Need to be succinct in the process.
Need to be succinct in the process.
For each node, think all the possible causes and add them into the tree.
For each node, think all the possible causes and add them into the tree.
Connect each casualty line back to its root cause.
Connect each casualty line back to its root cause.
Connect relatively empty branches to others.
Connect relatively empty branches to others.
If a branch is too bulky, consider splitting it in two.
If a branch is too bulky, consider splitting it in two.
Cause and Effect diagrams can be used to resolve organizational problems efficiently.
There are no limitations or restrictions on applying the diagrams to different problems or domains. The level and intensity of brainstorming defines the success rate of cause and effect diagrams.
Therefore, all relevant parties should be present in the brainstorming session in order to identify all possible causes.
Once most likely causes are identified, further investigation is required to unearth further details.
Philosophically thinking, change is the only constant in the world. Same as for anything else, this is true for business organizations as well.
Every now and then, business organizations change the way they operate and the services/products they offer. There are new initiatives in organizations and the old ineffective practices are forced to leave.
In addition to that, technology is constantly changing and the business organizations need to par with that as well.
There are many approaches about how to change. Of course, we may all agree that the change is required for an organization, but can we all be in agreement of how the change should take place? Usually not! Therefore, deriving a change management process should be a collective effort and should result from intensive brainstorming and refining of the ideas.
In this tutorial, we will have a look at the change management process suggested by John Kotter. Since this process has shown results for many Fortune 500 companies, Kotter's approach should be considered with respect.
Let's go through the steps of Kotter's change management approach.
A change is only successful if the whole company really wants it. If you are planning to make a change, then you need to make others want it. You can create urgency around what you want to change and create hype.
This will make your idea well received when you start your initiative. Use statistics and visual presentations to convey why the change should take place and how the company and employees can be at advantage.
If your convincing is strong, you will win a lot of people in favour of change. You can now build a team to carry out the change from the people, who support you. Since changing is your idea, make sure you lead the team.
Organize your team structure and assign responsibilities to the team members. Make them feel that they are important within the team.
When a change takes place, having a vision is a must. The vision makes everything clear to everyone. When you have a clear vision, your team members know why they are working on the change initiative and rest of the staff know why your team is doing the change.
If you are facing difficulties coming up with a vision, read chapter one (Mission and Values) of WINNING, by Jack Welch.
Deriving the vision is not just enough for you to implement the change. You need to communicate your vision across the company.
This communication should take place frequently and at important forums. Get the influential people in the company to endorse your effort. Use every chance to communicate your vision; this could be a board meeting or just talking over the lunch.
No change takes place without obstacles. Once you communicate your vision, you will only be able to get the support of a fraction of the staff. Always, there are people, who resist the change.
Sometimes, there are processes and procedures that resist the change too! Always watch out for obstacles and remove them as soon as they appear. This will increase the morale of your team as well the rest of the staff.
Quick wins are the best way to keep the momentum going. By quick wins, your team will have a great satisfaction and the company will immediately see the advantages of your change initiative.
Every now and then, produce a quick win for different stakeholders, who get affected by the change process. But always remember to keep the eye on the long-term goals as well.
Many change initiatives fail due to early declaration of victory. If you haven't implemented the change 100% by the time you declare the victory, people will be dissatisfied when they see the gaps.
Therefore, complete the change process 100% and let it be there for sometime. Let it have its own time to get integrated to the people's lives and organizational processes before you say it 'over.'
Use mechanisms to integrate the change into people's daily life and corporate culture. Have a continuous monitoring mechanism in place in order to monitor whether every aspect of the change taking place in the organization. When you see noncompliance, act immediately.
In the constantly changing corporate world, the one who welcomes the changes stays ahead of the competition.
If you are not much comfortable with changes happening around you, reserve some of your time to read 'Who Moved My Cheese?' by Dr. Spencer Johnson.
This will tell you the whole story about why the change is required and how you can make use of the change to excel in what you do.
If you are unable to communicate what you think and what you want, your will not be much successful in getting your work done in a corporate environment.
Therefore, it is necessary for you to get to know what the communication barriers are, so you can avoid them if you intentionally or unintentionally practice them at the moment.
Have a close look at the following communication blockers that can be commonly found in corporate environments:
Accusing and blaming are the most destructive forms of communication. When accusing, the other person feels that you assume he/she is guilty, even without hearing their side of the story.
Never accuse or blame unless it is highly required to address certain exceptional issues. In a corporate environment, accusing and blaming should not take place at all.
Judging is one of the blockers that prevent the information flow in communication. As an example, if one person is suspecting that you judge him/her, he/she will not open up to you and tell you all what they want to tell you.
Instead, they will tell you what they think as 'safe' to tell you. Make sure that you do not judge people when you communicate with them. Judging makes others feel that one person is on a higher level than the rest.
Insulting takes you nowhere in communication. Do you like to be insulted by someone else? Therefore, you should not insult another person regardless of how tempered you are or how wrong you think others are.
There are many ways of managing your temper other than insulting others. Insulting does not provide you any information you require.
If you are to diagnose something said by another person, think twice before actually doing it. If you diagnose something, you should be having more expertise than the person, who originally related to the communication.
When you try to diagnose something without a proper background to do so, others understand as if you are trying to show your expertise over the other person.
This is a communication blocker and the other person may be reluctant to provide you all the information he/she has.
In order to have effective communication, you need to show respect to others. If you show no respect, you get no information. This is exactly what sarcasm does.
If you become sarcastic towards a person, that person will surely hold back a lot of valuable information that is important to you. Showing your sense of humour is one thing and sarcasm is another!
Do not use words such as "always" or "never." These make the parties involved in the discussions uncomfortable as well as it gives the notion of negativity.
Try to avoid such globalizing words and try to focus on the issue in hand.
Understanding what other person says is the key for a successful outcome from communication. Overpowering rather than understanding the other person has many negative consequences when it comes to communication.
With threats and orders, there is only one-way communication and nothing collaborative will take place. Therefore, it is necessary for you to avoid threats or orders when communicating.
Interrupting is a good thing when you want to get something just said, clarified. But most of the times, people interrupt another person to express their own views and to oppose what has been said.
When such interruptions take place, the person, who talks may feel that you are no longer interested in what they are saying. Therefore, interrupt when it is really necessary and only to get things clarified.
If the other person is keen on talking about something, changing the subject by you might result in some issues in communication.
Changing subject in the middle of some discussion can be understood as your lack of interest on the subject as well as your unwillingness to pay attention. This may result in unproductive and ineffective communication outcomes.
Sometimes, we tend to do this. When one person is telling you something, you try to get the reassurance for what has been said from others.
This behaviour makes the first person uncomfortable and it is an indication that you do not believe or trust what the person says.
If you need a reassurance of what has been said, do it in a more private manner after the discussion or conversation is over.
Communication barriers are the ones you should always avoid. If you are a manager of a business organization, you should know each and every communication barrier and remove them from corporate culture.
Encourage others to avoid communication barriers by educating them. With communication barriers, neither the management nor employees will be able to achieve what they want.
In an organization, information flows forward, backwards and sideways. This information flow is referred to as communication. Communication channels refer to the way this information flows within the organization and with other organizations.
In this web known as communication, a manager becomes a link. Decisions and directions flow upwards or downwards or sideways depending on the position of the manager in the communication web.
For example, reports from lower level manager will flow upwards. A good manager has to inspire, steer and organize his employees efficiently, and for all this, the tools in his possession are spoken and written words.
For the flow of information and for a manager to handle his employees, it is important for an effectual communication channel to be in place.
Through a modem of communication, be it face-to-face conversations or an inter-department memo, information is transmitted from a manager to a subordinate or vice versa.
An important element of the communication process is the feedback mechanism between the management and employees.
In this mechanism, employees inform managers that they have understood the task at hand while managers provide employees with comments and directions on employee's work.
A breakdown in the communication channel leads to an inefficient flow of information. Employees are unaware of what the company expects of them. They are uninformed of what is going on in the company.
This will cause them to become suspicious of motives and any changes in the company. Also without effective communication, employees become department minded rather than company minded, and this affects their decision making and productivity in the workplace.
Eventually, this harms the overall organizational objectives as well. Hence, in order for an organization to be run effectively, a good manager should be able to communicate to his/her employees what is expected of them, make sure they are fully aware of company policies and any upcoming changes.
Therefore, an effective communication channel should be implemented by managers to optimize worker productivity to ensure the smooth running of the organization.
The number of communication channels available to a manager has increased over the last 20 odd years. Video conferencing, mobile technology, electronic bulletin boards and fax machines are some of the new possibilities.
As organizations grow in size, managers cannot rely on face-to-face communication alone to get their message across.
A challenge the managers face today is to determine what type of communication channel should they opt for in order to carryout effective communication.
In order to make a manager's task easier, the types of communication channels are grouped into three main groups: formal, informal and unofficial.
A formal communication channel transmits information such as the goals, policies and procedures of an organization. Messages in this type of communication channel follow a chain of command. This means information flows from a manager to his subordinates and they in turn pass on the information to the next level of staff.
A formal communication channel transmits information such as the goals, policies and procedures of an organization. Messages in this type of communication channel follow a chain of command. This means information flows from a manager to his subordinates and they in turn pass on the information to the next level of staff.
An example of a formal communication channel is a company's newsletter, which gives employees as well as the clients a clear idea of a company's goals and vision. It also includes the transfer of information with regard to memoranda, reports, directions, and scheduled meetings in the chain of command.
An example of a formal communication channel is a company's newsletter, which gives employees as well as the clients a clear idea of a company's goals and vision. It also includes the transfer of information with regard to memoranda, reports, directions, and scheduled meetings in the chain of command.
A business plan, customer satisfaction survey, annual reports, employer's manual, review meetings are all formal communication channels.
A business plan, customer satisfaction survey, annual reports, employer's manual, review meetings are all formal communication channels.
Within a formal working environment, there always exists an informal communication network. The strict hierarchical web of communication cannot function efficiently on its own and hence there exists a communication channel outside of this web. While this type of communication channel may disrupt the chain of command, a good manager needs to find the fine balance between the formal and informal communication channel.
Within a formal working environment, there always exists an informal communication network. The strict hierarchical web of communication cannot function efficiently on its own and hence there exists a communication channel outside of this web. While this type of communication channel may disrupt the chain of command, a good manager needs to find the fine balance between the formal and informal communication channel.
An example of an informal communication channel is lunchtime at the organization's cafeteria/canteen. Here, in a relaxed atmosphere, discussions among employees are encouraged. Also managers walking around, adopting a hands-on approach to handling employee queries is an example of an informal communication channel.
An example of an informal communication channel is lunchtime at the organization's cafeteria/canteen. Here, in a relaxed atmosphere, discussions among employees are encouraged. Also managers walking around, adopting a hands-on approach to handling employee queries is an example of an informal communication channel.
Quality circles, team work, different training programs are outside of the chain of command and so, fall under the category of informal communication channels.
Quality circles, team work, different training programs are outside of the chain of command and so, fall under the category of informal communication channels.
Good managers will recognize the fact that sometimes communication that takes place within an organization is interpersonal. While minutes of a meeting may be a topic of discussion among employees, sports, politics and TV shows also share the floor.
Good managers will recognize the fact that sometimes communication that takes place within an organization is interpersonal. While minutes of a meeting may be a topic of discussion among employees, sports, politics and TV shows also share the floor.
The unofficial communication channel in an organization is the organization's 'grapevine.' It is through the grapevine that rumors circulate. Also those engaging in 'grapevine' discussions often form groups, which translate into friendships outside of the organization. While the grapevine may have positive implications, more often than not information circulating in the grapevine is exaggerated and may cause unnecessary alarm to employees. A good manager should be privy to information circulating in this unofficial communication channel and should take positive measures to prevent the flow of false information.
The unofficial communication channel in an organization is the organization's 'grapevine.' It is through the grapevine that rumors circulate. Also those engaging in 'grapevine' discussions often form groups, which translate into friendships outside of the organization. While the grapevine may have positive implications, more often than not information circulating in the grapevine is exaggerated and may cause unnecessary alarm to employees. A good manager should be privy to information circulating in this unofficial communication channel and should take positive measures to prevent the flow of false information.
An example of an unofficial communication channel is social gatherings among employees.
An example of an unofficial communication channel is social gatherings among employees.
In any organization, three types of communication channels exist: formal, informal and unofficial.
While the ideal communication web is a formal structure in which informal communication can take place, unofficial communication channels also exist in an organization.
Through these various channels, it is important for a manager to get his/her ideas across and then listen, absorb, glean and further communicate to employees.
We all know the importance of communication in our daily lives. Nothing can take place without some method of communication being used to express ourselves for whatever purpose.
Communication is even more valuable in a business environment as there are several parties involved. Various stakeholders, whether they are customers, employees or the media, are always sending important information to each other at all times.
We are therefore constantly using some form of communication or another to send a message across. Without these different methods of communication available today, it would take eons for us to carry out business as efficiently as it is done today and with the same speed.
Let's try and understand what these methods of communication are.
Numerous new instruments have emerged over the years to help people communicate effectively.
Oral communication could be said to be the most used form of communication. Whether it is to present some important data to your colleagues or lead a boardroom meeting, these skills are vital.
We are constantly using words verbally to inform our subordinates of a decision, provide information, and so on. This is done either by phone or face-to-face.
The person on the receiving end would also need to exercise much caution to ensure that he/she clearly understands what is being said.
This shows therefore that you would need to cultivate both your listening and speaking skills, as you would have to carry out both roles in the workplace, with different people.
Writing is used when you have to provide detailed information such as figures and facts, even while giving a presentation.
It is also generally used to send documents and other important material to stakeholders which could then be stored for later use as it can be referred to easily as it is recorded. Other important documents such as contracts, memos and minutes of meetings are also in written form for this purpose.
It can be seen in recent years, however, that verbal communication has been replaced to a great extent by a faster form of written communication and that is email.
You could also use video conferencing and multiple way phone calls with several individuals simultaneously. Apart from a few glitches that could occur, these methods of communication have helped organizations come a long way.
Although the most common methods of communication are carried out orally or in writing, when it comes to management techniques, the power of non-verbal communication must never be underestimated.
Your smile, your gestures and several other body movements send out a message to the people around you. You need to be mindful of this while dealing with your employees and customers.
Always remember to maintain eye contact. This would show that you are serious and confident about what is being said.
You may ask why it is important that we use different methods of communication in one organization.
The answer is very simple. The reason for this is the pivotal role that communication plays in the effective functioning of a business.
Imagine an organization today without e-mail facilities. How would a customer then be able to send an important proposal quickly and directly to the employer in-charge? Similarly, an organization may have to stall their work if certain managers are not in the country and are thereby unable to give a presentation to the board.
But, of course, this can be done today with the help of video conferencing.
Therefore, it is crucial that different methods of communication are employed.
It is important that the most cost-effective methods of communication are chosen for any organization. Simply choosing a method of communication due to it being a famous instrument is not going to help.
You would need to understand the needs of your organization in particular. There are certain questions that you would need to ask:
What is our target audience?
What is our target audience?
How much are we willing to spend on such an instrument?
How much are we willing to spend on such an instrument?
Will it increase employee productivity in the long run?
Will it increase employee productivity in the long run?
What kind of information do we send out most often?
What kind of information do we send out most often?
You may have more questions to ask based on the type of work you carry out and the message that you need to send across. Remember that there is no 'right' method of communication. You would need different methods for different purposes and tasks.
In conclusion, it is important to always remember the importance of communication in an organization.
The methods of communication you choose could in a sense make or break the management structure of your organization and could also affect your relationship with customers, if not chosen carefully.
It is vital therefore that you spend some time
choosing the right methods to aid you in your
management tasks.
For decades, man has known the importance of communication. Today, with various means by which one can communicate, it has become much easier to communicate a message to the other party, than it was several decades ago.
Every organization, no matter what their expertise and where they are situated, and what scale they operate, realize and value the importance of good communication.
This communication for organizations takes place both within the organization as well as with other outside stakeholders outside.
Therefore, it is vital for any business organization to understand the communication models out there, so they can use them for enhancing effective communication in the organization.
Communication today is mainly of three types
Written communication, in the form of emails, letters, reports, memos and various other documents.
Written communication, in the form of emails, letters, reports, memos and various other documents.
Oral communication. This is either face-to-face or over the phone/video conferencing, etc.
Oral communication. This is either face-to-face or over the phone/video conferencing, etc.
A third type of communication, also commonly used but often underestimated is non-verbal communication, which is by using gestures or even simply body movements that are made. These too could send various signals to the other party and is an equally important method of communication.
A third type of communication, also commonly used but often underestimated is non-verbal communication, which is by using gestures or even simply body movements that are made. These too could send various signals to the other party and is an equally important method of communication.
The basic flow of communication can be seen in the diagram below. In this flow, the sender sends a message to the receiver and then they share the feedback on the communication process.
The methods of communication too need to be carefully considered before you decide on which method to uses for your purposes. Not all communication methods work for all transactions.
Once the methods of communication have been understood, the next step would be to consider various communication models. Due to the importance of communication, different types of models have been introduced by experts over the years.
The models help the business organizations and other institutions to understand how communication works, how messages are transmitted, how it is received by the other party, and how the message is eventually interpreted and understood.
Let's have a look at some of the famous and frequently used communication models used nowadays.
One of the earliest models of communication that introduced was Claude Shannon's model. This was introduced in 1948.
This laid the foundation for the different communication models that we have today, and has greatly helped and enhanced the communication process in various fields. This model can be considered as the granddaddy of many later communication models.
Following is a simple illustration of this model.
The diagram above clearly illustrates how communication takes place, and also helps one to determine what could go wrong.
In Shannon's model, the information source typically refers to a person, who then sends a message with the use of a transmitter.
This transmitter could be any instrument today, from phones to computers and other devices. The signals that are sent and received can be vary depending on the method of communication.
The box at the bottom called NOISE refers to any signals that may interfere with the message being carried. This again would depend on the method of communication.
The receiver is the instrument or the person on the other side that receives the. This model is the simplest models to understand the workings of the communication process.
Another famous communication model is Berlo's model. In this model, he stresses on the relationship between the person sending the message and the receiver.
According to this model, for the message to be properly encoded and decoded, the communication skills of both the source and the receiver should be at best. The communication will be at its best only if the two points are skilled.
Berlo's model has four main components and each component has its own sub components describing the assisting factors for each.
Following is the illustration of this model.
Schramm on the other hand, emphasized in 1954 that both the sender and the receiver take turns playing the role of the encoder and the decoder when it comes to communication.
The following diagram illustrates the model proposed by Schramm.
These models have been followed by various other models such as the 'Helical' model, Aristotle's models and several other models.
You should always keep in mind that each of these models has both their advantages and disadvantages. While some communication models try to break down the whole process in order to make it easier to understand, they are not always as simple as they seem.
There are several complexities involved in communications models. This is one thing that needs to be carefully understood in the process of understanding how these models work.
You need to keep in mind that these complexities that accompany the communication models may only make understanding the communication much harder.
It is best that both parties, the source (sender) and the receiver, are clear about what they would like to discuss. This is also known as the context of the message.
This would make it much easier to decode what the other party is saying without too much trouble. The process of communication, if kept simple and to the point, should not usually have too many issues, and the message will be easily understood by both parties.
Often you would come across organizations that stress the importance of good communication management. It's empirical for an organization to have a proper communication management.
Once this is achieved, the organization is one step closer to achieving its overall business objectives. Communication management refers to a systematic plan, which implements and monitors the channels and content of communication.
To become a good manager, one must have a contingency approach at hand when it comes to communicating with employees.
An effective communication management is considered to be a lifeline for many projects that an organization undertakes as well as any department of the organization.
The five W's in communication are crucial and need to be addressed for a project or organizational function to be successful by means of an effective communication management.
Following are the five W's of communications management:
What information is essential for the project?
What information is essential for the project?
Who requires information and what type of information is needed?
Who requires information and what type of information is needed?
What is the duration of time required for the information?
What is the duration of time required for the information?
What type or format of information is required?
What type or format of information is required?
Who are the person/s who will be responsible for transmitting the collated information?
Who are the person/s who will be responsible for transmitting the collated information?
The five W's in communication management are only the guidelines. Therefore, you do need to take other considerations into account, such as cost and access to information.
The main objective of communication management is to ensure smooth flow of information from either between two people or a group.
Let us examine the communication process with the use of a diagram.
The communication process consists of three main divisions; sender transmits a message via a channel to the receiver. As per the above diagram, the sender first develops an idea, which then can be processed as a message.
This message is transmitted to the receiver. The receiver has to interpret the message to understand its meaning.
When it comes to the interpretation, the context of the message should be used for deriving the meaning. Furthermore, for this communication process model, you will also utilize encoding and decoding.
Encoding refers to developing a message and decoding refers to interpreting or understanding the message. You will also notice the feedback factor, which the sender and receiver both involve.
Feedback is crucial for any communication process to be successful. Feedback allows immediate managers or supervisors to analyze how well subordinates understand the information provided and to know the performance of work.
Understanding the communication process alone will not guarantee success for managers or an organization. Managers need to be aware of the methods used in the communication process.
The standard methods of communication that are widely used by managers and organizations across the world are either written or oral methods.
Apart from these two mechanisms, non-verbal communication is another prominent method used to assess communication within the organization.
Non-verbal communication refers to the use of body language as a method of communication. This method will include gestures, actions, physical appearance as well as facial appearance and attitude.
Although most of these methods are still in use for a larger part of the organization, the usage of e-mail and other electronic mediums as a method of communication has lessened the need for face-to-face communication.
This sometimes leads to situations where both parties involved do not trust or feel comfortable with each other and also the messages can be easily misinterpreted.
A large proportion of oral communication is directly involved in communications management. For example, if a manager does not converse or make it clear to a sales team, this may lead to differences in objectives and achievements.
There are two aspects of oral communication, active listening and constructive feedback.
This is where the person, who receives the message pays attention to the information, interprets and remembers.
As you would be aware, listening helps you to pay attention and following are some points, which illustrate active listening.
Making eye contact with the relevant party
Making eye contact with the relevant party
Making sure to clarify questions if it's not clear
Making sure to clarify questions if it's not clear
Avoiding using gestures, which are distracting or uncomfortable
Avoiding using gestures, which are distracting or uncomfortable
This is where managers fail most of the time. Feedback needs to be constructive and then it will help the employees to shape up their performance instead of mere criticism.
Communication management is vital for any organization irrespective of its size. It contributes to achieving the company's overall objectives as well as creates a positive and friendly environment.
An effective communication process within the organization will lead to an increase in profits, high employee satisfaction and brand recognition.
Organizational conflict occurs when two or more parties, who have different objectives, values or attitudes compete for the same resources. Conflicts can arise due to disagreements between individuals or departments due to their dissimilar focus.
Contrary to popular belief, not all organizational conflicts are detrimental to the effective functioning of the business or project at hand.
Popular management theorists have recognized the fact that groups tend to storm before performing, and in one sense, this can be advantageous, as it brings problems out into the open, addresses the need to resolve such issues satisfactorily, motivates staff to seek acceptable solutions and each department or person embroiled in the conflict learns to respect and even benefit from the inherent differences of each other.
However, some conflicts spin out of control. This lower employee morale results in unacceptable behavioral patterns, reduces productivity and causes an escalation in differences that makes bridges harder to build.
Identifying actions that aggravate conflict, others that resolve differences and the different method of coping with conflict are all part of conflict management which are discussed in detail below.
Ill-defined expectations, non-consultative changes and feelings of helplessness in the decision making process tend to aggravate conflict. Poor communication, an authoritative style of leadership and impromptu planning are at the very heart of these problems.
Ambiguous objectives, inadequate allocation of resources, be it time, money or personnel, and badly defined process structures heighten such issues even further. Egotistic behavior, battle between Alpha dogs for supremacy and poor management techniques also play a pivotal role in aggravating conflicts.
A lack of understanding, an excuse-ridden culture and avoidance of accountability too increase the detrimental effects of conflicts.
Formulating well-defined job descriptions in a consultative manner, ensuring that any overlaps are minimized and carrying out periodical reviews to ascertain that such documentation is accurate, give the employees a sense of control over their own destiny.
This participative approach goes a long way in minimizing conflicts and helps foster better work ethics.
Formulating cross-departmental teams to solve specific problems, conducting outbound training, which fosters team spirit, holding regular meeting where feedback on performance is given and where the challenges faced are addressed and the solutions are discussed are some of the other relationship building techniques used by progressive organizations.
The four most popular methods of handling conflict can be summarized as fight, flight, fake or fold.
To elaborate further, fighting is where one party tends to dominate another by way of repetitive arguments, labeling and name-calling.
Flight is where people run away from problems instead of confronting them and turns to avoidance as a means of handling conflict. Faking, as its name implies, means agreeing to the solution presented, although in reality, the opposite holds true.
Folding is where an individual is made to agree to a solution by means of browbeating. However, none of the aforementioned method would yield satisfactory results in the long term.
Even today, compromise and collaboration go a long way in resolving conflicts in an optimal manner, as both are win-win situations for the most part, after which, interested parties can work together to reach a common goal.
Effective dialogue paves the way for conflict resolution. If the disagreements cannot be resolved by the two parties themselves, then a third party arbitrator or counselor might need to be consulted for best results.
Communication skills, negotiation skills and the ability to see the whole picture are necessary skills in conflict management. Listening skills and the ability to find solutions that do not compromise any party's interest are also worth developing when handling conflict management.
Identify the problem.
Identify the problem.
Identify the limiting resource or constraint that is generally at the root cause of the conflict.
Identify the limiting resource or constraint that is generally at the root cause of the conflict.
Engage in participatory dialogue and find a range of solutions that will be acceptable to all the parties concerned.
Engage in participatory dialogue and find a range of solutions that will be acceptable to all the parties concerned.
See which solutions clash with the organizational objectives and are not in keeping with the company's culture.
See which solutions clash with the organizational objectives and are not in keeping with the company's culture.
Eliminate those that do not promote mutual understanding or acceptance.
Eliminate those that do not promote mutual understanding or acceptance.
Choose the best solution that satisfy most people most of the time and implement this.
Choose the best solution that satisfy most people most of the time and implement this.
Conflicts are inevitable in one's personal life in organizations or even between nations.
It does have some noteworthy advantages if handled correctly as it brings problems out into the open and compels interested parties to find solutions that are acceptable to all. However, conflicts that escalate out of control are detrimental to everybody in the equation, so conflict management becomes a necessity.
Some basic skills, some knowledge, and having the best interest of the organization at heart, together with respect for its people, will go a long way in handling conflict admirably.
In any organization or business, it is always essential that you are prepared for any problems that may arise when it is least expected.
It is in the way that you deal with these issues that the success of your business will be based on. It is a well known fact that the biggest blow to an organization comes from the major unpredictable disasters that occur often leaving everyone, from the management to the public, involved in a state of confusion.
No organization however big or famous is immune from various crises. This may include situations such as your computer systems failing or even worse, infrastructure being completely destroyed.
Crisis management has entered the field of management only very recently but has since contributed a great deal to the prevention of major management disasters.
What crisis management typically requires is that you carry out forecasting of certain crises that you think could occur in the near future, putting your organization into jeopardy.
You then also come up with a solution as to how you would go about dealing with such a crisis. This would also require you to have a clear plan of all steps that would need to be taken should such a situation arise.
However, it may not always be the case that the organization has time to prepare for such a crisis. In such a situation, the management team would need to work on mitigating the amount of loss caused and recovering from the crisis at hand.
It is important that you have a good understanding of the different types of crises that could take place at the very outset.
This is vital as all crises cannot be handled in the same manner and would require different approaches and various techniques to be applied. Although types of crises can be categorized into several kinds, the most common categories are as follows:
Financial crises - This would be a huge problem for any organization, but is fairly predictable to quite an extent when compared with other types of crises. Such a crisis would basically involve the organization heading in the direction of bankruptcy.
Financial crises - This would be a huge problem for any organization, but is fairly predictable to quite an extent when compared with other types of crises. Such a crisis would basically involve the organization heading in the direction of bankruptcy.
Natural disasters - This type of crisis is highly unpredictable and could come by at any time. Several examples of such situations could be given today, from example, earthquakes in countries such as China a few years ago and Haiti and other disasters such as tsunamis and hurricanes, you should always be ready to face such a situation.
Natural disasters - This type of crisis is highly unpredictable and could come by at any time. Several examples of such situations could be given today, from example, earthquakes in countries such as China a few years ago and Haiti and other disasters such as tsunamis and hurricanes, you should always be ready to face such a situation.
Technological crises - This is where a system collapses due to failure in the functioning of different equipment and machinery used. As mentioned previously, a computer system failure is one example of such a crisis. These crises could occur either because of human error or a fault in the system used which has multiple consequences. This may also include chemical spills and oil leaks. One famous case is that of the Chernobyl nuclear power plant in 1986 which caused much damage.
Technological crises - This is where a system collapses due to failure in the functioning of different equipment and machinery used. As mentioned previously, a computer system failure is one example of such a crisis. These crises could occur either because of human error or a fault in the system used which has multiple consequences. This may also include chemical spills and oil leaks. One famous case is that of the Chernobyl nuclear power plant in 1986 which caused much damage.
Political & Social - With the current political climate the world over, you may also want to take into consideration any threats to security and any form of terrorist activity.
Political & Social - With the current political climate the world over, you may also want to take into consideration any threats to security and any form of terrorist activity.
No organization is free from internal politics and disagreement between the various levels of the workforce.
It is therefore essential that you always keep in mind that high-ranking workers could always resign in the middle of an important project or the workers may plan a strike or protest to express their disgruntlement with the way certain aspects of the organization are run.
Knowing how to manage employee disgruntlement is therefore key to preventing any future fights from erupting, impeding the progress of work being carried out by the organization.
Without a clear plan as to how to deal with the crises that could occur at the very outset, you would only drag the organization into greater problems.
It is very important that someone plays the role of a leader and chooses a dynamic team in order to carry out all aspects of planning.
It is this management team that would have to not only ascertain what types of crises may occur, but then carry on to study various strategies that could be applied to minimize or even prevent altogether any damage that could be caused.
The next step would then be to try out these strategies and see if it would work.
At times such as these, your organization would benefit greatly from other organizations that would be able to provide you with invaluable resources to help you mitigate the crises to the greatest extent possible.
It is essential to keep in mind that when a crisis occurs you would need to have a response team ready to deal with the media and the various stakeholders.
All these parties would need information on the given situation and what is being done to deal with it. This also requires you to have a clear crisis communication plan with the target audience in mind.
Remember that each group needs to be handled in a different manner; customers may not require the same information as the employees of the organization, and so on.
The only way to successfully control a crisis from going out of your hands is to always have a good plan and a good team ready to deal with various situations that may crop up.
With these strategies in place, you would always be able to reduce the damage caused to the organization to a great extent.
When it comes to a project, it has a lower limit of possible lead time. This basically determines the cost associated with the project.
The critical chain of a project is the dependent tasks that define the lower limit of possible lead time. Therefore, it is safe to assume that the critical chain is made of sequenced dependent tasks. In critical chain scheduling (CCS), these dependent tasks are scheduled in the most effective and beneficial way.
When it comes to critical chain scheduling, dependencies are used to determine the critical chain. In this case, two types of dependencies are used; hands-off dependencies and resource dependencies.
This simply means that output of one task is the input for another. Therefore, the latter task cannot be started until the first task is completed.
In this case, one task is utilizing a resource, so the other task cannot be started until the first task is completed and the resource is freed.
In simple, using traditional project management terminology, the critical chain can be explained as the "resource constrained critical path".
Critical chain scheduling appreciates the "impact of variation" of a project. Usually, in project management, the impact of variation is found using statistical models such as PERT or Mote Carlo analysis. Critical chain scheduling does complement the impact of variance with a concept called the "buffer".
We will discuss more about the buffer later. The buffer basically protects the critical chain from variations in other non-critical chains making sure critical chain the indeed critical.
Buffer is one of the most interesting concepts in critical chain scheduling. The buffers are constructed and applied to a project in order to make sure the success of the project. The buffer protects the due delivery dates from variations to the critical chain.
With a "feeding buffer" of a proper size, the dependent tasks in the critical chain that is dependent on the output of the non-critical chain tasks have a great opportunity to start the task as soon as its predecessor dependent task in the critical chain is finished. Therefore, with the feeding buffer, the dependent tasks in the critical chain do not have to wait for non-critical chain tasks to complete.
This makes sure that the critical chain moves faster towards the project completion.
When there are multiple projects running in an organization, critical chain scheduling employs something called "capacity buffers." These buffers are used to isolate key resource performance variances in one project impacting another project.
Resource buffers are the other type of buffer employed for projects in order to manage the impact by the resources to the project progress.
Usually, the critical path goes from start of the project to the end of the project. Instead, the critical chain ends at the start of the buffer assigned to the project. This buffer is called "project buffer." This is the fundamental difference between the critical path and the critical chain. When it comes to critical path, activity sequencing is performed. But with critical chain, critical chain scheduling is performed.
When it comes to the project schedule, the critical path is more subjective towards the milestones and deadlines. In critical path, not much of emphasis is given to resource utilization. Therefore, many experts believe that the critical path is what you get before you level the resources of the project. One other reason for this is, in critical path, hands-off dependencies are given the precedence.
When it comes to critical chain, it is more defined as a resource-levelled set of project tasks.
Same as for critical path methodology, there is software for critical chain scheduling. This software can be categorized into "standalone" and "client-server" categories. This software supports multi-project environments by default. Therefore, this software is useful when it comes to managing a large project portfolio of a large organization.
Critical chain scheduling is a methodology focused on resource-levelling. Although dependent tasks mostly define the project timelines, the resource utilization plays a key role. A methodology such as critical path may be highly successful in environments, where there is no resource shortage. But in reality, this is not the case.
Projects run with limited resources and resource-levelling is a critical factor when it comes to the practicality. Therefore, critical chain scheduling gives a better answer for resource intensive projects to manage their deliveries.
If you have been into project management, I'm sure you have already heard the term 'critical path method.'
If you are new to the subject, it is best to start with understanding the 'critical path' and then move on to the 'critical path method.'
Critical path is the sequential activities from start to the end of a project. Although many projects have only one critical path, some projects may have more than one critical paths depending on the flow logic used in the project.
If there is a delay in any of the activities under the critical path, there will be a delay of the project deliverables.
Most of the times, if such delay is occurred, project acceleration or re-sequencing is done in order to achieve the deadlines.
Critical path method is based on mathematical calculations and it is used for scheduling project activities. This method was first introduced in 1950s as a joint venture between Remington Rand Corporation and DuPont Corporation.
The initial critical path method was used for managing plant maintenance projects. Although the original method was developed for construction work, this method can be used for any project where there are interdependent activities.
In the critical path method, the critical activities of a program or a project are identified. These are the activities that have a direct impact on the completion date of the project.
Let's have a look at how critical path method is used in practice. The process of using critical path method in project planning phase has six steps.
You can use the Work Breakdown Structure (WBS) to identify the activities involved in the project. This is the main input for the critical path method.
In activity specification, only the higher-level activities are selected for critical path method.
When detailed activities are used, the critical path method may become too complex to manage and maintain.
In this step, the correct activity sequence is established. For that, you need to ask three questions for each task of your list.
Which tasks should take place before this task happens.
Which tasks should take place before this task happens.
Which tasks should be completed at the same time as this task.
Which tasks should be completed at the same time as this task.
Which tasks should happen immediately after this task.
Which tasks should happen immediately after this task.
Once the activity sequence is correctly identified, the network diagram can be drawn (refer to the sample diagram above).
Although the early diagrams were drawn on paper, there are a number of computer softwares, such as Primavera, for this purpose nowadays.
This could be a direct input from the WBS based estimation sheet. Most of the companies use 3-point estimation method or COCOMO based (function points based) estimation methods for tasks estimation.
You can use such estimation information for this step of the process.
For this, you need to determine four parameters of each activity of the network.
Earliest start time (ES) - The earliest time an activity can start once the previous dependent activities are over.
Earliest start time (ES) - The earliest time an activity can start once the previous dependent activities are over.
Earliest finish time (EF) - ES + activity duration.
Earliest finish time (EF) - ES + activity duration.
Latest finish time (LF) - The latest time an activity can finish without delaying the project.
Latest finish time (LF) - The latest time an activity can finish without delaying the project.
Latest start time (LS) - LF - activity duration.
Latest start time (LS) - LF - activity duration.
The float time for an activity is the time between the earliest (ES) and the latest (LS) start time or between the earliest (EF) and latest (LF) finish times.
During the float time, an activity can be delayed without delaying the project finish date.
The critical path is the longest path of the network diagram. The activities in the critical path have an effect on the deadline of the project. If an activity of this path is delayed, the project will be delayed.
In case if the project management needs to accelerate the project, the times for critical path activities should be reduced.
Critical path diagram is a live artefact. Therefore, this diagram should be updated with actual values once the task is completed.
This gives more realistic figure for the deadline and the project management can know whether they are on track regarding the deliverables.
Following are advantages of critical path methods:
Offers a visual representation of the project activities.
Offers a visual representation of the project activities.
Presents the time to complete the tasks and the overall project.
Presents the time to complete the tasks and the overall project.
Tracking of critical activities.
Tracking of critical activities.
Critical path identification is required for any project-planning phase. This gives the project management the correct completion date of the overall project and the flexibility to float activities.
A critical path diagram should be constantly updated with actual information when the project progresses in order to refine the activity length/project duration predictions.
Decision making is a daily activity for any human being. There is no exception about that. When it comes to business organizations, decision making is a habit and a process as well.
Effective and successful decisions make profit to the company and unsuccessful ones make losses. Therefore, corporate decision making process is the most critical process in any organization.
In the decision making process, we choose one course of action from a few possible alternatives. In the process of decision making, we may use many tools, techniques and perceptions.
In addition, we may make our own private decisions or may prefer a collective decision.
Usually, decision making is hard. Majority of corporate decisions involve some level of dissatisfaction or conflict with another party.
Let's have a look at the decision making process in detail.
Following are the important steps of the decision making process. Each step may be supported by different tools and techniques.
In this step, the problem is thoroughly analysed. There are a couple of questions one should ask when it comes to identifying the purpose of the decision.
What exactly is the problem?
What exactly is the problem?
Why the problem should be solved?
Why the problem should be solved?
Who are the affected parties of the problem?
Who are the affected parties of the problem?
Does the problem have a deadline or a specific time-line?
Does the problem have a deadline or a specific time-line?
A problem of an organization will have many stakeholders. In addition, there can be dozens of factors involved and affected by the problem.
In the process of solving the problem, you will have to gather as much as information related to the factors and stakeholders involved in the problem. For the process of information gathering, tools such as 'Check Sheets' can be effectively used.
In this step, the baseline criteria for judging the alternatives should be set up. When it comes to defining the criteria, organizational goals as well as the corporate culture should be taken into consideration.
As an example, profit is one of the main concerns in every decision making process. Companies usually do not make decisions that reduce profits, unless it is an exceptional case. Likewise, baseline principles should be identified related to the problem in hand.
For this step, brainstorming to list down all the ideas is the best option. Before the idea generation step, it is vital to understand the causes of the problem and prioritization of causes.
For this, you can make use of Cause-and-Effect diagrams and Pareto Chart tool. Cause-and-Effect diagram helps you to identify all possible causes of the problem and Pareto chart helps you to prioritize and identify the causes with highest effect.
Then, you can move on generating all possible solutions (alternatives) for the problem in hand.
Use your judgement principles and decision-making criteria to evaluate each alternative. In this step, experience and effectiveness of the judgement principles come into play. You need to compare each alternative for their positives and negatives.
Once you go through from Step 1 to Step 5, this step is easy. In addition, the selection of the best alternative is an informed decision since you have already followed a methodology to derive and select the best alternative.
Convert your decision into a plan or a sequence of activities. Execute your plan by yourself or with the help of subordinates.
Evaluate the outcome of your decision. See whether there is anything you should learn and then correct in future decision making. This is one of the best practices that will improve your decision-making skills.
When it comes to making decisions, one should always weigh the positive and negative business consequences and should favour the positive outcomes.
This avoids the possible losses to the organization and keeps the company running with a sustained growth. Sometimes, avoiding decision making seems easier; especially, when you get into a lot of confrontation after making the tough decision.
But, making the decisions and accepting its consequences is the only way to stay in control of your corporate life and time.
Design of Experiments (DOEs) refers to a structured, planned method, which is used to find the relationship between different factors (let's say, X variables) that affect a project and the different outcomes of a project (let's say, Y variables).
The method was coined by Sir Ronald A. Fisher in the 1920s and 1930s.
Ten to twenty experiments are designed where the applicable factors varied methodically. The results of the experiments are then analyzed to classify optimal conditions to find the factors that have the most influence on the results as well as those that do not and to identify interfaces and synergies among the factors.
DOEs are mainly used in the research and development department of an organization where majority of resources goes towards optimization problems.
In order to minimize optimization problems, it is important to keep costs low by conducting few experiments. Design of Experiments is useful in this case, as it only necessitates a small number of experiments, thereby helping to reduce costs.
In order to use Design of Experiments successfully, it is important to adhere to eight fundamental concepts.
Once the following eight steps are sequentially followed, you will be able to receive a successful outcome from Design of Experiments.
Set Good Objectives: Before one begins to design an experiment, it is important to set out its objective. With a defined objective, it is easy to screen out factors not relevant to the experiment. This way one optimizes the key critical factors.
In the initial stages of project development, it is recommended to use a design of experiment, choice of a fractional two-level factorial. This design of experiments screens a large number of factors in minimal runs.
However, when one sets a set of good objectives, many irrelevant factors are eliminated. With well-defined objectives, managers can use a response surface design of experiment which explores few factors, albeit at many levels.
Also drawing up good objectives at the beginning helps build a solid understanding of the project as well as create realistic expectations of it's outcome.
Measure Responses Quantitatively: Many Designs of Experiments end in failure because their responses cannot be measured quantitatively.
For example, product inspectors use a qualitative method of determining if a product passes quality assurance or not. This is not efficient in designs of experiments as a pass/fail is not accurate enough.
Replicate to Dampen Uncontrollable Variation: Replicating a given set of conditions many times gives more opportunities for one to precisely estimate responses.
Replicating also gives one the opportunity to detect significant effects such as signals amid the natural process uncontrollable variations, like noise.
For some projects, variations such as noise drown out the signal, so it is useful to find the signal to noise ratio before doing a design of experiment.
Randomize the Run Order: In order to evade uncontrollable influences such as changes in raw material and tool wear, it is necessary to run experiments in a randomized order.
These variable influences can have a significant effect on the selected variable. If an experiment is not run in a random order, the design of experiment will specify factor effects that are in fact from these variable influences.
Block out Known Sources of Variation: Through blocking, one can screen out the effects of known variables such as shift changes or machine differences.
One can divide the experimental runs into homogenous blocks and then mathematically remove the differences. This increases the sensitivity of the design of experiment. However, it is important to not block out anything one wants to study.
Know Which Effects (if any) Will be Aliased: An alias means that one has changed one or more things in the same way at the same time.
Do a Sequential Series of Experiments: When conducting a design of experiment it is important to conduct it in a chronological manner, that is, information gleaned in one experiment should be able to be applied to the next.
Always Confirm Critical Findings: At the end of a design of experiment, it is easy to assume that the results are accurate.
However, it is important to confirm one's findings and to verify the results. This validation can be done using many other management tools available.
Design of Experiments is an important tool that can be utilized in most manufacturing industries. Managers, who use the method, will not only save on costs but also make improvements in the quality of their product as well as ensure process efficiency.
Once Design of Experiments is completed, the managers should make an extra effort to validate the outcome and carry out further analysis of the findings.
Communication is the only interaction that we make when we involve with another party. Regardless of whether it is personal relationship or a professional one, communication keeps us connected to one another in the community.
Therefore, communication is the main mechanism where the conflicts are arisen as well as they are solved.
Therefore, effective communication can make sure that you communicate appropriately and correctly in order to minimize such confrontations.
In case, there are disagreements or conflicts, effective communication can be again used for solving such issues.
Following are the main skills one should have to master to become an effective communicator.
Although acquiring all these skills and mastering them to the same level seems to be challenging, knowing all these skills and slowly working on them will take you to the level you want to be in communication.
When you deal with a current crisis or an argument, relating something from the past is quite natural.
When this happens, most of the times, the discussion goes out of topic and the situation can become quite complicated.
Staying focused is one of the best skills not only for communicating under pressure, but for all types of communications ranging from lunch chitchats to board discussions.
If you go out of focus, there is a high chance that the end result of the communication may not be effective.
Although people think that they are listing when another person talks, actually they are spending time planning what to say next.
This is what we actually do! Therefore, you need to make an extra effort in order to listen to what the other person says and then come up with what you want to say.
If you are not sure what you've heard, repeat it and ask for their confirmation.
In most of the communications, we want ourselves heard and understood. We talk a lot on our point of view and try to get the buying of who are listening.
Remember, others also do the same! If you want them to hear you, you need to hear them and understand their point of view too.
If you can really see through their point of view, you can actually explain yours in a clear and applicable way.
Sometimes, we become really defensive when someone criticizes us. Since criticism has close ties with emotions, we can be easily erupted.
But, in communication, it is really important to listen to the other person's pain and difficulties and respond with empathy.
At the same time, try to extract the facts and the truth in what they say, it can be useful for you.
Taking personal responsibility is a strength. When it comes to effective communication, admitting what you did wrong is respected and required.
Most of the times, there are many people, who share responsibility in a conflict. In such cases, admit what is yours. This behaviour shows maturity and sets an example.
Your behaviour most probably will inspire others to take responsibility for their share.
We love to win arguments all the time, but how often have you felt empty inside after winning an argument? Sometimes, winning an argument does not make sense.
You may win the argument but might lose the corporation of other people. Communication is not about winning, it's about getting things done.
For the objective of getting things done, you may have to compromise in the process. If it is necessary, please do!
Sometimes, you need to take a break in the middle of the discussion. If the communication is intensive, there can be ineffective communication pattern surfaced.
Once you notice such patterns, you need to take a break and then continue. When you continue after the break, all the parties involved in the discussion will be able to constructively contribute for the discussion.
Although there can be a lot of obstacles on your way, do not give up what you are fighting for.
Surely you may have to compromise, but clearly stand for what you believe in. When it comes to communication, all the parties involved should satisfy with the outcome of it.
Sometimes, you might have difficulties to communicate certain things to certain parties. This could be due to an issue related to respect or something else.
In such cases, seek help from others. Your manager will be one of the best persons to help you with.
In a corporate environment, effective communication is the key to win your way to success.
Regardless of whether you are targeting your career growth or winning the next big project, effective communication can make your way to the objective.
In addition, effective communication can get you a lot of support from your subordinates as well.
Have you ever seen a keynote presentation done by Steve Jobs, the CEO of Apple Inc? If you have, you know what it means to have 'effective presentation skills.' Steve Jobs is not the only one who has this ability, there are plenty more.
Problems are meant to exist in organizations. That's why there should be a strong process and supporting tools for identifying the causes of the problems before the problems damage the organization.
If you are to communicate an idea, concept or a product, you need to have good presentation skills in order to grab the attention of the audience and become the center of attention.
This way, it is easy for you to get the audience's support. The audience can range from your college classmates to an executive board of a multinational company.
There are many software packages you can use for presentation purposes. Of course, it is not mandatory to use software for your presentation, but the effect is much greater when you use such tools for your purpose. Many of these software tools are equipped with features and facilities to make your presentation experience easy and pleasant.
Having just an idea or a product to communicate and a software package to create your presentations do not make you an effective presenter. For this, you should prepare yourself in advance and also should develop some skills. Let's take a look at some of the pointers that will help you to become a top-class presenter.
The design and the layout of the presentation have an impact on how the audience receives it. Therefore, you need to focus more on the clarity of your presentation and the content.
Following are some points you should consider when designing your presentation.
Derive the top three goals that you want to accomplish through your presentation. The entire presentation should focus on achieving these three goals. If you are not clear about what you want to achieve, your audience can easily miss the point of your presentation.
Derive the top three goals that you want to accomplish through your presentation. The entire presentation should focus on achieving these three goals. If you are not clear about what you want to achieve, your audience can easily miss the point of your presentation.
Understand what your audience is. Think why they are there to see your presentation and their expectations. Study the background of the audience in advance if possible. When you do the presentation, make sure that you communicate to them that they are 'selected' for this presentation.
Understand what your audience is. Think why they are there to see your presentation and their expectations. Study the background of the audience in advance if possible. When you do the presentation, make sure that you communicate to them that they are 'selected' for this presentation.
Have a list of points that you want to communicate to your audience, prioritize them accordingly. See whether there is any point that is difficult to understand by the audience. If there are such points, chunk them further.
Have a list of points that you want to communicate to your audience, prioritize them accordingly. See whether there is any point that is difficult to understand by the audience. If there are such points, chunk them further.
Decide on the tone you want to use in the presentation. It could be motivational, informational, celebration, etc.
Decide on the tone you want to use in the presentation. It could be motivational, informational, celebration, etc.
Prepare an opening speech for the presentation. Do not spend much time on it though.
Prepare an opening speech for the presentation. Do not spend much time on it though.
Point out all contents in brief and explain them as you've planned.
Point out all contents in brief and explain them as you've planned.
Have a Q&A (questions and answers) session at the end of the presentation.
Have a Q&A (questions and answers) session at the end of the presentation.
When your presentation is supported by additional material, you can make more impact on the audience. Reports, articles and flyers are just a few examples.
If your presentation is informative and a lot of data is presented, handing out a soft or hard copy of your presentation is a good idea.
Following are some guidelines on presentation materials:
Make sure that you check the computer, projector and network connectivity in advance to the presentation. I'm sure you do not want to spend the first half of your presentation fixing those in front of your audience.
Make sure that you check the computer, projector and network connectivity in advance to the presentation. I'm sure you do not want to spend the first half of your presentation fixing those in front of your audience.
Use a simple, but consistent layout. Do not overload the presentation with images and animations.
Use a simple, but consistent layout. Do not overload the presentation with images and animations.
When it comes to time allocation, spend 3-5 minutes for each slide. Each slide should ideally have about 5-8 bullet lines. This way, the audience can stay focused and grab your points.
When it comes to time allocation, spend 3-5 minutes for each slide. Each slide should ideally have about 5-8 bullet lines. This way, the audience can stay focused and grab your points.
Do not distribute the supplementary material before the presentation. They may read the material during the presentation and miss what you say. Therefore, distribute the material after the presentation.
Do not distribute the supplementary material before the presentation. They may read the material during the presentation and miss what you say. Therefore, distribute the material after the presentation.
Delivering the presentation is the most important step of the process. This is where you make the primary contact with your audience. Consider the following points in order to deliver an effective presentation.
Be prepared for your presentation. Complete the designing phase of the presentation and practice it a few times before you actually do it. This is the most important part of your presentation. Know the content of your presentation in and out. When you know your presentation, you can recover if something goes wrong.
Be prepared for your presentation. Complete the designing phase of the presentation and practice it a few times before you actually do it. This is the most important part of your presentation. Know the content of your presentation in and out. When you know your presentation, you can recover if something goes wrong.
Use true examples to explain your points. If these examples are common to you and the audience, it will have a great impact. Use your personal experiences to show them the practical point of view.
Use true examples to explain your points. If these examples are common to you and the audience, it will have a great impact. Use your personal experiences to show them the practical point of view.
Relax! Stay relaxed and calm during the presentation. Your body language is quite important for the audience. If they see you tensed, they may not receive what you say. They may even judge you!
Relax! Stay relaxed and calm during the presentation. Your body language is quite important for the audience. If they see you tensed, they may not receive what you say. They may even judge you!
Use humour in the presentation. Use it naturally to make your point. Do not try to crack jokes when you are not supposed to do it.
Use humour in the presentation. Use it naturally to make your point. Do not try to crack jokes when you are not supposed to do it.
Pay attention to details. Remember the old saying; devil is in details. Choose the place, people and materials wisely.
Pay attention to details. Remember the old saying; devil is in details. Choose the place, people and materials wisely.
Presenting your idea to convince an audience is always a challenge.
Every presentation is a new experience for all of us. Therefore, you should plan your presentations way in advance.
Pay close attention to the points we discussed above and adhere to them in your next presentation.
Good luck!
In any industry, some of the demands managers face is to be cost effective. In addition to that, they are also faced with challenges such as to analyze costs and profits on a product or consumer basis, to be flexible to face ever altering business requirements, and to be informed of management decision making processes and changes in ways of doing business.
However, some of the challenges holding managers back include the difficulty in attaining accurate information, lack of applications that mimic existing business practices and bad interfaces. When some challengers are holding a manager back, that is where Enterprise Resource Planning (ERP) comes into play.
Over the years business applications have evolved from Management Information Systems with no decision support to Corporate Information Systems, which offer some decision support to Enterprise Resource Planning. Enterprise Resource Planning is a software solution that tackles the needs of an organization, taking into account the process view to meet an organization's goals while incorporating all the functions of an organization.
Its purpose is to make easy the information flow between all business functions within the boundaries of the organization and manage the organization's connections with its outside stakeholders.
In a nutshell, the Enterprise Resource Planning software tries to integrate all the different departments and functions of an organization into a single computer system to serve the various needs of these departments.
The task at hand, of implementing one software program that looks after the needs of the Finance Department together with the needs of the Human Resource Department and the Warehouse, seems impossible. These different departments usually have an individual software program that is optimized in the way each department works.
However, if installed correctly this integrated approach can be very cost effective for an organization. With an integrated solution, different departments can easily share information and communicate with one another.
The following diagram illustrates the differences between non-integrated systems versus an integrated system for enterprise resource planning.
There are two main driving forces behind Enterprise Resource Planning for a business organization.
In a business sense, Enterprise Resource Planning ensures customer satisfaction, as it leads to business development that is development of new areas, new products and new services.
Also, it allows businesses to face competition for implementing Enterprise Resource Planning, and it ensures efficient processes that push the company into top gear.
In a business sense, Enterprise Resource Planning ensures customer satisfaction, as it leads to business development that is development of new areas, new products and new services.
Also, it allows businesses to face competition for implementing Enterprise Resource Planning, and it ensures efficient processes that push the company into top gear.
In an IT sense: Most softwares does not meet business needs wholly and the legacy systems today are hard to maintain. In addition, outdated hardware and software is hard to maintain.
In an IT sense: Most softwares does not meet business needs wholly and the legacy systems today are hard to maintain. In addition, outdated hardware and software is hard to maintain.
Hence, for the above reasons, Enterprise Resource Planning is necessary for management in today's business world. ERP is single software, which tackles problems such as material shortages, customer service, finances management, quality issues and inventory problems. An ERP system can be the dashboard of the modern era managers.
Producing Enterprise Resource Planning (ERP) software is complex and also has many significant implications for staff work practice. Implementing the software is a difficult task too and one that 'in-house' IT specialists cannot handle. Hence to implement ERP software, organizations hire third party consulting companies or an ERP vendor.
This is the most cost effective way. The time taken to implement an ERP system depends on the size of the business, the number of departments involved, the degree of customization involved, the magnitude of the change and the cooperation of customers to the project.
With Enterprise Resource Planning (ERP) software, accurate forecasting can be done. When accurate forecasting inventory levels are kept at maximum efficiency, this allows for the organization to be profitable.
With Enterprise Resource Planning (ERP) software, accurate forecasting can be done. When accurate forecasting inventory levels are kept at maximum efficiency, this allows for the organization to be profitable.
Integration of the various departments ensures communication, productivity and efficiency.
Integration of the various departments ensures communication, productivity and efficiency.
Adopting ERP software eradicates the problem of coordinating changes between many systems.
Adopting ERP software eradicates the problem of coordinating changes between many systems.
ERP software provides a top-down view of an organization, so information is available to make decisions at anytime, anywhere.
ERP software provides a top-down view of an organization, so information is available to make decisions at anytime, anywhere.
Adopting ERP systems can be expensive.
Adopting ERP systems can be expensive.
The lack of boundaries created by ERP software in a company can cause problems of who takes the blame, lines of responsibility and employee morale.
The lack of boundaries created by ERP software in a company can cause problems of who takes the blame, lines of responsibility and employee morale.
While employing an ERP system may be expensive, it offers organizations a cost efficient system in the long run.
ERP software works by integrating all the different departments in on organization into one computer system allowing for efficient communication between these departments and hence enhances productivity.
The organizations should take extra precautions when it comes to choosing the correct ERP system for them. There have been many cases that organizations have lost a lot of money due to selecting the 'wrong' ERP solution and a service provider for them.
In the initial stages of a project, complex processes and the many risks involved make it impossible to accurately model. A model of a project is necessary for efficient project management.
Event Chain Methodology, an improbable modelling and schedule network analysis technique, is a solution to this problem. This technique is used to manage events and event chains that influence project schedules.
It is neither a simulation nor a risky analysis method but rather works using existing methodologies such as Monte Carlo Analysis and Bayesian Believe Network. Also, event chain methodology is used for modelling probabilities for different businesses and many technological processes of which one is project management.
Event Chain Methodology is based on six main principles
Moment of Risk and State of Activity - In a real life project process, a task or an activity is not always a continuous procedure. Neither is it a uniform one. A factor that influences tasks is external events, which in turn transform tasks or activities from one position to another.
During the course of a project, the time or moment when an event occurs is a very important component of the event. This time or moment is predominantly probabilistic and can be characterized using statistical distribution. More often than not, these external events have a negative impact on the project.
Event Chains - An external event can lead to another event and so forth. This creates event chains. Event chains have a significant impact of the course of a project.
For example, any changed requirements to the materials needed for the project can cause the activity to be delayed. The project manager then allocates resources from another activity. This leads to missed deadlines and eventually leads to the failure of the project.
Monte Carlo Simulations - On the clear definition of events and event chains, Monte Carlo Analysis is utilized in order to quantify the collective consequences of the events.
The probability of the risks occurring and the effects they may have are used as input data for the Monte Carlo Analysis. This analysis gives a probability curve of the project schedule.
Critical Event Chains - Critical events or critical chains of events are those with the potential to impinge on a project the most. By identifying such events at the very beginning, it is possible to lessen the negative effect they have on projects.
These types of events can be detected by examining the connections between the primary project parameters.
Performance Tracking With Event Chains - It is important for a manager to track the progress of an activity live. This ensures that updated information is used for the Monte Carlo Analysis.
Hence during the duration of the project, the probability of events can be calculated more accurately using actual data.
Event Chain Diagrams - Event Chain Diagrams depict the relationships between external events and tasks and how the two affect each other. These chains are represented by arrows that are associated with a particular activity or time interval on a Gantt chart.
Each event and event chain is represented by a different color. Global events affect all the tasks in a project while local events affect just one task or activity in a project. Event Chain Diagrams allow for the simple modelling and analysis of risks.
The use of Event Chain Methodology in project management produces some interesting phenomenon:
Repeated Activity - Certain external events cause the repetition of activities that have already been completed.
Repeated Activity - Certain external events cause the repetition of activities that have already been completed.
Event Chains and Risk Mitigation - When an event occurs during the course of a project, a mitigation plan, that is an activity that expands the project schedule, is drawn up. The same mitigation plans may be used for several events.
Event Chains and Risk Mitigation - When an event occurs during the course of a project, a mitigation plan, that is an activity that expands the project schedule, is drawn up. The same mitigation plans may be used for several events.
Resource Allocation Based on Events - Another phenomenon that occurs with Event Chain Methodology is the reallocation of resources from one activity to another.
Resource Allocation Based on Events - Another phenomenon that occurs with Event Chain Methodology is the reallocation of resources from one activity to another.
Using existing techniques such as the Monte Carlo Analysis, Event Chain Methodology manages events and subsequent event chains in project management.
Working by six principles, this methodology simplifies the risks and reservations associated with project schedules. Therefore, the project managers and other senior managers, who are responsible for project accounts should have a clear understanding on the Event Chain Methodology.
Since Event Chain Methodology is closely related to many other techniques used in project management, such as Gantt Charts and Monte Carlo Analysis, the project management should be thorough with all supporting techniques and tools for Event Chain Methodology.
There are many methodologies and techniques used when it comes to project management. Some of these methodologies have been there in practice for decades and some of them are brand new.
The latter methodologies have been introduced to the world of project management in order to address some of the difficulties faced by the old methodologies when it comes to addressing modern requirements and challenges of project management.
Extreme project management is one of the modern approaches to project management in software industry. As we all know, the software industry is a fast growing and fast changing domain.
Therefore, most of the software development projects do have changing requirements from the inception to the end of the project. Adding new requirements or changing the requirements during the project execution period is one of the main challenges faced by the traditional project management approach.
The new approach, Extreme Project Management, mainly addresses the aspect of changing requirements.
Let's do some visual comparison between the traditional project management approach and the extreme project management approach in order to understand the nature of extreme project management clearly.
In the traditional approach, the project phases look like below
In the extreme approach, a project will take the following form
By comparing the two visual representations, you will now understand the dynamics of the extreme approach. In extreme project management methodology, there are no fixed project phases and fixed set of guidelines on how to execute the project activities.
Rather, extreme methodology adapts to the situation and executes the project activity the best way possible.
By nature, extreme project management methodology does not have lengthy deadlines or delivery dates. The delivery cycles are shorter and usually they are 2 weeks.
Therefore, the entire project team is focused on delivering the scope of the delivery in short term. This allows the team to welcome any scope or requirement changes for the next delivery cycle.
The best way to compare traditional project management and extreme project management is through a comparison between classical music and jazz. Extreme project management is like jazz music.
The team members are given a lot of freedom to add their variety to the project team. Whenever a team member feels making a decision that will add value to the overall project, it is allowed by the project management.
In addition, each individual of the project team is responsible for the management of their own assignment and the quality of the same.
In contrast, the traditional approach is much more streamlined, well-defined approach where the project manager guides the entire team towards project goals.
In extreme project management approach, team members collectively share the project management responsibilities.
Mindset is the most critical factor when it comes to extreme project management. First of all, the team should undergo a comprehensive training on extreme approach in order to understand the basics and core principles of the approach.
In this training, the individuals also get to gauge themselves and see whether they are a fit or not.
In extreme approach, things are done totally a different way, when compared to tradition approaches. Therefore, changing the mindset of the project team is one of the main requirements and responsibilities of the management team.
When it comes to changing the mindset, consider the following rules as the ground rules for extreme approach for project management.
Requirements and project activities being chaotic is normal
Requirements and project activities being chaotic is normal
Uncertainty is the most certain characteristic of an extreme project
Uncertainty is the most certain characteristic of an extreme project
This type of projects are not fully controllable
This type of projects are not fully controllable
Change is the king and you need to welcome it every possible way
Change is the king and you need to welcome it every possible way
The feeling of security is increased by relaxing the project controls
The feeling of security is increased by relaxing the project controls
Self-management is one of the key aspects of extreme project management. As we have already elaborated, there is no central project management authority in such projects. The project manager is just a facilitator and a mentor.
Therefore, the project management responsibilities are distributed among the project team members. Each member of the project should execute their management responsibilities and indirectly contribute to the management function of the project.
Extreme project management is like living in a different planet. You cannot compare extreme approach to the traditional approach and try to find truce.
Therefore, moving from traditional approach to extreme approach is not quite as easy as moving from Windows to Mac.
If you are having the responsibility of managing a team through extreme approach, first see whether you are ready for the challenge. Go through a good training on extreme project management and learn as much as you can.
Never try to define or approach extreme project tasks through conventional definitions and approaches.
Gantt chart is a type of a bar chart that is used for illustrating project schedules. Gantt charts can be used in any projects that involve effort, resources, milestones and deliveries.
At present, Gantt charts have become the popular choice of project managers in every field.
Gantt charts allow project managers to track the progress of the entire project. Through Gantt charts, the project manager can keep a track of the individual tasks as well as of the overall project progression.
In addition to tracking the progression of the tasks, Gantt charts can also be used for tracking the utilization of the resources in the project. These resources can be human resources as well as materials used.
Gantt chart was invented by a mechanical engineer named Henry Gantt in 1910. Since the invention, Gantt chart has come a long way. By today, it takes different forms from simple paper based charts to sophisticated software packages.
As we have already discussed, Gantt charts are used for project management purposes. In order to use Gantt charts in a project, there are a few initial requirements fulfilled by the project.
First of all, the project should have a sufficiently detailed Work Breakdown Structure (WBS).
Secondly, the project should have identified its milestones and deliveries.
In some instances, project managers try to define the work break down structure while creating Gantt chart. This is one of the frequently practised errors in using Gantt charts. Gantt charts are not designed to assist WBS process; rather Gantt charts are for task progress tracking.
Gantt charts can be successfully used in projects of any scale. When using Gantt charts for large projects, there can be an increased complexity when tracking the tasks.
This problem of complexity can be successfully overcome by using computer software packages designed for offering Gantt chart functionalities.
There are dozens of Gantt chart tools that can be used for successful project tracking. These tools usually vary by the feature offered.
The simplest kind of Gantt chart can be created using a software tool such as Microsoft Excel. For that matter, any spreadsheet tool can be used to design a Gantt chart template.
If the project is small scale and does not involve many parallel tasks, a spreadsheet based Gantt chart can be the most effective type.
Microsoft Project is one of the key Gantt chart tools used today. Especially for software development projects, MS Project based Gantt charts are essential to track the hundreds of parallel tasks involved in the software development life cycle.
There are many other Gantt chart tools available for free and for price. The features offered by these tools range from the same features offered by Excel based Gantt charts to MS Project Gantt charts. These tools come with different price tags and feature levels, so one can select the suitable Gantt chart tool for the purpose in hand.
Sometimes, one may decide to create their own Gantt chart tool without buying an existing one. If this is the case, first of all, one should search the Internet for free Gantt chart templates.
This way, one may actually find the exact Gantt chart template (probably in Excel) required for the purpose. In case, if no match is found, then it is sensible to create one's own.
Excel is the most popular tool for creating custom Gantt charts. Of course, one can create a Gantt chart from scratch in Excel, but it is always advisable to use a Project Management add-on in Excel to create Gantt charts.
These project management add-ons are published by Microsoft and other third-party companies.
The ability to grasp the overall status of a project and its tasks at once is the key advantage in using a Gantt chart tool. Therefore, upper management or the sponsors of the project can make informed decisions just by looking at the Gantt chart tool.
The software-based Gantt charts are able to show the task dependencies in a project schedule. This helps to identify and maintain the critical path of a project schedule.
Gantt chart tools can be used as the single entity for managing small projects. For small projects, no other documentation may be required; but for large projects, the Gantt chart tool should be supported by other means of documentation.
For large projects, the information displayed in Gantt charts may not be sufficient for decision making.
Although Gantt charts accurately represent the cost, time and scope aspects of a project, it does not elaborate on the project size or size of the work elements. Therefore, the magnitude of constraints and issues can be easily misunderstood.
Gantt chart tools make project manager's life easy. Therefore, Gantt chart tools are important for successful project execution.
Identifying the level of detail required in the project schedule is the key when selecting a suitable Gantt chart tool for the project.
One should not overly complicate the project schedules by using Gantt charts to manage the simplest tasks.
Just-in-time manufacturing was a concept introduced to the United States by the Ford motor company. It works on a demand-pull basis, contrary to hitherto used techniques, which worked on a production-push basis.
To elaborate further, under just-in-time manufacturing (colloquially referred to as JIT production systems), actual orders dictate what should be manufactured, so that the exact quantity is produced at the exact time that is required.
Just-in-time manufacturing goes hand in hand with concepts such as Kanban, continuous improvement and total quality management (TQM).
Just-in-time production requires intricate planning in terms of procurement policies and the manufacturing process if its implementation is to be a success.
Highly advanced technological support systems provide the necessary back-up that Just-in-time manufacturing demands with production scheduling software and electronic data interchange being the most sought after.
Following are the advantages of Adopting Just-In-Time Manufacturing Systems
Just-in-time manufacturing keeps stock holding costs to a bare minimum. The release of storage space results in better utilization of space and thereby bears a favorable impact on the rent paid and on any insurance premiums that would otherwise need to be made.
Just-in-time manufacturing keeps stock holding costs to a bare minimum. The release of storage space results in better utilization of space and thereby bears a favorable impact on the rent paid and on any insurance premiums that would otherwise need to be made.
Just-in-time manufacturing eliminates waste, as out-of-date or expired products; do not enter into this equation at all.
Just-in-time manufacturing eliminates waste, as out-of-date or expired products; do not enter into this equation at all.
As under this technique, only essential stocks are obtained, less working capital is required to finance procurement. Here, a minimum re-order level is set, and only once that mark is reached, fresh stocks are ordered making this a boon to inventory management too.
As under this technique, only essential stocks are obtained, less working capital is required to finance procurement. Here, a minimum re-order level is set, and only once that mark is reached, fresh stocks are ordered making this a boon to inventory management too.
Due to the aforementioned low level of stocks held, the organizations return on investment (referred to as ROI, in management parlance) would generally be high.
Due to the aforementioned low level of stocks held, the organizations return on investment (referred to as ROI, in management parlance) would generally be high.
As just-in-time production works on a demand-pull basis, all goods made would be sold, and thus it incorporates changes in demand with surprising ease. This makes it especially appealing today, where the market demand is volatile and somewhat unpredictable.
As just-in-time production works on a demand-pull basis, all goods made would be sold, and thus it incorporates changes in demand with surprising ease. This makes it especially appealing today, where the market demand is volatile and somewhat unpredictable.
Just-in-time manufacturing encourages the 'right first time' concept, so that inspection costs and cost of rework is minimized.
Just-in-time manufacturing encourages the 'right first time' concept, so that inspection costs and cost of rework is minimized.
High quality products and greater efficiency can be derived from following a just-in-time production system.
High quality products and greater efficiency can be derived from following a just-in-time production system.
Close relationships are fostered along the production chain under a just-in-time manufacturing system.
Close relationships are fostered along the production chain under a just-in-time manufacturing system.
Constant communication with the customer results in high customer satisfaction.
Constant communication with the customer results in high customer satisfaction.
Overproduction is eliminated when just-in-time manufacturing is adopted.
Overproduction is eliminated when just-in-time manufacturing is adopted.
Following are the disadvantages of Adopting Just-In-Time Manufacturing Systems
Just-in-time manufacturing provides zero tolerance for mistakes, as it makes re-working very difficult in practice, as inventory is kept to a bare minimum.
Just-in-time manufacturing provides zero tolerance for mistakes, as it makes re-working very difficult in practice, as inventory is kept to a bare minimum.
There is a high reliance on suppliers, whose performance is generally outside the purview of the manufacturer.
There is a high reliance on suppliers, whose performance is generally outside the purview of the manufacturer.
Due to there being no buffers for delays, production downtime and line idling can occur which would bear a detrimental effect on finances and on the equilibrium of the production process.
Due to there being no buffers for delays, production downtime and line idling can occur which would bear a detrimental effect on finances and on the equilibrium of the production process.
The organization would not be able to meet an unexpected increase in orders due to the fact that there are no excess finish goods.
The organization would not be able to meet an unexpected increase in orders due to the fact that there are no excess finish goods.
Transaction costs would be relatively high as frequent transactions would be made.
Transaction costs would be relatively high as frequent transactions would be made.
Just-in-time manufacturing may have certain detrimental effects on the environment due to the frequent deliveries that would result in increased use of transportation, which in turn would consume more fossil fuels.
Just-in-time manufacturing may have certain detrimental effects on the environment due to the frequent deliveries that would result in increased use of transportation, which in turn would consume more fossil fuels.
Following are the things to Remember When Implementing a Just-In-Time Manufacturing System
Management buy-in and support at all levels of the organization are required; if a just-in-time manufacturing system is to be successfully adopted.
Management buy-in and support at all levels of the organization are required; if a just-in-time manufacturing system is to be successfully adopted.
Adequate resources should be allocated, so as to obtain technologically advanced software that is generally required if a just-in-time system is to be a success.
Adequate resources should be allocated, so as to obtain technologically advanced software that is generally required if a just-in-time system is to be a success.
Building a close, trusting relationship with reputed and time-tested suppliers will minimize unexpected delays in the receipt of inventory.
Building a close, trusting relationship with reputed and time-tested suppliers will minimize unexpected delays in the receipt of inventory.
Just-in-time manufacturing cannot be adopted overnight. It requires commitment in terms of time and adjustments to corporate culture would be required, as it is starkly different to traditional production processes.
Just-in-time manufacturing cannot be adopted overnight. It requires commitment in terms of time and adjustments to corporate culture would be required, as it is starkly different to traditional production processes.
The design flow process needs to be redesigned and layouts need to be re-formatted, so as to incorporate just-in-time manufacturing.
The design flow process needs to be redesigned and layouts need to be re-formatted, so as to incorporate just-in-time manufacturing.
Lot sizes need to be minimized.
Lot sizes need to be minimized.
Workstation capacity should be balanced whenever possible.
Workstation capacity should be balanced whenever possible.
Preventive maintenance should be carried out, so as to minimize machine breakdowns.
Preventive maintenance should be carried out, so as to minimize machine breakdowns.
Set-up times should be reduced wherever possible.
Set-up times should be reduced wherever possible.
Quality enhancement programs should be adopted, so that total quality control practices can be adopted.
Quality enhancement programs should be adopted, so that total quality control practices can be adopted.
Reduction in lead times and frequent deliveries should be incorporated.
Reduction in lead times and frequent deliveries should be incorporated.
Motion waste should be minimized, so the incorporation of conveyor belts might prove to be a good idea when implementing a just-in-time manufacturing system.
Motion waste should be minimized, so the incorporation of conveyor belts might prove to be a good idea when implementing a just-in-time manufacturing system.
Just-in-time manufacturing is a philosophy that has been successfully implemented in many manufacturing organizations.
It is an optimal system that reduces inventory whilst being increasingly responsive to customer needs, this is not to say that it is not without its pitfalls.
However, these disadvantages can be overcome with a little forethought and a lot of commitment at all levels of the organization.
Knowledge management is an activity practised by enterprises all over the world. In the process of knowledge management, these enterprises comprehensively gather information using many methods and tools.
Then, gathered information is organized, stored, shared, and analyzed using defined techniques.
The analysis of such information will be based on resources, documents, people and their skills.
Properly analyzed information will then be stored as 'knowledge' of the enterprise. This knowledge is later used for activities such as organizational decision making and training new staff members.
There have been many approaches to knowledge management from early days. Most of early approaches have been manual storing and analysis of information. With the introduction of computers, most organizational knowledge and management processes have been automated.
Therefore, information storing, retrieval and sharing have become convenient. Nowadays, most enterprises have their own knowledge management framework in place.
The framework defines the knowledge gathering points, gathering techniques, tools used, data storing tools and techniques and analyzing mechanism.
The process of knowledge management is universal for any enterprise. Sometimes, the resources used, such as tools and techniques, can be unique to the organizational environment.
The Knowledge Management process has six basic steps assisted by different tools and techniques. When these steps are followed sequentially, the data transforms into knowledge.
This is the most important step of the knowledge management process. If you collect the incorrect or irrelevant data, the resulting knowledge may not be the most accurate. Therefore, the decisions made based on such knowledge could be inaccurate as well.
There are many methods and tools used for data collection. First of all, data collection should be a procedure in knowledge management process. These procedures should be properly documented and followed by people involved in data collection process.
The data collection procedure defines certain data collection points. Some points may be the summary of certain routine reports. As an example, monthly sales report and daily attendance reports may be two good resources for data collection.
With data collection points, the data extraction techniques and tools are also defined. As an example, the sales report may be a paper-based report where a data entry operator needs to feed the data manually to a database whereas, the daily attendance report may be an online report where it is directly stored in the database.
In addition to data collecting points and extraction mechanism, data storage is also defined in this step. Most of the organizations now use a software database application for this purpose.
The data collected need to be organized. This organization usually happens based on certain rules. These rules are defined by the organization.
As an example, all sales-related data can be filed together and all staff-related data could be stored in the same database table. This type of organization helps to maintain data accurately within a database.
If there is much data in the database, techniques such as 'normalization' can be used for organizing and reducing the duplication.
This way, data is logically arranged and related to one another for easy retrieval. When data passes step 2, it becomes information.
In this step, the information is summarized in order to take the essence of it. The lengthy information is presented in tabular or graphical format and stored appropriately.
For summarizing, there are many tools that can be used such as software packages, charts (Pareto, cause-and-effect), and different techniques.
At this stage, the information is analyzed in order to find the relationships, redundancies and patterns.
An expert or an expert team should be assigned for this purpose as the experience of the person/team plays a vital role. Usually, there are reports created after analysis of information.
At this point, information becomes knowledge. The results of analysis (usually the reports) are combined together to derive various concepts and artefacts.
A pattern or behavior of one entity can be applied to explain another, and collectively, the organization will have a set of knowledge elements that can be used across the organization.
This knowledge is then stored in the organizational knowledge base for further use.
Usually, the knowledge base is a software implementation that can be accessed from anywhere through the Internet.
You can also buy such knowledge base software or download an open-source implementation of the same for free.
At this stage, the knowledge is used for decision making. As an example, when estimating a specific type of a project or a task, the knowledge related to previous estimates can be used.
This accelerates the estimation process and adds high accuracy. This is how the organizational knowledge management adds value and saves money in the long run.
Knowledge management is an essential practice for enterprise organizations. Organizational knowledge adds long-term benefits to the organization in terms of finances, culture and people.
Therefore, all mature organizations should take necessary steps for knowledge management in order to enhance the business operations and organization's overall capability.
When it comes to project activity management, activity sequencing is one of the main tasks. Among many other parameters, float is one of the key concepts used in project scheduling.
Float can be used to facilitate the freedom for a particular task. Let's have a look at the float in detail.
When it comes to each activity in the project, there are four parameters for each related to the timelines. Those are defined as:
Earliest start time (ES) - The earliest time, an activity can start once the previous dependent activities are over.
Earliest start time (ES) - The earliest time, an activity can start once the previous dependent activities are over.
Earliest finish time (EF) - This would be ES + activity duration.
Earliest finish time (EF) - This would be ES + activity duration.
Latest finish time (LF) - The latest time an activity can finish without delaying the project.
Latest finish time (LF) - The latest time an activity can finish without delaying the project.
Latest start time (LS) - This would be LF - activity duration.
Latest start time (LS) - This would be LF - activity duration.
The float time for an activity is the time between the earliest (ES) and the latest (LS) start time or between the earliest (EF) and latest (LF) finish times. During the float time, an activity can be delayed without delaying the project finish date.
In an illustration, this is how it looks:
Leads and Lags are types of float. Let's take an example to understand this.
In project management, there are four types of dependencies:
Finish to Start (FS) - Later task does not start until the previous task is finished
Finish to Start (FS) - Later task does not start until the previous task is finished
Finish to Finish (FF) - Later task does not finish until the previous task is finished
Finish to Finish (FF) - Later task does not finish until the previous task is finished
Start to Start (SS) - Later task does not start until the previous task starts
Start to Start (SS) - Later task does not start until the previous task starts
Start to Finish (SF) - Later task does not finish before previous task starts
Start to Finish (SF) - Later task does not finish before previous task starts
Take the scenario of building two identical walls of the same house using the same material. Let's say, building the first wall is task A and building the second one is task B. The engineer wants to delay task B for two days. This is due to the fact that the material used for both A and B are a new type, so the engineer wants to learn from A and then apply if there is anything to B. Therefore, the two tasks A and B have a SS relationship.
The time between the start dates of the two tasks can be defined as a lag (2 days in this case).
If the relationship between task A and B was Finish to Start (FS), then the 'lead' can be illustrated as:
Task B started prior to Task A with a 'lead.'
For a project manager, the concepts of float, lead and lag make a lot of meaning and sense. These aspects of tasks are important in order to calculate project timeline variations and eventually the project completion time.
Management is the core function of any organization. Management is responsible for wellbeing of the company and its stakeholders, such as the investors and employees.
Therefore, the management should be a skilled, experienced, and motivated set of individuals, who will do whatever necessary for the best interest of the company and stakeholders.
Best practices are usually outcomes of knowledge management. Best practices are the reusable practices of the organization that have been successful in respective functions.
There are two types of best practices in an organization:
Internal best practices - Internal best practices are originated by the internal knowledge management efforts.
Internal best practices - Internal best practices are originated by the internal knowledge management efforts.
External (industry) best practices - External best practices are acquired to the company by hiring the skilled, educated and experienced staff and through external trainings.
External (industry) best practices - External best practices are acquired to the company by hiring the skilled, educated and experienced staff and through external trainings.
When it comes to management best practices, there are plenty. They can be further subdivided into different sub-domains within management, such as human resources, technical, etc.
But in this brief article, we take management as a general practice and will not elaborate on different sub-domains.
When it comes to management best practices, we can identify five distinct areas where the best practices can be applied.
Management is all about communicating to the staff and the clients. Effective communication is a must when it comes to successful management.
The management should have a set of best practices defined for clear and effective communication from/to the staff and the clients.
Respect is something you should earn in a corporate environment. Leading by examples is the best way of doing this. Define and adhere to leadership by example best practices and also make sure your subordinates do the same.
Realistic goals can boost the corporate morale. Most of the times, organizations fail due to unrealistic, unachievable goals and objectives.
There are many best practices on how to set goals and objectives, such as SWAT analysis. Since the goals are the driving factor behind your organization, you need to make use of every possible best practice for goal setting.
When your management style is open and transparent, others respect you more. In addition, information directly flows from the problem areas to you.
Always try to follow the open door policies that do not restrict your subordinates coming to you directly.
This is the most important best practice area when it comes to long-term benefits for the company. Usually, experienced people in management, such as Jack Welch, have their own, successful best practices for strategic corporate planning.
It is always a good idea to learn such ideas from exceptional people and apply them in your own context.
There are many tools a manager can use for practising management best practices. Following are some areas where you can use such tools.
Benchmarking is a domain itself. Accurate benchmarking helps you to understand the capability of your company or the departments.
Benchmarks can then be used for evaluating and assessing the performance of your company.
Forecasting, especially, financial forecasting is a key function for a business organization. There are many tools such as price sheets, effort estimates for accurate forecasting.
Matrix is one of the best practices in performance monitoring. In addition, you can define certain KPIs (Key Performance Indicators) for measuring and assessing the performance of departments, functions and people.
We will have a detailed look into KPIs in the next section.
This is the most effective way of monitoring all the aspects of your business organization.
You can set up KPIs for any aspect of the business and start monitoring the progress of the respective aspects.
As an example, you can define KPIs for sales targets and monitor their progress over time. When the sales figures do not meet the KPIs, you can look into the issues and rectify them.
The KPIs used depend on your business domain. When KPIs are defined, they should align with your overall business objectives.
Organizations can achieve a great success by employing management best practices.
This is one way to make sure that the same mistake is not repeated. Once a best practice is derived through knowledge management, it should be properly documented and integrated to the relevant functions of the company.
Best practices should be included into the corporate trainings regularly.
In an organization, managers perform many functions and play many roles. They are responsible for handling many situations and these situations are usually different from one another.
When it comes to handling such situations, managers use their own management styles.
Some management styles may be best for the situation and some may not be. Therefore, awareness on different types of management styles will help the managers to handle different situations the optimal way.
In short, a management style is a leadership method used by a manager. Let's have a look at four main management styles practised by managers all over the world.
In this management style, the manager becomes the sole decision maker.
The manager does not care about the subordinates and their involvement in decision making. Therefore, the decisions reflect the personality and the opinion of the manager.
The decision does not reflect the team's collective opinion. In some cases, this style of management can move a business towards its goals rapidly and can fight through a challenging time.
If the manager has a great personality, experience and exposure, the decisions made by him or her could be better than collective decision making. On the other hand, subordinates may become dependent upon the manager's decisions and may require thorough supervision.
There are two types of autocratic managers:
Directive autocrat. This type of managers make their decisions alone and supervise the subordinates closely.
Directive autocrat. This type of managers make their decisions alone and supervise the subordinates closely.
Permissive autocrat. This type of managers make their decisions alone, but allows subordinates to freely execute the decisions.
Permissive autocrat. This type of managers make their decisions alone, but allows subordinates to freely execute the decisions.
In this style, the manager is open to other's opinions and welcome their contribution into the decision making process. Therefore, every decision is made with the majority's agreement.
The decisions made reflect the team's opinion. For this management style to work successfully, robust communication between the managers and the subordinates is a must.
This type of management is most successful when it comes to decision making on a complex matter where a range of expert advice and opinion is required.
Before making a business decision, usually a series of meetings or brainstorming sessions take place in the organizations. These meetings are properly planned and documented.
Therefore, organization can always go back to the decision making process and see the reasons behind certain decisions. Due to the collective nature, this style of management gives more employee satisfaction.
If decision making through the democratic style takes too long for a critical situation, then it is time to employ autocrat management style before it is too late.
This is one of the dictatorial types of management. The decisions made are usually for the best interest of the company as well as the employees.
When the management makes a decision, it is explained to the employees and obtains their support as well.
In this management style, work-life balance is emphasized and it eventually maintains a high morale within the organization. In the long run, this guarantees the loyalty of the employees.
One disadvantage of this style is that the employees may become dependent on the managers. This will limit the creativity within the organization.
In this type of management, the manager is a facilitator for the staff. The employees take the responsibility of different areas of their work. Whenever the employees face an obstacle, the manager intervenes and removes it. In this style, the employee is more independent and owns his or her responsibilities. The manager has only a little managerial tasks to perform.
When compared with other styles, a minimum communication takes place in this management style between the employees and the managers.
This style of management is the best suited for companies such as technology companies where there are highly professional and creative employees.
Different management styles are capable of handling different situations and solving different problems.
Therefore, a manager should be a dynamic person, who has insight into many types of management styles.
There are various management philosophies and types used in the world of business. These types of management differ from one another.
In some cases, a few of these management types can be mixed together in order to create something customed for a specific requirement.
Management by Objectives (MBO) is one of the frequently used management types. The popularity and the proven results are the main reasons behind everyone adopting this technique for their organization.
As valid as it is for many management types, MBO is a systematic and organized approach that emphasizes the achievement of goals. In the long run, this allows the management to change the organization's mindset to become more result oriented.
The core aim of management by objectives is the alignment of company goals and subordinate objectives properly, so everyone in the organization works towards achieving the same organizational goal. In order to identify the organizational goals, the upper management usually follows techniques such as GQM (Goal, Questions and Metrics).
In order to set the objectives for the employees, the following steps are followed:
The management chunks down the organizational goals and assign chunks to senior managers.
The management chunks down the organizational goals and assign chunks to senior managers.
Senior managers then derive objectives for them to achieve the assigned organizational goals. This is where senior managers assign the objectives to the operational management.
Senior managers then derive objectives for them to achieve the assigned organizational goals. This is where senior managers assign the objectives to the operational management.
Operational management then chunks down their objectives and identify the activities required for achieving the objectives. These sub-objectives and activities are then assigned to rest of the staff.
Operational management then chunks down their objectives and identify the activities required for achieving the objectives. These sub-objectives and activities are then assigned to rest of the staff.
When objectives and activities are assigned, the management gives strong inputs to clearly identify the objectives, time frame for completion, and tracking options.
When objectives and activities are assigned, the management gives strong inputs to clearly identify the objectives, time frame for completion, and tracking options.
Each objective is properly tracked and the management gives periodic feedback to the objective owner.
Each objective is properly tracked and the management gives periodic feedback to the objective owner.
In most occasions, the organization defines processes and procedures in order to track the objectives and feedback.
In most occasions, the organization defines processes and procedures in order to track the objectives and feedback.
At the end of the agreed period (usually an year), the objective achievement is reviewed and an appraisal is performed. Usually, the outcomes of this assessment are used to determine the salary increments for year ahead and relevant bonuses to employees.
At the end of the agreed period (usually an year), the objective achievement is reviewed and an appraisal is performed. Usually, the outcomes of this assessment are used to determine the salary increments for year ahead and relevant bonuses to employees.
Activity trap is one of the issues that prevent the success of MBO process. This happens when employees are more focused on daily activities rather than the long-term objectives. Overloaded activities are a result of vicious cycles and this cycle should be broken through proper planning.
In MBO, the management focus is on the result, not the activity. The tasks are delegated through negotiations and there is no fixed roadmap for the implementation. The implementation is done dynamically and to suit the situation.
Although MBO is extremely result oriented, not all enterprises can benefit from MBO implementations. The MBO is most suitable for knowledge-based enterprises where the staff is quite competent of what they do.
Specially, if the management is planning to implement a self-leadership culture among the employees, MBO is the best way to initiate that process.
Since individuals are empowered to carry out stretched tasks and responsibilities under MBO, individual responsibilities play a vital role for the success of MBO.
In MBO, there is a link built between the strategic thinking of the upper management and the operational execution of the lower levels of the hierarchy.
The responsibility of achieving the objectives is passed from the organization to each individual of the organization.
Management by objectives is mainly achieved through self-control. Nowadays, especially in knowledge-based organizations, the employees are self-managers, who are able to make their own decisions. In such organizations, the management should ask three basic questions from its employees.
What should be your responsibilities?
What should be your responsibilities?
What information is required by you from the management and the peers?
What information is required by you from the management and the peers?
What information should you provide the management and peers in return?
What information should you provide the management and peers in return?
Management by objectives has become de facto practice for management in knowledge-based organizations such as software development companies. The employees are given sufficient responsibility and authority to achieve their individual objectives.
Accomplishment of individual objectives eventually contributes to achieving organizational goals. Therefore, there should be a strong and robust process of assessing the objective achievements of each individual.
This review process should take place periodically and sufficient feedback will make sure that the individual objectives are in par with the organizational goals.
Having been named after the principality famous for its casinos, the term Monte Carlo Analysis conjures images of an intricate strategy aimed at maximizing one's earnings in a casino game.
However, Monte Carlo Analysis refers to a technique in project management where a manager computes and calculates the total project cost and the project schedule many times.
This is done using a set of input values that have been selected after careful deliberation of probability distributions or potential costs or potential durations.
The Monte Carlo Analysis is important in project management as it allows a project manager to calculate a probable total cost of a project as well as to find a range or a potential date of completion for the project.
Since a Monte Carlo Analysis uses quantified data, this allows project managers to better communicate with senior management, especially when the latter is pushing for impractical project completion dates or unrealistic project costs.
Also, this type of an analysis allows the project managers to quantify perils and ambiguities in project schedules.
A project manager creates three estimates for the duration of the project: one being the most likely duration, one the worst case scenario and the other being the best case scenario. For each estimate, the project manager consigns the probability of occurrence.
The project is one that involves three tasks:
The first task is likely to take three days (70% probability), but it can also be completed in two days or even four days. The probability of it taking two days to complete is 10% and the probability of it taking four days to finish is 20%.
The first task is likely to take three days (70% probability), but it can also be completed in two days or even four days. The probability of it taking two days to complete is 10% and the probability of it taking four days to finish is 20%.
The second task has a 60% probability of taking six days to finish, a 20% probability each of being completed in five days or eight days.
The second task has a 60% probability of taking six days to finish, a 20% probability each of being completed in five days or eight days.
The final task has an 80% probability of being completed in four days, 5% probability of being completed in three days and a 15% probability of being completed in five days.
The final task has an 80% probability of being completed in four days, 5% probability of being completed in three days and a 15% probability of being completed in five days.
Using the Monte Carlo Analysis, a series of simulations are done on the project probabilities. The simulation is to run for a thousand odd times, and for each simulation, an end date is noted.
Once the Monte Carlo Analysis is completed, there would be no single project completion date. Instead the project manager has a probability curve depicting the likely dates of completion and the probability of attaining each.
Using this probability curve, the project manager informs the senior management of the expected date of completion. The project manager would choose the date with a 90% chance of attaining it.
Therefore, it could be said that using the Monte Carlo Analysis, the project has a 90% chance of being completed in X number of days.
Similarly, a project manager can adjudge the estimated budget for a project using probabilities to simulate different end results and in turn use the findings in a probability curve.
The above example was one that contained a mere three tasks. In reality, such projects contain hundreds if not thousands of tasks.
Using the Monte Carlo Analysis, a project manager is able to derive a probability curve to show the ambiguity surrounding the duration and the costs surrounding these hundreds or thousands of tasks.
Conducting simulations involving hundreds or thousands of tasks is a tedious job to be done manually.
Today there is project management scheduling software that can conduct thousands of simulations and offer the project manager different end results in a probability curve.
A Monte Carlo Analysis shows the risk analysis involved in a project through a probability distribution that is a model of possible values.
Some of the commonly used probability distributions or curves for Monte Carlo Analysis include:
The Normal or Bell Curve - In this type of probability curve, the values in the middle are the likeliest to occur.
The Normal or Bell Curve - In this type of probability curve, the values in the middle are the likeliest to occur.
The Lognormal Curve - Here values are skewed. A Monte Carlo Analysis gives this type of probability distribution for project management in the real estate industry or oil industry.
The Lognormal Curve - Here values are skewed. A Monte Carlo Analysis gives this type of probability distribution for project management in the real estate industry or oil industry.
The Uniform Curve - All instances have an equal chance of occurring. This type of probability distribution is common with manufacturing costs and future sales revenues for a new product.
The Uniform Curve - All instances have an equal chance of occurring. This type of probability distribution is common with manufacturing costs and future sales revenues for a new product.
The Triangular Curve - The project manager enters the minimum, maximum or most likely values. The probability curve, a triangular one, will display values around the most likely option.
The Triangular Curve - The project manager enters the minimum, maximum or most likely values. The probability curve, a triangular one, will display values around the most likely option.
The Monte Carlo Analysis is an important method adopted by managers to calculate the many possible project completion dates and the most likely budget required for the project.
Using the information gathered through the Monte Carlo Analysis, project managers are able to give senior management the statistical evidence for the time required to complete a project as well as propose a suitable budget.
Motivation is one of the key factors driving us towards achieving something. Without motivation, we will do nothing. Therefore, motivation is one of the key aspects when it comes to corporate management. In order to achieve the best business results, the organization needs to keep employees motivated.
In order to motivate the employees, organizations do various activities. The activities the companies do basically the results and findings of certain motivational theories.
Following are the main motivational theories practised in the modern world:
According to this theory, people are motivated by the greed for power, achievement and affiliation. By offering empowerment, titles and other related tokens, people can be motivated for doing their work.
Humans can be aroused easily by their nature. In this motivation theory, the arousal is used for keeping the people motivated. Take an army as an example. The arousal for eliminating the enemy is a good motivation factor.
Let's take an example. An employee is attracted to a company due to its reputation. Once the employee starts working, he/she develops loyalty towards the company. Later, due to some issue, the company loses its reputation, but employee's loyalty remains.
In this motivation theory, the alignment of attitude and behaviour is used for motivating people.
The urge people have to attribute is used as a motivational factor. Usually, people like to attribute oneself as well as others in different context. This need is used for motivation in this theory.
As an example, getting one's name published in a magazine is a good motivation for the same person to engage further in writing.
This theory emphasizes the fact that the non-alignment to something could make people uncomfortable and eventually motivate them to do the right thing.
This could be considered as the most widely used motivation theory across many domains. When we select tasks to complete, we chunk them down to be doable tasks. The person is motivated to do the tasks as they are simply doable.
This theory uses our internal values for keeping us motivated. As an example, if we promise to do something, we will feel bad about not doing it.
Giving the control to someone is one of the best ways to motivate them. People are thrilled to have control over things.
People can be motivated by keeping them in an environment, which is in alignment with what they believe.
People's need to satisfy their needs is used in this theory. As an example, imagine a case where a person is hungry in an unknown house and find some food under the staircase. When the same person feels hungry at some other unknown house, the person may look under the staircase.
This motivation theory uses the progress as the motivation factor.
Keeping the person in the wrong place may motivate that person to escape from that place. This is sometimes used in corporate environments for employees to find where they really belong.
This is also one of the most used theories in the corporate world. The employee is motivated through rewards.
Desire to achieve goals is the driving force behind this motivation theory.
The organization gets the employees to invest on certain things. If you have invested on something, you will be motivated to enhance and improve it.
This way, employees are motivated by making them happy when it comes to environment, rewards, personal space, etc.
Reducing the salary of a low performer and later setting goals to get the salary back is one of the examples for this type of motivation.
Motivation theories suggest many ways of keeping the employees motivated on what they do. Although a manager is not required to learn all these motivation theories, having an idea of certain theories may be an advantage for day-to-day activities.
These theories give the managers a set of techniques that they can try out in the corporate environments. Some of these theories have been used in business for decades, although we do not know them explicitly.
Management function techniques will never be complete without the manager and even various other employees being able to negotiate effectively.
Any organization runs well based on the skills of their employees. From communication skills to negotiation skills, every organization would need to hone these skills in their workers to ensure the efficient running of a business organization.
You need to understand that these negotiation skills are not very difficult to grasp and will only take time and some careful moves with the other party for you to be able to close a good deal, thereby increasing employee productivity to a great extent.
The most precise definition of a 'negotiation' was given by Richard Shell in his book 'Bargaining for Advantage' as an interactive communication process that may takes place whenever we want something from someone else or another person wants something from us.
Richard Shell then further went on to describe the process of negotiation in four stages:
When it comes to preparation, you would basically need to have a clear idea of how you are to go about with your points. One of the keys to effective negotiation is to be able to express your needs and your thoughts clearly to the other party.
It is important that you carry out some research on your own about the other party before you begin the negotiation process.
This way you will be able to find out the reputation of the other party and any famous tactics used by him/her to try and get people to agree.
You will then be well prepared to face the negotiator with confidence. Reading up on how to negotiate effectively will aid you to a great extent.
The information you provide must always be well researched and must be communicated effectively. Do not be afraid to ask questions in plenty.
That is the best way to understand the negotiator and look at the deal from his/her point of view. If you have any doubts, always clarify them.
The bargaining stage could be said to be the most important of the four stages. This is where most of the work is done by both parties. This is where the actual deal will begin to take shape. Terms and conditions are laid down.
Bargaining is never easy. Both parties would have to learn to compromise on several aspects to come to a final agreement.
This would mean that each party would therefore have to give up something to gain another. It is essential for you to always have an open mind and be tactful while at the same time not giving away too much and settling for less.
The final stage would be where the last few adjustments to the deal are made by the parties involved, before closing the deal and placing their trust in each other for each to fulfill their role.
These four stages have proven to provide great results if studied carefully and applied. Many organizations use this strategy to help their employees negotiate successfully.
In the long run, you'll find that you will have mastered the art of negotiation and will be able to close a good deal without too much effort.
For the task of negotiation to be effective, you would have to ensure at all times that you are not being too aggressive.
Sometimes it is easy to get carried away during the process and take an aggressive approach to asserting your needs. This will not work. It is vital that you are positive about the negotiation process.
You need to keep in mind that the other party too has needs, listen to the negotiators views and opinions, and consider the deal from his/her angle.
You must always ensure that you gain the negotiators trust and that he/she would know that you are reliable.
You would also have to work on your communication skills if you are to be a good negotiator. Although the words coming out of your mouth may mean one thing, your body language could be quite hostile.
This will not bode well if a negotiation process is to be successful. You would need to always check on your body language to ensure that you are not sending out negative vibes, which may put off the negotiator completely.
It is essential to always be pleasant and calm no matter how stressful the process might be. Both these skills therefore will go hand in hand to quite an extent.
It is apt to end with a line from Freund in 'Anatomy of a Merger' 1975: In the last analysis, you cannot learn negotiating techniques from a book. You must actually negotiate.
That in itself sums up the fact that negotiation takes practice. Learning the techniques and applying them will then make you a pro at negotiating.
Any operating organization should have its own structure in order to operate efficiently. For an organization, the organizational structure is a hierarchy of people and its functions.
The organizational structure of an organization tells you the character of an organization and the values it believes in. Therefore, when you do business with an organization or getting into a new job in an organization, it is always a great idea to get to know and understand their organizational structure.
Depending on the organizational values and the nature of the business, organizations tend to adopt one of the following structures for management purposes.
Although the organization follows a particular structure, there can be departments and teams following some other organizational structure in exceptional cases.
Sometimes, some organizations may follow a combination of the following organizational structures as well.
Following are the types of organizational structures that can be observed in the modern business organizations.
Bureaucratic structures maintain strict hierarchies when it comes to people management. There are three types of bureaucratic structures:
This type of organizations lacks the standards. Usually this type of structure can be observed in small scale, start-up companies. Usually the structure is centralized and there is only one key decision maker.
The communication is done in one-on-one conversations. This type of structures is quite helpful for small organizations due to the fact that the founder has the full control over all the decisions and operations.
These structures have a certain degree of standardization. When the organizations grow complex and large, bureaucratic structures are required for management. These structures are quite suitable for tall organizations.
The organizations that follow post-bureaucratic structures still inherit the strict hierarchies, but open to more modern ideas and methodologies. They follow techniques such as total quality management (TQM), culture management, etc.
The organization is divided into segments based on the functions when managing. This allows the organization to enhance the efficiencies of these functional groups. As an example, take a software company.
Software engineers will only staff the entire software development department. This way, management of this functional group becomes easy and effective.
Functional structures appear to be successful in large organization that produces high volumes of products at low costs. The low cost can be achieved by such companies due to the efficiencies within functional groups.
In addition to such advantages, there can be disadvantage from an organizational perspective if the communication between the functional groups is not effective. In this case, organization may find it difficult to achieve some organizational objectives at the end.
These types of organizations divide the functional areas of the organization to divisions. Each division is equipped with its own resources in order to function independently. There can be many bases to define divisions.
Divisions can be defined based on the geographical basis, products/services basis, or any other measurement.
As an example, take a company such as General Electrics. It can have microwave division, turbine division, etc., and these divisions have their own marketing teams, finance teams, etc. In that sense, each division can be considered as a micro-company with the main organization.
When it comes to matrix structure, the organization places the employees based on the function and the product.
The matrix structure gives the best of the both worlds of functional and divisional structures.
In this type of an organization, the company uses teams to complete tasks. The teams are formed based on the functions they belong to (ex: software engineers) and product they are involved in (ex: Project A).
This way, there are many teams in this organization such as software engineers of project A, software engineers of project B, QA engineers of project A, etc.
Every organization needs a structure in order to operate systematically. The organizational structures can be used by any organization if the structure fits into the nature and the maturity of the organization.
In most cases, organizations evolve through structures when they progress through and enhance their processes and manpower. One company may start as a pre-bureaucratic company and may evolve up to a matrix organization.
Before any activity begins related to the work of a project, every project requires an advanced, accurate time estimate. Without an accurate estimate, no project can be completed within the budget and the target completion date.
Developing an estimate is a complex task. If the project is large and has many stakeholders, things can be more complex.
Therefore, there have been many initiatives to come up with different techniques for estimation phase of the project in order to make the estimation more accurate.
PERT (Program Evaluation and Review Technique) is one of the successful and proven methods among the many other techniques, such as, CPM, Function Point Counting, Top-Down Estimating, WAVE, etc.
PERT was initially created by the US Navy in the late 1950s. The pilot project was for developing Ballistic Missiles and there have been thousands of contractors involved.
After PERT methodology was employed for this project, it actually ended two years ahead of its initial schedule.
At the core, PERT is all about management probabilities. Therefore, PERT involves in many simple statistical methods as well.
Sometimes, people categorize and put PERT and CPM together. Although CPM (Critical Path Method) shares some characteristics with PERT, PERT has a different focus.
Same as most of other estimation techniques, PERT also breaks down the tasks into detailed activities.
Then, a Gantt chart will be prepared illustrating the interdependencies among the activities. Then, a network of activities and their interdependencies are drawn in an illustrative manner.
In this map, a node represents each event. The activities are represented as arrows and they are drawn from one event to another, based on the sequence.
Next, the Earliest Time (TE) and the Latest Time (TL) are figured for each activity and identify the slack time for each activity.
When it comes to deriving the estimates, the PERT model takes a statistical route to do that. We will cover more on this in the next two sections.
Following is an example PERT chart:
There are three estimation times involved in PERT; Optimistic Time Estimate (TOPT), Most Likely Time Estimate (TLIKELY), and Pessimistic Time Estimate (TPESS).
In PERT, these three estimate times are derived for each activity. This way, a range of time is given for each activity with the most probable value, TLIKELY.
Following are further details on each estimate:
This is the fastest time an activity can be completed. For this, the assumption is made that all the necessary resources are available and all predecessor activities are completed as planned.
Most of the times, project managers are asked only to submit one estimate. In that case, this is the estimate that goes to the upper management.
This is the maximum time required to complete an activity. In this case, it is assumed that many things go wrong related to the activity. A lot of rework and resource unavailability are assumed when this estimation is derived.
BETA probability distribution is what works behind PERT. The expected completion time (E) is calculated as below:
E = (TOPT + 4 x TLIEKLY + TPESS) / 6
At the same time, the possible variance (V) of the estimate is calculated as below:
V = (TPESS - TOPT)^2 / 6^2
Now, following is the process we follow with the two values:
For every activity in the critical path, E and V are calculated.
For every activity in the critical path, E and V are calculated.
Then, the total of all Es are taken. This is the overall expected completion time for the project.
Then, the total of all Es are taken. This is the overall expected completion time for the project.
Now, the corresponding V is added to each activity of the critical path. This is the variance for the entire project. This is done only for the activities in the critical path as only the critical path activities can accelerate or delay the project duration.
Now, the corresponding V is added to each activity of the critical path. This is the variance for the entire project. This is done only for the activities in the critical path as only the critical path activities can accelerate or delay the project duration.
Then, standard deviation of the project is calculated. This equals to the square root of the variance (V).
Then, standard deviation of the project is calculated. This equals to the square root of the variance (V).
Now, the normal probability distribution is used for calculating the project completion time with the desired probability.
Now, the normal probability distribution is used for calculating the project completion time with the desired probability.
The best thing about PERT is its ability to integrate the uncertainty in project times estimations into its methodology.
It also makes use of many assumption that can accelerate or delay the project progress. Using PERT, project managers can have an idea of the possible time variation for the deliveries and offer delivery dates to the client in a safer manner.
Effective project management is essential in absolutely any organization, regardless of the nature of the business and the scale of the organization.
From choosing a project to right through to the end, it is important that the project is carefully and closely managed. This is essentially the role of the project manager and his/her team of employees.
Managing and tracking the progress of a project is no easy task. Every project manager must know (and communicate to his/her team) all the project goals, specifications and deadlines that need to be met in order to be cost-effective, save time, and also to ensure that quality is maintained so that the customer is completely satisfied.
The project plan and other documents are therefore very important right through out the project. Effective project management, however, cannot simply be achieved without employing certain techniques and methods. One such method is the PRINCE2.
PRINCE stands for Projects in Controlled Environments. Dealing with a bit of history, this method was first established by the Central Computer and Telecommunications Agency (It is now referred to as the Office of Government Commerce).
It has since become a very commonly used project management method in all parts of the world and has therefore proven to be highly effective in various respects.
The method also helps you to identify and thereafter assign roles to the different members of the team based on expertise. Over the years, there have been a number of positive case studies of projects that have used PRINCE2 project management methodology.
This method deals with the various aspects that need to be managed in any given project.
The diagram below illustrates the idea.
In the above diagram:
The seven principles shown in the above diagram must be applied if the project is to be called a PRINCE2 project. These principles will show you whether and how well the project is being carried out using this particular project management method.
The seven principles shown in the above diagram must be applied if the project is to be called a PRINCE2 project. These principles will show you whether and how well the project is being carried out using this particular project management method.
Similarly, the themes of PRINCE2 refer to the seven principles that need to be referred to at all times during the project, if the project is to indeed be effective. If adherence to these principles is not carefully tracked from the inception of the project through to the end, there is a high chance that the project will fail entirely.
Similarly, the themes of PRINCE2 refer to the seven principles that need to be referred to at all times during the project, if the project is to indeed be effective. If adherence to these principles is not carefully tracked from the inception of the project through to the end, there is a high chance that the project will fail entirely.
The processes refer to the steps that need to be followed. This is why this method is known as a 'process-based' method.
The processes refer to the steps that need to be followed. This is why this method is known as a 'process-based' method.
Finally, with regard to the project environment, it's important to know that this project management method is not rigid. Changes can be made based on how big the project is, and the requirements and objectives of each organization. PRINCE2 offer this flexibility for the project and this is one of the reasons why PRINCE2 is quite popular among the project managers.
Finally, with regard to the project environment, it's important to know that this project management method is not rigid. Changes can be made based on how big the project is, and the requirements and objectives of each organization. PRINCE2 offer this flexibility for the project and this is one of the reasons why PRINCE2 is quite popular among the project managers.
One benefit of using this method over others could be said to be the fact that it is product-based and it also divides the project into different stages making it easy to manage. This is sure to help the project team to remain focused and deliver a quality outcome at the end of the day.
The most important of all benefits is that it improves communication between all members of the team and also between the team and other external stakeholders, thereby giving the team more control of the project.
It also gives the stakeholder a chance to have a say when it comes to decision making as they are always kept informed by the issuance of reports at regular intervals.
PRINCE2 also ensures that improvements can be made in the organization. This is because you would be able to identify any flaws that you make in projects and correct, which of course would help you to a great extent in the long run.
The flexibility of PRINCE2 allows these changes to be made run-time. Although there can be some implications and issues to the project schedule when certain changes are done run-time, PRINCE2 offers some of the best practices to minimize the impact.
Your team will also learn to save a lot of time and be more economical when it comes to the use of assets and various other resources, thereby ensuring that you are also able to cut down on costs a great deal.
When it comes to disadvantages, PRNCE2 does not offer the level of flexibility offered by some of the modern project management methodologies. Since project management, especially in software industry, has grown to a different level, PRINCE2 may find difficulties in catering some of the modern project management needs.
It should be kept in mind that PRINCE2 is a very complex method and cannot be carried out without special training. Failure to understand precisely how it works could lead to a lot of problems and difficulties whilst carrying out the project.
PRINCE2 guidelines can be selectively applied to certain projects that do not last long. This makes the method even more flexible and thereby more appealing to dynamic organizations and projects.
Setting priorities is one of the main management functions of an organization. If the managers do not prioritize their tasks and organizational objectives, the organization will head towards the wrong direction and eventually collapse.
Therefore, management is required to prioritize their tasks and focus on the priority items that will have a high impact on the organization.
Pareto Chart tool is one of the most effective tools that the management can use when it comes to identifying the facts needed for setting priorities. Pareto charts clearly illustrate the information in an organized and relative manner.
This way, the management can find out the relative importance of problems or causes of the problems. When it comes to prioritizing the causes of the problem, a Pareto chart can be used together with a cause-and-effect diagram.
Once the Pareto chart is created, it shows you a vertical bar chart with the highest importance to the lowest. The importance of each parameter is measured by several factors such as frequency, time, cost, etc.
Pareto charts are created based on the Pareto principle. The principle suggests that when a number of factors affect a situation, fewer factors will be accountable for the most of the affect.
This is almost the same as 80/20 theory that you may have heard of. It says that 80% of the impact is made by 20% of causes.
When a team works together in a large and complex project, it can be quite tricky to understand the importance of certain issues. Pareto charts can show the team a few important things that really matter the most.
Most teams use Pareto charts over time in order to identify whether the suggested solution really answers the problem. If the solution is effective, the relative importance of the identified factor should take a lesser value over time.
First of all, list down everything you need to compare. This can be a list of issues, items, or a list of problem causes.
Decide on the standard measures to compare the list items. You need to consider organizational objectives and current trends in order to determine the measures. Some measures are:
Frequency - How often it occurs (Errors, complaints, complications, etc.)
Frequency - How often it occurs (Errors, complaints, complications, etc.)
Cost - How many resources are being utilized or affected
Cost - How many resources are being utilized or affected
Time - How long it takes
Time - How long it takes
Select a timeframe for the data collection process.
Now, we do some simple math with the data we collected. Take each list item (or cause) and record it against the measurement selected. Then, determine its percentage in the context and all item occurrences.
As an example, if the list of item contains causes behind late comers to office, the tallying table will look like below.
Now, rearrange the list and list the item in decreasing order. In our example, list it from the highest number of occurrences to the least number of occurrences. Then, record the cumulative percentage when you travel from the top item to the bottom item.
Refer the following example:
Create a bar chart. The list items should be displayed along the 'Y' axis from highest to the lowest. Left vertical axis should be the measure that you selected.
In our example, it should be the number of occurrences. Select the right vertical axis as the cumulative percentage. Each item should have a bar.
Now, draw a line graph for cumulative percentages. The first point of the line should be on the top of the first bar. You can use spreadsheet software such as Microsoft Excel for this step.
It offers many tools for creating and analyzing graphs. Now, you should have something like this.
Analyze your chart. You now need to identify the items that appear to have the most impact. Identify the breakpoint (a rapid change) in the graph (refer the red circle).
If there is no breakpoint, account the causes/items that have 50% or more impact. In our example, there is a visible breakpoint.
There are two causes before the breakpoint, Road traffic and Work till Late Night. Therefore, the two causes that have the most affect to our problem are Road Traffic and Work till Late Night.
Pareto charts can be really useful when used in the proper context. This helps the management to prioritize tasks, risks, activities and causes.
Therefore, Pareto charts should be used as much as possible when it comes to day-to-day prioritization.
Only the leaders with great leadership qualities have introduced good to the world. These leaders have developed powerful leadership skills over the time and eventually become visionaries. They inspire their subordinates and drive them towards achieving their dreams in life. Therefore, developing powerful leadership skills help you to become an effective leader and make a difference in other's lives.
Good leaders are good in getting the desired outcome at the end. They are good at inspiring people and getting their contribution with their full support.
The good leaders constantly raise the standards and expectations from the employees, so the employees continuously enhance themselves. Employees and others follow such great leaders willingly.
Let's have a brief look at the most powerful leadership skills that matter the most in corporate world.
This is the number one skill you should develop. When there is a huge team working under you, setting the examples is the best way to manage them.
If you do not adhere to your own rules, you may not be able to get those working for you to adhere to the rules. When it comes to leading by examples, it includes fairness, honesty, showing respect and professionalism.
The workplace should never be run by politics and the good old boys. This could be the main reason for demotivating the talented and enthusiastic employees.
In case, if you reward the people you prefer, this will demotivate the talent in the organization and they would leave at the end of the day. The remaining employees will be utterly frustrated and company culture and productivity will never be the same.
Rewarding is a great way to enhance the employee satisfaction. A good leader identifies the talent in the employee and rewards appropriately. A good leader will use facts for assessing the employees for their performance rather than using perceptions for the same.
Depending on the consequences of an event, there can be either negative or positive results. In a corporate environment, most of the time, people are reluctant to take the responsibility and be accountable when things go wrong.
If you are accountable for something, so be it. Show the employees that you are being responsible and send the message that you expect the same from them.
As a good leader, you should not tolerate poor performance and poor behaviour of your employees. Your tolerance may kill employee motivation. No employee will go an extra mile if they are to cover someone's work by doing that.
Setting expectations and defining reasonable performance standards for the employees is one of the key leadership skills. The performance assessment and evaluation criteria for the employees should be transparent and it should allow the employees to find their way to success.
Standards are not only applicable for employee performance. You can set standards for many other aspects of the corporate environment. As an example, it could be how to behave in the office or how to write a quality document. Setting and practicing such high standards will enhance the careers of the employees as well as the organization in the long run.
Good leaders are visionaries. They have a vision for what they do. A powerful leadership skill is to share your vision with the rest of the employees.
This way, you make them aware of what you fundamentally believe in and there will be a lot of people, who are willing to help you. Eventually, you will be able to enhance their lives and make them visionaries as well.
Keeping an open door policy is a real skill for a great leader. Although many companies claim that they practice the open door policy, no one would really bother to escalate information through the open door.
In order to have a real open door policy running, the leader should first practice the policy and show the rest of the staff that information flow has no barriers.
Powerful leadership skills are the best way for you to achieve your professional and personal objectives. The power of leadership skills are noted and required when you climb the corporate ladder.
Without proper leadership skills, you may not be able to manage a large team and drive them to achieve the objectives. Therefore, start strengthening your leadership skills from now onwards and go through necessary trainings if required.
Process-based management is a management technique that aligns the vision, mission and core value systems of a business when formulating corporate strategy.
It helps define the policies that govern the operations of the company, in question; whilst ensuring that the company is not just functioning on a platform of efficiency alone, but one of effectiveness, too.
As process-based management commences from the strategic sphere, the direction of the projects undertaken remain unfaltering, unlike in the event of goals formulated at a tactical level, where some projects tend to veer off course. Working towards a common goal helps achieve harmony across different work groups and departments.
However, it must be re-iterated that strategic support alone is inadequate to make the philosophy of process based management, a success; and that the middle management and employees too, need to recognize their part in the process and take ownership of it for optimal results.
Process needs to be clearly identified and documented if it to yield any clarity.
Departmental documentation, customer-based agreements, purchasing manuals and process flow charts would all help in documenting the aforementioned process.
The input that is required for the process to be operational, the expected output of the process and the people or departments responsible for each constituent part of the process should be identified so that ownership and accountability are not compromised.
Process performance needs to be measured, if the efficacy, quality and timelines are to be monitored and improved upon.
Ideally, the metrics selected should be quantifiable, so that clarity is retained throughout. However, this may not always be possible, but comparative data and relevant benchmarks can always be obtained for relevant analysis.
A variety of tools are available to analyze process performance with ease.
Graphical representations, bar charts, pie charts, variance analysis, gap analysis and cause-and-effect analysis being some of the most popular.
Under this phase of process-based management, compliance audits would help in analyzing process stability.
If it is found to be wanting, new goals need to be set and these should be aligned to the company's strategic direction.
Process improvements should be planned in concurrence with the vision of the organization, its mission statement and its culture.
Sufficient resources should be allocated and an effective team should be in place if the proposed changes are to be successful.
This is where each of the planned improvements come to life from its former paper-based draft. Training can be conducted if and when required and the support of staff should be garnered wherever possible.
Thereafter, regular monitoring and continuous improvements need to be facilitated if the organization is to be one of world class standing.
A process-based organization would have a few inherent characteristics that make it instantly recognizable.
For instance, such a company would view the business as a collection of processes, have strategic plans that drive the processes with commitment from the top management downwards, and such processes would be aligned to the goals and key business outcomes of the organization.
Standardization of processes, high dependence on data accuracy and the continuous quest for sustainable improvements are further hallmarks of a process-based organization.
The benefits of adopting process-based management are many.
Improvements in present processes increase in value-adding activities, reduction of costs and alignment to the strategic vision of the organization are its most sought after benefits.
It also facilitates modern cost allocation techniques such as activity based costing. Process-based management helps the system conform to certain national and international standards and to the requirements of reputed regulatory bodies.
Process-based management is an invaluable tool in customer satisfaction and retention, as it identifies key processes that have stakeholder interests and satisfaction at heart.
As many, a savvy manager at the higher echelons have come to realize the vision of a company is less likely to change over time, as opposed to goals and procedures used to achieve this vision.
Therefore process-based management necessitates managers to evaluate existing processes and take steps to adjust the structure and function of the organization in question, so that maximum efficiency can be thus derived.
Variable factors such as changes in customer expectations, fluctuations in the general economy and the necessity of developing better product lines will result in more innovative workforce who takes ownership of tasks and initiates better performance in their related field of expertise.
In order to understand procurement documents, it is important to understand the term Procurement Management.
Procurement is the purchase of goods and services at the best possible price to meet a purchaser's demand in terms of quantity, quality, dimensions and site.
The procurement cycle in businesses work, which follows the below steps:
Information Gathering - A potential customer first researches suppliers, who satisfy requirements for the product needed.
Information Gathering - A potential customer first researches suppliers, who satisfy requirements for the product needed.
Supplier Contact - When a prospective supplier has been identified, the customer requests for quotations, proposals, information and tender. This may be done through advertisements or through direct contact with the supplier.
Supplier Contact - When a prospective supplier has been identified, the customer requests for quotations, proposals, information and tender. This may be done through advertisements or through direct contact with the supplier.
Background Review - The customer now examines references for the goods/services concerned and may also consider samples of the goods/services or undertake trials.
Background Review - The customer now examines references for the goods/services concerned and may also consider samples of the goods/services or undertake trials.
Negotiation - Next the negotiations regarding price, availability and customization options are undertaken. The contract regarding the purchase of the goods or services is completed.
Negotiation - Next the negotiations regarding price, availability and customization options are undertaken. The contract regarding the purchase of the goods or services is completed.
Fulfilment - Based on the contract signed, the purchased goods or services are shipped and delivered. Payment is also completed at this stage. Additional training or installation of the product may also be provided.
Fulfilment - Based on the contract signed, the purchased goods or services are shipped and delivered. Payment is also completed at this stage. Additional training or installation of the product may also be provided.
Renewal - Once the goods or services are consumed or disposed of and the contract has expired, the product or service needs to be re-ordered. The customer now decides whether to continue with the same supplier or look for a new one.
Renewal - Once the goods or services are consumed or disposed of and the contract has expired, the product or service needs to be re-ordered. The customer now decides whether to continue with the same supplier or look for a new one.
Documents involved in the procurement cycle are called procurement documents. Procurement documents are an integral part of the early stages of project initiation.
The purpose of procurement documents serves an important aspect of the organizational element in the project process. It refers to the input and output mechanisms and tools that are put in place during the process of bidding and submitting project proposals and the facets of work that make up a project.
In a nutshell, procurement documents are the contractual relationship between the customer and the supplier of goods or services.
Some examples of what constitutes procurement documents include the buyer's commencement to bid and the summons by the financially responsible party for concessions.
In addition, requests for information between two parties and requests for quotations, and proposals and seller's response are also parts of procurement documents.
Basically procurement documents comprise of all documents that serve as invitations to tender, solicit tender offers and establish the terms and conditions of a contract.
A few types of procurement documents are:
RFP - A request for proposal is an early stage in a procurement process issuing an invitation for suppliers, often through a bidding process, to submit a proposal on a specific commodity or service.
RFP - A request for proposal is an early stage in a procurement process issuing an invitation for suppliers, often through a bidding process, to submit a proposal on a specific commodity or service.
RFI - A request for information (RFI) is a proposal requested from a potential seller or a service provider to determine what products and services are potentially available in the marketplace to meet a buyer's needs and to know the capability of a seller in terms of offerings and strengths of the seller.
RFI - A request for information (RFI) is a proposal requested from a potential seller or a service provider to determine what products and services are potentially available in the marketplace to meet a buyer's needs and to know the capability of a seller in terms of offerings and strengths of the seller.
RFQ - A request for quotation (RFQ) is used when discussions with bidders are not required (mainly when the specifications of a product or service are already known) and when price is the main or only factor in selecting the successful bidder.
RFQ - A request for quotation (RFQ) is used when discussions with bidders are not required (mainly when the specifications of a product or service are already known) and when price is the main or only factor in selecting the successful bidder.
Solicitations: These are invitations of bids, requests for quotations and proposals. These may serve as a binding contract.
Solicitations: These are invitations of bids, requests for quotations and proposals. These may serve as a binding contract.
Offers - This type of procurement documents are bids, proposals and quotes made by potential suppliers to prospective clients.
Offers - This type of procurement documents are bids, proposals and quotes made by potential suppliers to prospective clients.
Contracts - Contracts refer to the final signed agreements between clients and suppliers.
Contracts - Contracts refer to the final signed agreements between clients and suppliers.
Amendments/Modifications - This refers to any changes in solicitations, offers and contracts. Amendments/Modifications have to be in the form of a written document.
Amendments/Modifications - This refers to any changes in solicitations, offers and contracts. Amendments/Modifications have to be in the form of a written document.
Most procurement documents adopt a set structure. This is because it simplifies the documentation process and also allows it to be computerized.
Computerization allows for efficiency and effectiveness in the procurement process. In general, procurement documents have the following attributes:
Requires potential bidders to submit all particulars for the employer to evaluate the bidder.
Requires potential bidders to submit all particulars for the employer to evaluate the bidder.
All submissions to be set out in a clear and honest manner to ensure that the short-list criterion is unambiguous.
All submissions to be set out in a clear and honest manner to ensure that the short-list criterion is unambiguous.
Clear definition of the responsibilities, rights and commitments of both parties in the contract.
Clear definition of the responsibilities, rights and commitments of both parties in the contract.
Clear definition of the nature and quality of the goods or services to be provided.
Clear definition of the nature and quality of the goods or services to be provided.
Provisions without any prejudice to the interests of either party.
Provisions without any prejudice to the interests of either party.
Clear and easy to understand language.
Clear and easy to understand language.
Engineering and Construction Work
Minor/Low Risk Contracts: In this type of contract, services are required by an organization for a short period and the work is usually repetitive. Hence, this type of contract does not require high-end management techniques.
Major/High Risk Contracts: Here, the type of work required is of a more difficult nature and here the implication of sophisticated management techniques is required.
Minor/Low Risk Contracts: In this type of contract, services are required by an organization for a short period and the work is usually repetitive. Hence, this type of contract does not require high-end management techniques.
Minor/Low Risk Contracts: In this type of contract, services are required by an organization for a short period and the work is usually repetitive. Hence, this type of contract does not require high-end management techniques.
Major/High Risk Contracts: Here, the type of work required is of a more difficult nature and here the implication of sophisticated management techniques is required.
Major/High Risk Contracts: Here, the type of work required is of a more difficult nature and here the implication of sophisticated management techniques is required.
Services
Professional - This requires more knowledge-based expertise and this requires managers, who are willing to put more time and effort into seeking research in order to satisfy the customer's criteria.
Facilities - More often than not, in this type of service the work outsourced is the maintenance or operation of an existing structure or system.
Professional - This requires more knowledge-based expertise and this requires managers, who are willing to put more time and effort into seeking research in order to satisfy the customer's criteria.
Professional - This requires more knowledge-based expertise and this requires managers, who are willing to put more time and effort into seeking research in order to satisfy the customer's criteria.
Facilities - More often than not, in this type of service the work outsourced is the maintenance or operation of an existing structure or system.
Facilities - More often than not, in this type of service the work outsourced is the maintenance or operation of an existing structure or system.
Supplies
Local/Simple Purchases - Goods are more readily available and hence does not require management of the buying and delivery process.
International/Complex Purchases: In this case, goods need to be bought from other countries. A manager's task is more cumbersome and a management process is required to purchase and delivery. In addition, the manager needs to look into cross-border formalities.
Local/Simple Purchases - Goods are more readily available and hence does not require management of the buying and delivery process.
Local/Simple Purchases - Goods are more readily available and hence does not require management of the buying and delivery process.
International/Complex Purchases: In this case, goods need to be bought from other countries. A manager's task is more cumbersome and a management process is required to purchase and delivery. In addition, the manager needs to look into cross-border formalities.
International/Complex Purchases: In this case, goods need to be bought from other countries. A manager's task is more cumbersome and a management process is required to purchase and delivery. In addition, the manager needs to look into cross-border formalities.
In most organizations, the procurement department is one of the busiest. Managers need to purchase goods or services required for the smooth running of their organization.
For example, in a hospital, a procurement manager needs to purchase medicines and surgical instruments among others. These goods and services need to be purchased at the lowest possible cost without any deficit in quality.
The documentation that passes between the procurement manager of an organization and a supplier are the procurement documents.
Today, different organizations employ various management techniques to carry out the efficient functioning of their departments. Procurement management is one such form of management, where goods and services are acquired from a different organization or firm.
All organizations deal with this form of management at some point in the life of their businesses. It is in the way the procurement is carried out and the planning of the process that will ensure the things run smoothly.
But with many other management techniques in use, is there any special reason to use this particular form of management to acquire goods and services? Yes, this is one of the frequent questions asked regarding procurement management.
Procurement management is known to help an organization to save much of the money spent when purchasing goods and services from outside. It also has several other advantages.
Following are the four main working areas of concerns when it comes to procurement management. The following points should be considered whenever procurement process is involved:
Not all goods and services that a business requires need to be purchased from outside. It is for this reason that it is very essential to weigh the pros and cons of purchasing or renting these goods and services from outside.
You would need to ask yourself whether it would in the long run be cost-effective and whether it is absolutely necessary.
Not all goods and services that a business requires need to be purchased from outside. It is for this reason that it is very essential to weigh the pros and cons of purchasing or renting these goods and services from outside.
You would need to ask yourself whether it would in the long run be cost-effective and whether it is absolutely necessary.
You would need to have a good idea of what you exactly require and then go on to consider various options and alternatives. Although there may be several suppliers, who provide the same goods and services, careful research would show you whom of these suppliers will give you the best deal for your organization.
You can definitely call for some kind of bidding for your requirement by these vendors and use a selection criterion to select the best provider.
You would need to have a good idea of what you exactly require and then go on to consider various options and alternatives. Although there may be several suppliers, who provide the same goods and services, careful research would show you whom of these suppliers will give you the best deal for your organization.
You can definitely call for some kind of bidding for your requirement by these vendors and use a selection criterion to select the best provider.
The next step typically would be to call for bids. During this stage, the different suppliers will provide you with quotes.
This stage is similar to that of choosing projects, as you would need to consider different criteria, apart from just the cost, to finally decide on which supplier you would want to go with.
The next step typically would be to call for bids. During this stage, the different suppliers will provide you with quotes.
This stage is similar to that of choosing projects, as you would need to consider different criteria, apart from just the cost, to finally decide on which supplier you would want to go with.
After the evaluation process, you would be able to select the best supplier. You would then need to move on to the step of discussing what should go into the contract. Remember to mention all financing terms how you wish to make the payments, and so on, so as to prevent any confusion arising later on, as this contract will be binding.
Always remember that it is of utmost importance to maintain a good relationship with the supplier. This includes coming up with an agreement that both would find satisfactory. This helps the sustainability of your business as well as the supplier's business.
After the evaluation process, you would be able to select the best supplier. You would then need to move on to the step of discussing what should go into the contract. Remember to mention all financing terms how you wish to make the payments, and so on, so as to prevent any confusion arising later on, as this contract will be binding.
Always remember that it is of utmost importance to maintain a good relationship with the supplier. This includes coming up with an agreement that both would find satisfactory. This helps the sustainability of your business as well as the supplier's business.
These four simple steps would help you acquire your goods easily and quickly without much hassle, but always requires careful consideration at each stage.
In order to ensure that everything goes well through to the end, you would have to keep track of the progress of the procurement. This would mean that you should keep checking on the suppliers in order to ensure that they are abiding by the terms of the contract and will be able to supply you with the goods and services by the deadline.
Should there be any discrepancies or any issues, you should always let the supplier know by means of the method of communication decided on at the time of making the contract.
The organization must always be willing and open to change. This is in respect of all changes required in order to ensure the efficiency of the process. These changes could be in the form of technological advancements and even changes to the workforce, among other changes.
In terms of technology, any new equipment and machinery required to handle these goods may need to be purchased.
Similarly, with regard to the workforce, you would need to employ workers, who are highly skilled and trained when it comes to dealing directly with suppliers.
It is always best for an organization to have different teams within who are specialized in different fields. This would make procurement management even easier. Each team could then deal with the relevant areas of buying and will also have the expertise required. For example, those who have experience buying machinery may not have the same skill when it comes to getting particular services from another organization.
It should be kept in mind, however, that this procurement management system must run efficiently and smoothly for all benefits to be reaped. The key to this would therefore be an efficient system as well as the right supplier and resources.
For the purpose of procurement management, there should be a team of highly trained individuals, if procurement management plays a key role.
As an example, a hospital should have a dedicated procurement team and should employ strong procurement management techniques and tools.
When it comes to a project, the entire project is divided into many interdependent tasks. In this set of tasks, the sequence or the order of the tasks is quite important.
If the sequence is wrong, the end result of the project might not be what the management expected.
Some tasks in the projects can safely be performed parallel to other tasks. In a project activity diagram, the sequence of the tasks is simply illustrated.
There are many tools that can be used for drawing project activity diagrams. Microsoft Project is one of the most popular software for this type of work.
In addition to that, Microsoft Vision (for Windows) and Omni Graffle (for Mac) can be used to draw activity diagrams.
Have you seen process flow diagrams? If yes, then activity diagrams takes the same shape. Usually there are two main shapes in activity diagrams, boxes and arrows.
Boxes of the activity diagram indicate the tasks and the arrows show the relationships. Usually, the relationships are the sequences that take place in the activities.
Following is an example of activity diagram with tasks in boxes and relationship represented by arrows.
This type of activity diagram is also known as activity-on-node diagram. This is due to the fact that all activities (tasks) are shown on the nodes (boxes).
Alternatively, there is another way of presenting an activity diagram. This is called activity-on-arrow diagram. In this diagram, activities (tasks) are presented by the arrows.
Compared to activity-on-node diagrams, activity-on-arrow diagrams introduce a little confusion. Therefore, in most instances, people often use activity-on-nodes diagrams. Following is an activity-on-arrow diagram:
Creating an activity diagram is easy. You can use a paper-based material such as a post it note or software for this purpose. Regardless of the medium used, the process of creating the activity diagram remains the same.
Following are main steps involved in creating an activity diagram:
First of all, identify the tasks in the project. You can use WBS (Work Breakdown Structure) for this purpose and there is no need to repeat the same.
Just use the same tasks breakdown for the activity diagram as well. If you use software for creating the activity diagram (which is recommended), create a box for each activity.
Illustrate all boxes in the same size in order to avoid any confusion. Make sure all your tasks have the same granularity.
You can add more information to the task boxes, such as who is doing the task and the timeframes. You can add this information inside the box or can add it somewhere near the box.
Now, arrange the boxes in the sequence that they are performed during the project execution. The early tasks will be at the left hand side and the tasks performed at the later part of the project execution will be at the right hand side. The tasks that can be performed in parallel should be kept parallel to each other (vertically).
You may have to adjust the sequence a number of times until you get it right. This is why software is an easy tool for creating activity diagrams.
Now, use arrows to join task boxes. These arrows will show the sequence of the tasks. Sometimes, a 'start' and an 'end' box can be added to clearly present the start and the end of the project.
To understand what we have done in the above four steps, please refer to the following activity diagram:
Activity diagrams can be used for illustrating the sequence of project tasks. These diagrams can be created with a minimum effort and gives you a clear understanding of interdependent tasks.
In addition, the activity diagram is an input for the critical path method.
Project Charter refers to a statement of objectives in a project. This statement also sets out detailed project goals, roles and responsibilities, identifies the main stakeholders, and the level of authority of a project manager.
It acts as a guideline for future projects as well as an important material in the organization's knowledge management system.
The project charter is a short document that would consist of new offering request or a request for proposal. This document is a part of the project management process, which is required by Initiative for Policy Dialogue (IPD) and Customer Relationship Management (CRM).
Following are the roles of a Project Charter:
It documents the reasons for undertaking the project.
It documents the reasons for undertaking the project.
Outlines the objectives and the constraints faced by the project.
Outlines the objectives and the constraints faced by the project.
Provides solutions to the problem in hand.
Provides solutions to the problem in hand.
Identifies the main stakeholders of the project.
Identifies the main stakeholders of the project.
Following are the prominent benefits of Project Charter for a project:
It improves and paves way for good customer relationships.
It improves and paves way for good customer relationships.
Project Charter also works as a tool that improves project management processes.
Project Charter also works as a tool that improves project management processes.
Regional and headquarter communications can also be improved to a greater extent.
Regional and headquarter communications can also be improved to a greater extent.
By having a project charter, project sponsorship can also be gained.
By having a project charter, project sponsorship can also be gained.
Project Charter recognizes senior management roles.
Project Charter recognizes senior management roles.
Allows progression, which is aimed at attaining industry best practices.
Allows progression, which is aimed at attaining industry best practices.
Since project charter is a project planning tool, which is aimed at resolving an issue or an opportunity, the below elements are essential for a good charter project.
For an effective charter project, it needs to address these key elements:
Identity of the project.
Identity of the project.
Time: the start date and the deadline for the project.
Time: the start date and the deadline for the project.
People involved in the project.
People involved in the project.
Outlined objectives and set targets.
Outlined objectives and set targets.
The reason for a project charter to be carried out, often referred to as 'business case'.
The reason for a project charter to be carried out, often referred to as 'business case'.
Detailed description of a problem or an opportunity.
Detailed description of a problem or an opportunity.
The return expected from the project.
The return expected from the project.
Results that could be expected in terms of performance.
Results that could be expected in terms of performance.
The expected date that the objectives is to be achieved.
The expected date that the objectives is to be achieved.
Clearly defined roles and responsibilities of the participants involved.
Clearly defined roles and responsibilities of the participants involved.
Requirement of resources that will be needed for the objectives to be achieved.
Requirement of resources that will be needed for the objectives to be achieved.
Barriers and the risks involved with the project.
Barriers and the risks involved with the project.
Informed and effective communication plan.
Informed and effective communication plan.
Out of all above elements, there are three most important and essential elements that need further elaboration.
This outlines the need for a project charter to take place. A business case should set out the benefits gained from carrying out a project charter. Benefits need not only be in terms of finance such as revenue, cost reduction, etc., but also the benefit that the customer receives.
Following are the characteristics of a good business case:
The reasons of undertaking the project.
The reasons of undertaking the project.
The benefits gained from undertaking the project now.
The benefits gained from undertaking the project now.
The consequences of not doing the project.
The consequences of not doing the project.
The factors that would conclude that it fits the business goals.
The factors that would conclude that it fits the business goals.
As the name denotes, it refers to the scope that the project will give the business if they undertake the project.
Before doing a project, the following concerns need to be addressed:
The within scope and out of scope needs to be considered.
The within scope and out of scope needs to be considered.
The process that each team will focus upon.
The process that each team will focus upon.
The start and end points for a process.
The start and end points for a process.
Availability of resources.
Availability of resources.
Constraints under which the team will work.
Constraints under which the team will work.
Time limitations .
Time limitations .
The impact on the normal workload if the project is to be undertaken.
The impact on the normal workload if the project is to be undertaken.
The need for a good communication plan is at its utmost necessity when it comes to planning a project. Project managers need to work on building a good communication plan which will help in meeting the overall objectives of a Project Charter.
When creating a communication plan, the project manager needs to take the following into consideration:
Who - responsibility of each individuals participating in the project.
Who - responsibility of each individuals participating in the project.
What - the motive and the reason for communication plan.
What - the motive and the reason for communication plan.
Where - location where the receiver could find information.
Where - location where the receiver could find information.
When - the duration and the frequency of the communication plan.
When - the duration and the frequency of the communication plan.
How - the mechanism which is used to facilitate the communication.
How - the mechanism which is used to facilitate the communication.
Whom - The receivers of the communication.
Whom - The receivers of the communication.
The project charter is not only a tool that is used for planning projects but also a communication mechanism that acts as a reference. A well-planned project with an effective communication plan will definitely bring in success for the project undertaken at hand.
Therefore, the Project Charter should be one of the frequently referred documents in a project and the entire project team needs to be aware of the content of the Project Charter. This is a key element for a successful project.
In the world of business, contracts are used for establishing business deals and partnerships. The parties involved in the business engagement decide the type of the contract.
Usually, the type of the contract used for the business engagement varies depending on the type of the work and the nature of the industry.
The contract is simply an elaborated agreement between two or more parties. One or more parties may provide products or services in return to something provided by other parties (client).
The contract type is the key relationship between the parties engaged in the business and the contract type determines the project risk.
Let' have a look at most widely used contract types.
This is the simplest type of all contracts. The terms are quite straightforward and easy to understand.
To put in simple, the service provider agrees to provide a defined service for a specific period of time and the client agrees to pay a fixed amount of money for the service.
This contract type may define various milestones for the deliveries as well as KPIs (Key Performance Indicators). In addition, the contractor may have an acceptance criteria defined for the milestones and the final delivery.
The main advantages of this type of contract is that the contractor knows the total project cost before the project commences.
In this model, the project is divided into units and the charge for each unit is defined. This contract type can be introduced as one of the more flexible methods compared to fixed price contract.
Usually, the owner (contractor/client) of the project decides on the estimates and asks the bidders to bid of each element of the project.
After bidding, depending on the bid amounts and the qualifications of bidders, the entire project may be given to the same service provider or different units may be allocated to different service providers.
This is a good approach when different project units require different expertise to complete.
In this contract model, the services provider is reimbursed for their machinery, labour and other costs, in addition to contractor paying an agreed fee to the service provider.
In this method, the service provider should offer a detailed schedule and the resource allocation for the project. Apart from that, all the costs should be properly listed and should be reported to the contractor periodically.
The payments may be paid by the contractor at a certain frequency (such as monthly, quarterly) or by the end of milestones.
Incentive contracts are usually used when there is some level of uncertainty in the project cost. Although there are nearly-accurate estimations, the technological challenges may impact on the overall resources as well as the effort.
This type of contract is common for the projects involving pilot programs or the project that harness new technologies.
There are three cost factors in an Incentive contract; target price, target profit and the maximum cost.
The main mechanism of Incentive contract is to divide any target price overrun between the client and the service provider in order to minimize the business risks for both parties.
This is one of the most beautiful engagements that can get into by two or more parties. This engagement type is the most risk-free type where the time and material used for the project are priced.
The contractor only requires knowing the time and material for the project in order to make the payments. This type of contract has short delivery cycles, and for each cycle, separate estimates are sent of the contractor.
Once the contractor signs off the estimate and Statement of Work (SOW), the service provider can start work.
Unlike most of the other contract types, retainer contracts are mostly used for long-term business engagements.
This type of contracts is used for engineering projects. Based on the resources and material required, the cost for the construction is estimated.
Then, the client contracts a service provider and pays a percentage of the cost of the project as the fee for the service provider.
As an example, take the scenario of constructing a house. Assume that the estimate comes up to $230,000.
When this project is contracted to a service provider, the client may agree to pay 30% of the total cost as the construction fee which comes up to $69,000.
Selecting the contract type is the most crucial step of establishing a business agreement with another party. This step determines the possible engagement risks.
Therefore, companies should get into contracts where there is a minimum risk for their business. It is always a good idea to engage in fixed bids (fixed priced) whenever the project is short-termed and predictable.
If the project nature is exploratory, it is always best to adopt retainer or cost plus contract types.
Almost all the projects need to be guided right throughout in order to receive the required and expected output at the end of the project. It is the team that is responsible for the project and most importantly the project manager that needs to be able to carry out effective controlling of the costs. There are, however, several techniques that can be used for this purpose.
In addition to the project goals that the project manager has to oversee, the control of various costs is also a very important task for any project. Project management would not be effective at all if a project manager fails in this respect, as it would essentially determine whether or not your organization would make a profit or loss.
Following are some of the valuable and essential techniques used for efficient project cost control:
You would need to ideally make a budget at the beginning of the planning session with regard to the project at hand. It is this budget that you would have to help you for all payments that need to be made and costs that you will incur during the project life cycle. The making of this budget therefore entails a lot of research and critical thinking.
Like any other budget, you would always have to leave room for adjustments as the costs may not remain the same right through the period of the project. Adhering to the project budget at all times is key to the profit from project.
Keeping track of all actual costs is also equally important as any other technique. Here, it is best to prepare a budget that is time-based. This will help you keep track of the budget of a project in each of its phases. The actual costs will have to be tracked against the periodic targets that have been set out in the budget. These targets could be on a monthly or weekly basis or even yearly if the project will go on for long.
This is much easier to work with rather than having one complete budget for the entire period of the project. If any new work is required to be carried out, you would need to make estimations for this and see if it can be accommodated with the final amount in the budget. If not, you may have to work on necessary arrangements for 'Change Requests', where the client will pay for the new work or the changes.
Another effective technique would be effective time management. Although this technique does apply to various management areas, it is very important with regard to project cost control.
The reason for this is that the cost of your project could keep rising if you are unable to meet the project deadlines; the longer the project is dragged on for, the higher the costs incurred which effectively means that the budget will be exceeded.
The project manager would need to constantly remind his/her team of the important deadlines of the project in order to ensure that work is completed on time.
Project change control is yet another vital technique. Change control systems are essential to take into account any potential changes that could occur during the course of the project.
This is due to the fact that each change to the scope of the project will have an impact on the deadlines of the deliverables, so the changes may increase project cost by increasing the effort needed for the project.
Similarly, in order to identify the value of the work that has been carried out thus far, it is very helpful to use the accounting technique commonly known as 'Earned Value'.
This is particularly helpful for large projects and will help you make any quick changes that are absolutely essential for the success of the project.
It is advisable to constantly review the budget as well as the trends and other financial information. Providing reports on project financials at regular intervals will also help keep track of the progress of the project.
This will ensure that overspending does not take place, as you would not want to find out when it is too late. The earlier the problem is found, the more easily and quickly it could be remedied.
All documents should also be provided at regular intervals to auditors, who would also be able to point out to you any potential cost risks.
Simply coming up with a project budget is not adequate during your project planning sessions. You and your team would have to keep a watchful eye on whether the costs remain close to the figures in the initial budget.
You need to always keep in mind the risks that come with cost escalation and need to prevent this as best as you can. For this, use the above techniques explained and constantly monitor the project costs.
A project kick-off meeting is the best opportunity for a project manager to energize his or her team. During this meeting, the project management can establish a sense of common goal and start understanding each individual.
Although a project kick-off meeting appears to be a simple meeting with all the stakeholders of the project, a successful project kick-off meeting requires proper planning.
The following steps are some of the important preparation points for a successful project kick-off meeting. These steps help you to stay focused, establish and demonstrate leadership, and help integrating individual members into the project team.
A strong and clear agenda is a must for a project kick-off meeting. If you have no clue of what the agenda should be, ask your experienced subordinates or get hold of some of the agendas used for earlier kick-off meetings by others.
The agenda usually includes purpose of the project, deliverables and goals, key success factors of the project, communication plan, and the project plan.
In advance to the project kick-off meeting, make sure that you circulate the meeting agenda to all the participants.
This way, all the participants are aware of the structure and what to achieve at the end of the meeting.
When the meeting starts, the project manager should take charge of the meeting. Next, all the participants should be welcomed and a round of self-introduction should take place.
Although you have already shared the meeting agenda with the participants, briefly take them through the agenda while giving a brief introduction to each item in the agenda.
Pay more attention towards introducing the project roles and emphasize the reasons why the term members were assigned to respective roles.
If there are people playing stretched roles, acknowledge about it. When you do all these things, do not go into detail. The purpose of this meeting is to take everyone on to the same platform.
Once the tone is set, present the agenda in a structured manner. First of all, talk about the project assumptions and how you developed the project plan.
Present your reasoning behind the plan and convey the message that you are open to suggestions when the project progresses. Go through each task in the project plan and elaborate sufficiently.
Emphasize the fact that the project plan and the schedule are still at the initial stage and that you are expecting everyone's assistance for making it complete.
Identify and acknowledge the potential bottlenecks or challenging tasks in the project schedule.
Decide on a convenient time to hold regular meetings to talk about project progress. Emphasize the need of everyone's participation for the regular meetings.
Teamwork is one of the most important expectations to be set. You need to elaborate more on teamwork and plan some teamwork activities just after the project kick-off.
Talk about the time sensitive nature of the project and how the leaves are granted during the project period.
If the project requires working long hours, letting them know in advance and showing them how you can help them to maintain the work-life balance is a good strategy.
During the meeting, empower the team members to carry out certain tasks and make them responsible.
Communication is one of the main aspects of a project. Therefore, the project kick-off meeting should emphasize more on the communication plan for the project.
This usually includes the meetings and escalation paths. Following are some of the meetings that take place during the project life cycle:
Weekly status meeting
Weekly status meeting
Project plan updates
Project plan updates
Task and activity planning sessions
Task and activity planning sessions
Management updates
Management updates
In addition, you can emphasize on the other communications channels such as e-mail communications, forums, etc.
At the end of the kick-off meeting, open up a Q&A session that allows the team members to freely express themselves.
If the time is not enough to facilitate all the team members, ask them to send their queries and feedback via e-mail. Once you have a look at those e-mails, you can set up another discussion to address those.
Never drag a planned meeting too much, since it could be a bad example. Before everyone leaves, summarize the meeting and call out the action items and next steps.
To conclude, there are four main areas that should be emphasized about holding project kick-off meetings.
Be prepared for the kick-off meeting. Demonstrate your ability to organize and lead.
Be prepared for the kick-off meeting. Demonstrate your ability to organize and lead.
Empower your team members. Assign them responsibilities.
Empower your team members. Assign them responsibilities.
Develop and nurture teamwork.
Develop and nurture teamwork.
Demonstrate your leadership qualities.
Demonstrate your leadership qualities.
Projects vary in terms of purpose, cost, magnitude and the timelines involved.
Yet, they all have common features and the lessons learned from one project can easily be incorporated in another, circumstances permitting.
Some of the experience thus gleaned is revealed below. This is by no means an extensive list of all the project lessons learned, but a few of the most relevant, are stated herewith:
The success of a project is largely dependent on the skills and strengths of the people involved. Therefore, a project needs to have a dedicated, talented set of individuals working towards a common goal.
The success of a project is largely dependent on the skills and strengths of the people involved. Therefore, a project needs to have a dedicated, talented set of individuals working towards a common goal.
Together with leadership skills, the project manager needs to be aware of the strengths and weaknesses of his/her staff, so that the talents are harnessed and the shortfalls downplayed for the benefit of the project.
Together with leadership skills, the project manager needs to be aware of the strengths and weaknesses of his/her staff, so that the talents are harnessed and the shortfalls downplayed for the benefit of the project.
A champion team and a team of champions are indeed different. The former would lead to a successful project whilst the latter would yield to a conflict of egos, each chasing an individual goal.
A champion team and a team of champions are indeed different. The former would lead to a successful project whilst the latter would yield to a conflict of egos, each chasing an individual goal.
It pays to know who the decision makers are. Such individuals may not always be readily visible, but they will be calling the shots, so developing a strong line of communication with such individuals will reap benefits in the long run.
It pays to know who the decision makers are. Such individuals may not always be readily visible, but they will be calling the shots, so developing a strong line of communication with such individuals will reap benefits in the long run.
If you have the knowledge and experience to make a decision, then you should go ahead and so, without expecting top managers to spoon feed you at every turn.
If you have the knowledge and experience to make a decision, then you should go ahead and so, without expecting top managers to spoon feed you at every turn.
Procrastination does not work. After assimilating the relevant information, decisions need to be made. Wrong decisions can be salvaged, if discovered early; but right decisions cannot be postponed. So, Carpe Diem, (seize the day), as advocated by the popular maxim.
Procrastination does not work. After assimilating the relevant information, decisions need to be made. Wrong decisions can be salvaged, if discovered early; but right decisions cannot be postponed. So, Carpe Diem, (seize the day), as advocated by the popular maxim.
When things go wrong, as they invariably will; excuses will not work. Find an alternative course of action or remedial propositions instead. Allocating blame only causes dissention and hostility, searching for solutions will bring the team together.
When things go wrong, as they invariably will; excuses will not work. Find an alternative course of action or remedial propositions instead. Allocating blame only causes dissention and hostility, searching for solutions will bring the team together.
Be pro-active in your approach. Reactivity is just not good enough.
Be pro-active in your approach. Reactivity is just not good enough.
Be open to change. Sometimes, you may find that the things you knew along may not be correct at this given time, under these specific conditions.
Be open to change. Sometimes, you may find that the things you knew along may not be correct at this given time, under these specific conditions.
Know what resources are available. Not just those under your purview but those which are at the discretion of other teams. Sometimes, others may be happy to help. After all, the favor bank concept which is colloquially referred to as the 'you scratch my back and I will scratch yours' philosophy, is apparent in the business world too.
Know what resources are available. Not just those under your purview but those which are at the discretion of other teams. Sometimes, others may be happy to help. After all, the favor bank concept which is colloquially referred to as the 'you scratch my back and I will scratch yours' philosophy, is apparent in the business world too.
Paperwork and documentation are necessary for reporting purposes. But when making decisions, placing too much reliance on data which may have changed within a surprisingly short timeframe pays few dividends, especially in an unpredictable environment.
Paperwork and documentation are necessary for reporting purposes. But when making decisions, placing too much reliance on data which may have changed within a surprisingly short timeframe pays few dividends, especially in an unpredictable environment.
Know your customer and know the objectives of the project at hand. If any significant changes need to be made, do so, but remember you need to consult the customer first.
Know your customer and know the objectives of the project at hand. If any significant changes need to be made, do so, but remember you need to consult the customer first.
Respect your leader and his/her decisions. Sometimes, you may not agree with these. That is fine. Voice your objections, especially if they are reasonable. But once an action has been decided upon, even if it is contrary to your idea of what should have been done, support it, and try to make it a success.
Respect your leader and his/her decisions. Sometimes, you may not agree with these. That is fine. Voice your objections, especially if they are reasonable. But once an action has been decided upon, even if it is contrary to your idea of what should have been done, support it, and try to make it a success.
Take account of all the known facts. Try to make sense of it, but don't blindly force-fit scenarios into a pre-established mould. Such scenarios may have been right before, and will, in all likelihood, be right once again, but maybe just not in this case.
Take account of all the known facts. Try to make sense of it, but don't blindly force-fit scenarios into a pre-established mould. Such scenarios may have been right before, and will, in all likelihood, be right once again, but maybe just not in this case.
Do not be afraid of taking calculated risks. After all, as the adage goes, a ship is safe in the harbor, but that is not what ships were built for.
Do not be afraid of taking calculated risks. After all, as the adage goes, a ship is safe in the harbor, but that is not what ships were built for.
When things go wrong, know who you can turn to for help.
When things go wrong, know who you can turn to for help.
Always disclose information to those, who will need it. This is not the time or place for obtaining an edge over another by keeping crucial data close to your chest. People, who know what is expected of them and have the means of doing so, will play a pivotal role in making the project a success.
Always disclose information to those, who will need it. This is not the time or place for obtaining an edge over another by keeping crucial data close to your chest. People, who know what is expected of them and have the means of doing so, will play a pivotal role in making the project a success.
Use modern technology and time tested management skills to your advantage.
Use modern technology and time tested management skills to your advantage.
Good communication is that which will stop mistakes from becoming failures. Mistakes happen and recovery is always possible. But failure is a dead-end street.
Good communication is that which will stop mistakes from becoming failures. Mistakes happen and recovery is always possible. But failure is a dead-end street.
Do not blindly rush into decisions. Careful thought needs to be given to the circumstances at hand prior to engaging in decision making. This will save time in the long run by minimizing the need to redo work.
Do not blindly rush into decisions. Careful thought needs to be given to the circumstances at hand prior to engaging in decision making. This will save time in the long run by minimizing the need to redo work.
Repetitive mistakes are the best avoided. Project lessons learned should be documented so that future team leaders can make use of the learning experience of others in order to avoid the same pitfalls themselves.
In order to achieve goals and planned results within a defined schedule and a budget, a manager uses a project. Regardless of which field or which trade, there are assortments of methodologies to help managers at every stage of a project from the initiation to implementation to the closure. In this tutorial, we will try to discuss the most commonly used project management methodologies.
A methodology is a model, which project managers employ for the design, planning, implementation and achievement of their project objectives. There are different project management methodologies to benefit different projects.
For example, there is a specific methodology, which NASA uses to build a space station while the Navy employs a different methodology to build submarines. Hence, there are different project management methodologies that cater to the needs of different projects spanned across different business domains.
Following are the most frequently used project management methodologies in the project management practice:
In this methodology, the project scope is a variable. Additionally, the time and the cost are constants for the project. Therefore, during the project execution, the project scope is adjusted in order to get the maximum business value from the project.
Agile software development methodology is for a project that needs extreme agility in requirements. The key features of agile are its short-termed delivery cycles (sprints), agile requirements, dynamic team culture, less restrictive project control and emphasis on real-time communication.
In crystal method, the project processes are given a low priority. Instead of the processes, this method focuses more on team communication, team member skills, people and interaction. Crystal methods come under agile category.
This is the successor of Rapid Application Development (RAD) methodology. This is also a subset of agile software development methodology and boasts about the training and documents support this methodology has. This method emphasizes more on the active user involvement during the project life cycle.
Lowering the cost of requirement changes is the main objective of extreme programming. XP emphasizes on fine scale feedback, continuous process, shared understanding and programmer welfare. In XP, there is no detailed requirements specification or software architecture built.
This methodology is more focused on simple and well-defined processes, short iterative and feature driven delivery cycles. All the planning and execution in this project type take place based on the features.
This methodology is a collection of best practices in project management. ITIL covers a broad aspect of project management which starts from the organizational management level.
Involving the client from the early stages with the project tasks is emphasized by this methodology. The project team and the client hold JAD sessions collaboratively in order to get the contribution from the client. These JAD sessions take place during the entire project life cycle.
Lean development focuses on developing change-tolerance software. In this method, satisfying the customer comes as the highest priority. The team is motivated to provide the highest value for the money paid by the customer.
PRINCE2 takes a process-based approach to project management. This methodology is based on eight high-level processes.
This methodology focuses on developing products faster with higher quality. When it comes to gathering requirements, it uses the workshop method. Prototyping is used for getting clear requirements and re-use the software components to accelerate the development timelines.
In this method, all types of internal communications are considered informal.
RUP tries to capture all the positive aspects of modern software development methodologies and offer them in one package. This is one of the first project management methodologies that suggested an iterative approach to software development.
This is an agile methodology. The main goal of this methodology is to improve team productivity dramatically by removing every possible burden. Scrum projects are managed by a Scrum master.
Spiral methodology is the extended waterfall model with prototyping. This method is used instead of using the waterfall model for large projects.
This is a conceptual model used in software development projects. In this method, there is a possibility of combining two or more project management methodologies for the best outcome. SDLC also heavily emphasizes on the use of documentation and has strict guidelines on it.
This is the legacy model for software development projects. This methodology has been in practice for decades before the new methodologies were introduced. In this model, development lifecycle has fixed phases and linear timelines. This model is not capable of addressing the challenges in the modern software development domain.
Selecting the most suitable project management methodology could be a tricky task. When it comes to selecting an appropriate one, there are a few dozens of factors you should consider. Each project management methodology carries its own strengths and weaknesses.
Therefore, there is no good or bad methodology and what you should follow is the most suitable one for your project management requirements.
When organizations grow, they establish different entities for governing respective practices.
The Project Management Office (PMO) is the entity created for governing the processes, practices, tools and other activities related to project management in an organization.
This office (team) defines and maintains the standards for project management in the organization.
Usually, the management of the organization assigns a team of experts in the field of project management in order to run the project management office.
The organization looks for qualifications such as PMI certifications and extensive experience is managing large projects when selecting people for the project management office.
Due to the complexity of present projects, the project management function should be a matured and streamlined practice.
Therefore, organizations look for better ways of managing the projects in order to maximize the profit margins. For this, organizations look into process optimization, productivity enhancement and building their bottom-line.
Since there are many parameters involved in the project management function (such as people, technology, communication and resources), governing the project management function by the senior management can be risky.
Therefore, a project management office is the ideal solution for building and maintaining the project management practice as a capable function of the organization.
Implementing a project management office is as same as any other organizational change project. Therefore, it is approached with a strong and rigid methodology with a lot of experience.
There are a number of key steps involved in building a project management office and PMBOK (Project Management Body of Knowledge) can be a great reference for this purpose.
Some traditional organizations view the project management office as an overhead. This is mainly due to the fact that the organization is small enough where there is no explicit need for a project management office.
In such organizations, the general management can govern project management practice. For the rest of the organizations where there are large projects, a project management office is a lot more than an overhead.
At present, the world economy is at a recession. Therefore, a lot of companies look at cutting costs in order to retain in the corporate environment.
Among the ways of doing this, cutting down staff and closing down departments have become two popular options. In such cases, project management office has become an easy victim, as it does not add any figure to the bottom-line of the company.
Therefore, it has become a challenge for the project management offices to justify their work to the upper management.
Project management is one of the key functions of an organization. Therefore, refining the processes related to project management could add a lot of value to the organization's bottom-line.
This is what exactly a successful project management office does.
Based on the historical statistics, only one-third of project management offices work and the rest do not work as expected.
This is one of the main concerns that senior management faces when deciding to build a project management office for an organization. The management is doubtful about the success of the project management office from the beginning.
One of the main reasons for project management office to fail is the lack of executive management support. In most cases, the executive management does not have enough knowledge on how to support and guide a project management office.
Secondly, incapability of the project management office causes failures. This is mainly due to the people and resources assigned to the project management office.
Project management office is one of the entities that will add value to large organizations in the long run. A project management office could be an overhead for smaller scale organizations and such establishment may end up as a failure.
A successful project management office can enhance the productivity of the project teams and cause a lot of cost savings. In addition to that, it can make the organization a more matured and capable entity.
Project management is one of the critical processes of any project. This is due to the fact that project management is the core process that connects all other project activities and processes together.
When it comes to the activities of project management, there are plenty. However, these plenty of project management activities can be categorized into five main processes.
Let's have a look at the five main project management processes in detail.
Project initiation is the starting point of any project. In this process, all the activities related to winning a project takes place. Usually, the main activity of this phase is the pre-sale.
During the pre-sale period, the service provider proves the eligibility and ability of completing the project to the client and eventually wins the business. Then, it is the detailed requirements gathering which comes next.
During the requirements gathering activity, all the client requirements are gathered and analysed for implementation. In this activity, negotiations may take place to change certain requirements or remove certain requirements altogether.
Usually, project initiation process ends with requirements sign-off.
Project planning is one of the main project management processes. If the project management team gets this step wrong, there could be heavy negative consequences during the next phases of the project.
Therefore, the project management team will have to pay detailed attention to this process of the project.
In this process, the project plan is derived in order to address the project requirements such as, requirements scope, budget and timelines. Once the project plan is derived, then the project schedule is developed.
Depending on the budget and the schedule, the resources are then allocated to the project. This phase is the most important phase when it comes to project cost and effort.
After all paperwork is done, in this phase, the project management executes the project in order to achieve project objectives.
When it comes to execution, each member of the team carries out their own assignments within the given deadline for each activity. The detailed project schedule will be used for tracking the project progress.
During the project execution, there are many reporting activities to be done. The senior management of the company will require daily or weekly status updates on the project progress.
In addition to that, the client may also want to track the progress of the project. During the project execution, it is a must to track the effort and cost of the project in order to determine whether the project is progressing in the right direction or not.
In addition to reporting, there are multiple deliveries to be made during the project execution. Usually, project deliveries are not onetime deliveries made at the end of the project. Instead, the deliveries are scattered through out the project execution period and delivered upon agreed timelines.
During the project life cycle, the project activities should be thoroughly controlled and validated. The controlling can be mainly done by adhering to the initial protocols such as project plan, quality assurance test plan and communication plan for the project.
Sometimes, there can be instances that are not covered by such protocols. In such cases, the project manager should use adequate and necessary measurements in order to control such situations.
Validation is a supporting activity that runs from first day to the last day of a project. Each and every activity and delivery should have its own validation criteria in order to verify the successful outcome or the successful completion.
When it comes to project deliveries and requirements, a separate team called 'quality assurance team' will assist the project team for validation and verification functions.
Once all the project requirements are achieved, it is time to hand over the implemented system and closeout the project. If the project deliveries are in par with the acceptance criteria defined by the client, the project will be duly accepted and paid by the customer.
Once the project closeout takes place, it is time to evaluate the entire project. In this evaluation, the mistakes made by the project team will be identified and will take necessary steps to avoid them in the future projects.
During the project evaluation process, the service provider may notice that they haven't gained the expected margins for the project and may have exceeded the timelines planned at the beginning.
In such cases, the project is not a 100% success to the service provider. Therefore, such instances should be studied carefully and should take necessary actions to avoid in the future.
Project management is a responsible process. The project management process connects all other project activities together and creates the harmony in the project.
Therefore, the project management team should have a detailed understanding on all the project management processes and the tools that they can make use for each project management process.
Project management is one of the high-responsibility tasks in modern organizations. Project management is used in many types of projects ranging from software development to developing the next generation fighter aircrafts.
In order to execute a project successfully, the project manager or the project management team should be supported by a set of tools.
These tools can be specifically designed tools or regular productivity tools that can be adopted for project management work.
The use of such tools usually makes the project managers work easy as well as it standardizes the work and the routine of a project manager.
Following are some of those tools used by project managers in all domains:
All the projects that should be managed by a project manager should have a project plan. The project plan details many aspects of the project to be executed.
First of all, it details out the project scope. Then, it describes the approach or strategy used for addressing the project scope and project objectives.
The strategy is the core of the project plan. The strategy could vary depending on the project purpose and specific project requirements.
The resource allocation and delivery schedule are other two main components of the project plan. These detail each activity involved in the project as well as the information such as who executes them and when.
This is important information for the project manager as well as all the other stakeholders of the project.
This is one of the best tools the project manager can use to determine whether he or she is on track in terms of the project progress.
The project manager does not have to use expensive software to track this. The project manager can use a simple Excel template to do this job.
The milestone checklist should be a live document that should be updated once or twice a week.
Gantt chart illustrates the project schedule and shows the project manager the interdependencies of each activity. Gantt charts are universally used for any type of project from construction to software development.
Although deriving a Gantt chart looks quite easy, it is one of the most complex tasks when the project is involved in hundreds of activities.
There are many ways you can create a Gantt chart. If the project is small and simple in nature, you can create your own Gantt chart in Excel or download an Excel template from the Internet.
If the project has a high financial value or high-risk exposure, then the project manager can use software tools such as MS Project.
With the introduction of computer technology, there have been a number of software tools specifically developed for project management purpose. MS Project is one such tool that has won the hearts of project managers all over the world.
MS Project can be used as a standalone tool for tracking project progress or it can be used for tracking complex projects distributed in many geographical areas and managed by a number of project managers.
There are many other software packages for project management in addition to MS Project. Most of these new additions are online portals for project management activities where the project members have access to project details and progress from anywhere.
A comprehensive project review mechanism is a great tool for project management. More mature companies tend to have more strict and comprehensive project reviews as opposed to basic ones done by smaller organizations.
In project reviews, the project progress and the adherence to the process standards are mainly considered. Usually, project reviews are accompanied by project audits by a 3rd party (internal or external).
The non-compliances and action items are then tracked in order to complete them.
Delivery reviews make sure that the deliveries made by the project team meet the customer requirements and adhere to the general guidelines of quality.
Usually, a 3rd party team or supervisors (internal) conduct the delivery review and the main stakeholders of the project delivery do participate for this event.
The delivery review may decide to reject the delivery due to the quality standards and non-compliances.
When it comes to performance of the project team, a scorecard is the way of tracking it. Every project manager is responsible of accessing the performance of the team members and reporting it to the upper management and HR.
This information is then used for promotion purposes as well as human resource development. A comprehensive score card and performance assessment can place the team member in the correct position.
A project manager cannot execute his/her job without a proper set of tools. These tools do not have to be renowned software or something, but it can pretty well be simple and proven techniques to manage project work.
Having a solid set of project management tools always makes project managers' work pleasurable and productive.
The project management triangle is used by managers to analyze or understand the difficulties that may arise due to implementing and executing a project. All projects irrespective of their size will have many constraints.
Although there are many such project constraints, these should not be barriers for successful project execution and for the effective decision making.
There are three main interdependent constraints for every project; time, cost and scope. This is also known as Project Management Triangle.
Let's try to understand each of the element of project triangle and then how to face challenges related to each.
The three constraints in a project management triangle are time, cost and scope.
A project's activities can either take shorter or longer amount of time to complete. Completion of tasks depends on a number of factors such as the number of people working on the project, experience, skills, etc.
Time is a crucial factor which is uncontrollable. On the other hand, failure to meet the deadlines in a project can create adverse effects. Most often, the main reason for organizations to fail in terms of time is due to lack of resources.
It's imperative for both the project manager and the organization to have an estimated cost when undertaking a project. Budgets will ensure that project is developed or implemented below a certain cost.
Sometimes, project managers have to allocate additional resources in order to meet the deadlines with a penalty of additional project costs.
Scope looks at the outcome of the project undertaken. This consists of a list of deliverables, which need to be addressed by the project team.
A successful project manager will know to manage both the scope of the project and any change in scope which impacts time and cost.
Quality is not a part of the project management triangle, but it is the ultimate objective of every delivery. Hence, the project management triangle represents implies quality.
Many project managers are under the notion that 'high quality comes with high cost', which to some extent is true. By using low quality resources to accomplish project deadlines does not ensure success of the overall project.
Like with the scope, quality will also be an important deliverable for the project.
A project undergoes six stages during its life cycles and they are noted below:
Project Definition - This refers to defining the objectives and the factors to be considered to make the project successful.
Project Definition - This refers to defining the objectives and the factors to be considered to make the project successful.
Project Initiation - This refers to the resources as well as the planning before the project starts.
Project Initiation - This refers to the resources as well as the planning before the project starts.
Project Planning - Outlines the plan as to how the project should be executed. This is where project management triangle is essential. It looks at the time, cost and scope of the project.
Project Planning - Outlines the plan as to how the project should be executed. This is where project management triangle is essential. It looks at the time, cost and scope of the project.
Project Execution - Undertaking work to deliver the outcome of the project.
Project Execution - Undertaking work to deliver the outcome of the project.
Project Monitoring & Control - Taking necessary measures, so that the operation of the project runs smoothly.
Project Monitoring & Control - Taking necessary measures, so that the operation of the project runs smoothly.
Project Closure - Acceptance of the deliverables and discontinuing resources that were required to run the project.
Project Closure - Acceptance of the deliverables and discontinuing resources that were required to run the project.
It is always a requirement to overcome the challenges related to the project triangle during the project execution period. Project managers need to understand that the three constraints outlined in the project management triangle can be adjusted.
The important aspect is to deal with it. The project manager needs to strike a balance between the three constraints so that quality of the project will not be compromised.
To overcome the constraints, the project managers have several methods to keep the project going. Some of these will be based on preventing stakeholders from changing the scope and maintaining limits on both financial and human resources.
A project manager's role is evolved around responsibility. A project manager needs to supervise and control the project from the beginning to the closure.
The following factors will outline a project manager's role:
The project manager needs to define the project and split the tasks amongst team members. The project manager also needs to obtain key resources and build teamwork.
The project manager needs to define the project and split the tasks amongst team members. The project manager also needs to obtain key resources and build teamwork.
The project manager needs to set the objectives required for the project and work towards meeting these objectives.
The project manager needs to set the objectives required for the project and work towards meeting these objectives.
The most important activity of a project manager is to keep stakeholders informed on the progress of the project.
The most important activity of a project manager is to keep stakeholders informed on the progress of the project.
The project manager needs to asses and carefully monitor risks of the project.
The project manager needs to asses and carefully monitor risks of the project.
In order to overcome the challenges related to project triangle and meet the project objectives, the project manager needs to have a range of skills, which includes:
Leadership
Leadership
Managing people
Managing people
Negotiation
Negotiation
Time management
Time management
Effective communication
Effective communication
Planning
Planning
Controlling
Controlling
Conflict resolution
Conflict resolution
Problem solving
Problem solving
Project management is very often represented on a triangle. A successful project manager needs to keep a balance between the triple constraints so that the quality of the project or outcome is not compromised.
There are many tools and techniques that are available in order to face the challenges related to the three constraints. A good project manager will use appropriate tools in order to execute the project successfully.
Every organization requires good leadership in order to carry out all their projects successfully. This requires the organization to appoint efficient project managers to carry out various tasks, and of course, to guide and lead the project management team and get them to a point, where they have effectively completed any given project at hand, taking into account a whole load of factors.
In order to understand how project management can run smoothly, it is important to first identify the role and the tasks carried out by the project manager. So who is a project manager and why is he/she so important?
The role of a project manager basically involves handling all aspects of the project.
This includes not just the logistics but also the planning, brainstorming and seeing to the overall completion of the project while also preventing glitches and ensuring that the project management team works well together.
Following should be the the main goals for a project manager, but they are not limited to the listed ones because it very much depends on the situation:
A project manager must always be able to carry out his role in a very effective manner.
This means that in most cases he/she would have to run against time with the clock ticking away. All projects would have deadlines, so it is the duty of a project manager to complete the project by this given date.
It should be noted that although the project manager and his team may draw up a schedule at the outset that may seem perfect, as time goes on you will find that the requirements may change, and the projects may require new strategies to be implemented and more planning to be carried out.
Time therefore could be a big obstacle for a project manager achieving his/her goal. As the project manager you should never lose sight of the deadline, your role would be to keep pushing your team to finish the work and deliver on time.
Remember that your clients' satisfaction is your number one priority.
Satisfaction of the client, however, does not mean that you rush to finish the work on time without ensuring that standards are met.
The reputation of your organization would depend on the quality of the delivery of your projects. This is another factor you should not lose sight of throughout the project.
Your role would also be to keep reminding the team members that quality is key.
No project can be started off without the preparation of the budget. Although this is just a forecast of the costs that would be incurred, it is essential that this budget is prepared after careful research and comparing prices to get the best.
You would need to consider ways of cutting costs while also ensuring that you meet the needs of the client as well as meeting the standards expected of your organization.
This budget must include all costs with regard equipment, labor and everything else. You then need to try and always stick to the budget, although it's always best to leave some allowance for a few 100 dollars for any additional expenses that may arise.
Another goal of a project manager involves meeting all requirements of the client. You would need to therefore have all specifications at hand and go through them every once in a while to ensure that you are on track.
If there is confusion as to any requirements, it would be best for you to get them cleared at the very beginning.
While you would have to ensure that all aspects of the project are maintained, you are also responsible as project manager for the happiness of your team.
You need to keep in mind that it is the incentives and encouragement provided to them that will make them work harder and want to complete the work on time, thereby helping you reach your goals.
If the team members are unhappy with the way things are being carried out, productivity will also in turn decrease, pulling you further away from achieving your goals. It is essential therefore to always maintain a warm friendly relationship with them.
The communication within the team should be very effective. They should be willing to voice out their opinions while you listen to their suggestions and consider including them in the project.
This is after all a team effort. Your goals with regard to the project are also their goals.
The role of a project manager is therefore no easy task. It involves taking up a lot of responsibility as each of the goals of the project must be met without making too many sacrifices.
If these goals are outlined to the project management team at the very beginning, there in no way for the delivery of the goals to be delayed in any way as everyone will always be aware of what they need to achieve and by when.
When there are many projects run by an organization, it is vital for the organization to manage their project portfolio. This helps the organization to categorize the projects and align the projects with their organizational goals.
Project Portfolio Management (PPM) is a management process with the help of methods aimed at helping the organization to acquire information and sort out projects according to a set of criteria.
Same as with financial portfolio management, the project portfolio management also has its own set of objectives. These objectives are designed to bring about expected results through coherent team players.
When it comes to the objectives, the following factors need to be outlined.
The need to create a descriptive document, which contains vital information such as name of project, estimated timeframe, cost and business objectives.
The need to create a descriptive document, which contains vital information such as name of project, estimated timeframe, cost and business objectives.
The project needs to be evaluated on a regular basis to ensure that the project is meeting its target and stays in its course.
The project needs to be evaluated on a regular basis to ensure that the project is meeting its target and stays in its course.
Selection of the team players, who will work towards achieving the project's objectives.
Selection of the team players, who will work towards achieving the project's objectives.
Project portfolio management ensures that projects have a set of objectives, which when followed brings about the expected results. Furthermore, PPM can be used to bring out changes to the organization which will create a flexible structure within the organization in terms of project execution. In this manner, the change will not be a threat for the organization.
The following benefits can be gained through efficient project portfolio management:
Greater adaptability towards change.
Greater adaptability towards change.
Constant review and close monitoring brings about a higher return.
Constant review and close monitoring brings about a higher return.
Management's perspectives with regards to project portfolio management is seen as an 'initiative towards higher return'. Therefore, this will not be considered to be a detrimental factor to work.
Management's perspectives with regards to project portfolio management is seen as an 'initiative towards higher return'. Therefore, this will not be considered to be a detrimental factor to work.
Identification of dependencies is easier to identify. This will eliminate some inefficiency from occurring.
Identification of dependencies is easier to identify. This will eliminate some inefficiency from occurring.
Advantage over other competitors (competitive advantage).
Advantage over other competitors (competitive advantage).
Helps to concentrate on the strategies, which will help to achieve the targets rather than focusing on the project itself.
Helps to concentrate on the strategies, which will help to achieve the targets rather than focusing on the project itself.
The responsibilities of IT is focused on part of the business rather than scattering across several.
The responsibilities of IT is focused on part of the business rather than scattering across several.
The mix of both IT and business projects are seen as contributors to achieving the organizational objectives.
The mix of both IT and business projects are seen as contributors to achieving the organizational objectives.
There are many tools that can be used for project portfolio management. Following are the essential features of those tools:
A systematic method of evaluation of projects.
A systematic method of evaluation of projects.
Resources need to be planned.
Resources need to be planned.
Costs and the benefits need to be kept on track.
Costs and the benefits need to be kept on track.
Undertaking cost benefit analysis.
Undertaking cost benefit analysis.
Progress reports from time to time.
Progress reports from time to time.
Access to information as and when its required.
Access to information as and when its required.
Communication mechanism, which will take through the information necessary.
Communication mechanism, which will take through the information necessary.
There are various techniques, which are used to measure or support PPM process from time to time. However, there are three types of techniques, which are widely used:
Heuristic model.
Heuristic model.
Scoring technique.
Scoring technique.
Visual or Mapping techniques.
Visual or Mapping techniques.
The use of such techniques should be done in consideration of the project and organizational objectives, resource skills and the infrastructure for project management.
PPM is crucial for a project to be successful as well as to identify any back lags if it were to occur. Project Managers often face a difficult situation arising from lack of planning and sometimes this may lead to a project withdrawal.
It's the primary responsibility of project managers to ensure that there are enough available resources for the projects that an organization undertakes. Proper resources will ensure that the project is completed within the set timeline and delivered without a compromise on quality.
Project managers also may wish to work on projects, which are given its utmost priority and value to an organization. This will enable project managers to deliver and receive support for quality projects that they have undertaken. PPM ensures that these objectives of the project management will be met.
The five question model of project portfolio management illustrates that the project manager is required to answer five essential questions before the inception as well as during the project execution.
The answers to these questions will determine the success of the implementation of the project.
Project portfolio management is aimed at reducing inefficiencies that occur when undertaking a project and eliminating potential risks, which can occur due to lack of information or systems available.
It helps the organization to align its project work to meet the projects whilst utilizing its resources to the maximum.
Therefore, all the project managers of the organization need to have an awareness of the organizational project portfolio management in order to contribute to the organizational goals when executing respective projects.
Every project delivers something at the end of the project execution. When it comes to the project initiation, the project management and the client collaboratively define the objectives and the deliveries of the project together with the completion timelines.
During the project execution, there are a number of project deliveries made. All these deliveries should adhere to certain quality standards (industry standards) as well as specific client requirements.
Therefore, each of these deliveries should be validated and verified before delivering to the client. For that, there should be a quality assurance function, which runs from start to the end of the project.
When it comes to the quality, not only the quality of the deliveries that matter the most. The processes or activities that produce deliverables should also adhere to certain quality guidelines as well.
As a principle, if the processes and activities that produce the deliverables do not adhere to their own quality standards (process quality standards), then there is a high probability that deliverables not meeting the delivery quality standards.
To address all the quality requirements, standards and quality assurance mechanisms in a project, a document called 'project quality plan' is developed by the project team. This plan acts as the quality bible for the project and all the stakeholders of the project should adhere to the project quality plan.
Depending on the nature of the industry and the nature of the project, the components or the areas addressed by a quality plan may vary. However, there are some components that can be found in any type of quality plan.
Let's have a look at the most essential attributes of a project quality plan.
This describes how the management is responsible for achieving the project quality. Since management is the controlling and monitoring function for the project, project quality is mainly a management responsibility.
Documents are the main method of communication in project management. Documents are used for communication between the team members, project management, senior management and the client.
Therefore, the project quality plan should describe a way to manage and control the documents used in the project. Usually, there can be a common documentation repository with controlled access in order to store and retrieve the documents.
The correct requirements to be implemented are listed here. This is an abstraction of the requirements sign-off document. Having requirements noted in the project quality plan helps the quality assurance team to correctly validate them.
This way, quality assurance function knows what exactly to test and what exactly to leave out from the scope. Testing the requirements that are not in the scope may be a waste for the service provider.
This specifies the controls and procedures used for the design phase of the project. Usually, there should be design reviews in order to analyse the correctness of the proposed technical design. For fruitful design reviews, senior designers or the architects of the respective domain should get involved. Once the designs are reviewed and agreed, they are signed-off with the client.
With the time, the client may come up with changes to the requirements or new requirements. In such cases, design may be changed. Every time the design changes, the changes should be reviewed and signed-off.
Once the construction of the project starts, all the processes, procedures and activities should be closely monitored and measured. By this type of control, the project management can make sure that the project is progressing in the correct path.
This component of the project quality plan takes precedence over other components. This is the element, which describes the main quality assurance functions of the project. This section should clearly identify the quality objectives for the project and the approach to achieve them.
This section identifies the project quality risks. Then, the project management team should come up with appropriate mitigation plans in order to address each quality risk.
For every project, regardless of its size or the nature, there should be periodic quality audits to measure the adherence to the quality standards. These audits can be done by an internal team or an external team.
Sometimes, the client may employ external audit teams to measure the compliance to standards and procedures of the project processes and activities.
During testing and quality assurance, defects are usually caught. This is quite common when it comes to software development projects. The project quality plan should have guidelines and instructions on how to manage the defects.
Every project team requires some kind of training before the project commences. For this, a skill gap analysis is done to identify the training requirements at the project initiation phase.
The project quality plan should indicate these training requirements and necessary steps to get the staff trained.
Project quality plan is one of the mandatory documents for any type of project.
As long as a project has defined objectives and deliverables, there should be a project quality plan to measure the delivery and process quality.
Project management is an approach, which helps managers to manage the projects. Project management also means using controls in place to meet the deadlines and other requirements such as cost of the project.
These controls involve proper and effective recording of project management activities. Record management is a systematic approach for organizing, planning and tracking documents during the course of the project execution.
A record system is a systematic process in which an organization determines the following considerations, activities and characteristics:
The type of information that should be recorded.
The type of information that should be recorded.
A process for recording data.
A process for recording data.
Handling and collecting of records.
Handling and collecting of records.
The time period for retention and storage.
The time period for retention and storage.
Disposal or protecting records, which relate to external events.
Disposal or protecting records, which relate to external events.
Elements in a record management system.
Elements in a record management system.
Content analysis, which states or describes the record system.
Content analysis, which states or describes the record system.
A file plan, which indicates the kind of record that is required for each project.
A file plan, which indicates the kind of record that is required for each project.
A compliance requirement document, which will outline the IT procedures that everyone needs to follow. This will ensure that team members are fully compliant.
A compliance requirement document, which will outline the IT procedures that everyone needs to follow. This will ensure that team members are fully compliant.
A method, which collects out dated documents. These should be done across all record sources such as e-mails, file servers, etc.
A method, which collects out dated documents. These should be done across all record sources such as e-mails, file servers, etc.
A method for auditing records.
A method for auditing records.
A system, which captures the record data.
A system, which captures the record data.
A system, which ensures monitoring and reporting in the way which records are being held.
A system, which ensures monitoring and reporting in the way which records are being held.
In the project record management process, there are three distinct stages. These stages have many other activities involved in order to complete and accomplish the objectives for each stage.
The stages are:
The creation of records
The creation of records
Maintenance of records
Maintenance of records
Storage and retrieval of records
Storage and retrieval of records
Let's have a look at each of the stage in detail.
This refers to the underlying reason as to why the record is being created. This could be for a receipt or for an inventory control report or some other reason.
The primary objective of project record management is to determine the flow of the record handling once the record is created. When it comes to creating records, the following questions should be answered.
Who will view the record?
Who will view the record?
Who will be the final owner of the record?
Who will be the final owner of the record?
Who is responsible for storing the record?
Who is responsible for storing the record?
Developing an operation to store the records refers to maintaining the records. The access levels to the records should be defined at this stage and should take all necessary steps in order to avoid the records getting into the wrong hands.
Proper compliance procedures and security measures need to be in place to avoid misusing of records.
Storing of records could refer to manual storage of documents as well as digital storage. Project managers need to ensure that the records are returned in the way it was borrowed. Maintaining records also refers to the amount of time that records can be maintained.
Some organizations may retain records up to six years whilst others less amount of years. If records are saved digitally, proper folders need to be created. Once created, the older documents need to be archived so that hard drive space is retained.
Records, which are collated needs to be planned. The following outlines the steps that management needs to take to ensure record planning process is successful.
Identification of roles, which ensure that records are managed properly
Allocating dedicated roles or appointing dedicated people to categorize the records, which are available in an organization.
Appointing IT professionals to implement systems, which maintain and support record management.
Identification of roles, which ensure that records are managed properly
Allocating dedicated roles or appointing dedicated people to categorize the records, which are available in an organization.
Allocating dedicated roles or appointing dedicated people to categorize the records, which are available in an organization.
Appointing IT professionals to implement systems, which maintain and support record management.
Appointing IT professionals to implement systems, which maintain and support record management.
Managers need to make sure that the team members are aware of the procedures in place for record management.
Managers need to make sure that the team members are aware of the procedures in place for record management.
The record management process needs to analyze the content of the documents, which are to be saved.
The record management process needs to analyze the content of the documents, which are to be saved.
Implement a file plan, which will store the different kinds of files in an organization.
Implement a file plan, which will store the different kinds of files in an organization.
Develop retention schedules, which could vary from one organization to another depending on the activity taking place.
Develop retention schedules, which could vary from one organization to another depending on the activity taking place.
Design effective record management solutions.
Design effective record management solutions.
Planning of how content can be moved to record methods.
Planning of how content can be moved to record methods.
Develop a plan where e-mail integration could be made.
Develop a plan where e-mail integration could be made.
Plan a compliance procedure for social content.
Plan a compliance procedure for social content.
Develop compliance procedures that align the objectives of project record system.
Develop compliance procedures that align the objectives of project record system.
A record is a document or an electronic storage of data in an organization which acts as evidence or a guideline. A project record management is a systematic process, which allows people to retain records for future use.
It outlines the details which are relevant to the project. Hence, project record management needs to be monitored and retained in a careful manner.
All projects start off with a bang. Yet, some are destined for failure from its very inception, whilst others collapse later on.
Yet, others reach the finish line triumphantly, carrying with them a few scars from battles faced and overcome.
Therefore, in order to minimize project failure, it is prudent to identify the main causative factors that contribute to project risk.
The three main constraints on projects can be classified as schedule, scope and resources, and the mishandling of each can cause a ripple effect on the project, which would then face imminent collapse.
Defining what is required is not always easy. However, so as to ensure that scope risk is minimized, the deliverables, the objectives, the project charter, and of course, the scope needs to be clearly defined.
All scope risks, be they quantifiable or not, needs to recognized. Scope creep, hardware defects, software defects, an insufficiently defined scope, unexpected changes in the legal or regulatory framework and integration defects can all be classified under the broad umbrella of scope risk.
There are a variety of methods that help stakeholders identify the scope of the project. The risk framework analyses the project's dependency on technology and the market and then assesses how changes in each would affect the outcome of the project.
Similarly, the risk complexity index looks at the technical aspects of the projects, which can be easily quantified and allocated a number between 0 and 99 to indicate the risk of the project.
Risk assessment, on the other hand, uses a grid of technology, structure and magnitude to assess the proposed risk of the project.
A work breakdown structure, commonly abbreviated as WBS, also considers the risks of projects, which are ill defined and where the stated objectives are ambiguous.
Scope risks can be minimized and managed with savvy planning. Defining the project clearly, managing the changes in scope throughout the duration of the project, making use of risk registers to better manage risks, identifying the causative factors, and the appropriate responses to risky situations and developing greater risk tolerance in collaboration with the customer, would pay great dividends in the long run.
Keeping to timelines and agreed critical paths is one of the most difficult situations that project managers now face.
An extensive reliance on external parties whose output is not within the project's scope of control, estimation errors, which most often are too optimistic, hardware delays and putting off decision making, all tend to delay the project at hand.
To minimize schedule risks, there are a few time-tested methods that can be put to good use. The process flow of the project should be broken down into small, clearly defined components where the allocated timeframe for each process is relatively short in duration (this makes it easy to identify things when tasks veer off schedule, at its earliest).
Be wary of team members or external parties, who hesitate to give estimates or whose estimates seem unrealistic based on historical data and previous experience.
When formulating the critical path, ensure that any holidays that arise are in-built into the equation, so that realistic expectations are created, right from inception. Defining re-work loops too is also recommended, wherever possible.
People and funds are any project's main resource base. If the people are unskilled or incompetent to perform the task at hand, if the project is under-staffed from the beginning, or if key project members come on aboard far after the inception of the project, there is an obvious project risk that has ill-planned human resources as its base.
Similarly, from a financial perspective, if insufficient funds are provided to carry out the necessary tasks, be it relevant training programs for the people in question or be it inadequate investments in technology or required machinery, the project is doomed to fail from inception.
Estimating project costs accurately, allocating a suitable budget to meet these costs, not placing undue expectations on the capacity of the staff in question and avoiding burn-out at a later date are all factors that help minimize the project resource risk.
Outsourced functions merit even more attention to detail, as it is for the most part, it is away from the direct purview of the project manager. Clearly defined contracts and regular monitoring would lessen this risk substantially.
Conflict management, which too generally arises with the progression of a project, should also be handled in a skilful manner, so that the project has a smooth run throughout its entire duration.
As is readily apparent, all projects do run the risk of failure due to unplanned contingencies and inaccurate estimates.
Yet, careful planning, constraint management, successful recovery from mistakes if and when they do arise will minimize most risks. True, luck too, does play a part in the success of a project, but hard work and savvy management practices will override most such difficulties.
Risk is inevitable in a business organization when undertaking projects. However, the project manager needs to ensure that risks are kept to a minimal. Risks can be mainly divided between two types, negative impact risk and positive impact risk.
Not all the time would project managers be facing negative impact risks as there are positive impact risks too. Once the risk has been identified, project managers need to come up with a mitigation plan or any other solution to counter attack the risk.
Managers can plan their strategy based on four steps of risk management which prevails in an organization. Following are the steps to manage risks effectively in an organization:
Risk Identification
Risk Identification
Risk Quantification
Risk Quantification
Risk Response
Risk Response
Risk Monitoring and Control
Risk Monitoring and Control
Let's go through each of the step in project risk management:
Managers face many difficulties when it comes to identifying and naming the risks that occur when undertaking projects. These risks could be resolved through structured or unstructured brainstorming or strategies. It's important to understand that risks pertaining to the project can only be handled by the project manager and other stakeholders of the project.
Risks, such as operational or business risks will be handled by the relevant teams. The risks that often impact a project are supplier risk, resource risk and budget risk. Supplier risk would refer to risks that can occur in case the supplier is not meeting the timeline to supply the resources required.
Resource risk occurs when the human resource used in the project is not enough or not skilled enough. Budget risk would refer to risks that can occur if the costs are more than what was budgeted.
Risks can be evaluated based on quantity. Project managers need to analyze the likely chances of a risk occurring with the help of a matrix.
Using the matrix, the project manager can categorize the risk into four categories as Low, Medium, High and Critical. The probability of occurrence and the impact on the project are the two parameters used for placing the risk in the matrix categories. As an example, if a risk occurrence is low (probability = 2) and it has the highest impact (impact = 4), the risk can be categorized as 'High'.
When it comes to risk management, it depends on the project manager to choose strategies that will reduce the risk to minimal. Project managers can choose between the four risk response strategies, which are outlined below.
Risks can be avoided
Risks can be avoided
Pass on the risk
Pass on the risk
Take corrective measures to reduce the impact of risks
Take corrective measures to reduce the impact of risks
Acknowledge the risk
Acknowledge the risk
Risks can be monitored on a continuous basis to check if any change is made. New risks can be identified through the constant monitoring and assessing mechanisms.
Following are the considerations when it comes to risk management process:
Each person involved in the process of planning needs to identify and understand the risks pertaining to the project.
Each person involved in the process of planning needs to identify and understand the risks pertaining to the project.
Once the team members have given their list of risks, the risks should be consolidated to a single list in order to remove the duplications.
Once the team members have given their list of risks, the risks should be consolidated to a single list in order to remove the duplications.
Assessing the probability and impact of the risks involved with the help of a matrix.
Assessing the probability and impact of the risks involved with the help of a matrix.
Split the team into subgroups where each group will identify the triggers that lead to project risks.
Split the team into subgroups where each group will identify the triggers that lead to project risks.
The teams need to come up with a contingency plan whereby to strategically eliminate the risks involved or identified.
The teams need to come up with a contingency plan whereby to strategically eliminate the risks involved or identified.
Plan the risk management process. Each person involved in the project is assigned a risk in which he/she looks out for any triggers and then finds a suitable solution for it.
Plan the risk management process. Each person involved in the project is assigned a risk in which he/she looks out for any triggers and then finds a suitable solution for it.
Often project managers will compile a document, which outlines the risks involved and the strategies in place. This document is vital as it provides a huge deal of information.
Risk register will often consists of diagrams to aid the reader as to the types of risks that are dealt by the organization and the course of action taken. The risk register should be freely accessible for all the members of the project team.
As mentioned above, risks contain two sides. It can be either viewed as a negative element or a positive element. Negative risks can be detrimental factors that can haphazard situations for a project.
Therefore, these should be curbed once identified. On the other hand, positive risks can bring about acknowledgements from both the customer and the management. All the risks need to be addressed by the project manager.
An organization will not be able to fully eliminate or eradicate risks. Every project engagement will have its own set of risks to be dealt with. A certain degree of risk will be involved when undertaking a project.
The risk management process should not be compromised at any point, if ignored can lead to detrimental effects. The entire management team of the organization should be aware of the project risk management methodologies and techniques.
Enhanced education and frequent risk assessments are the best way to minimize the damage from risks.
When it comes to project planning, defining the project scope is the most critical step. In case if you start the project without knowing what you are supposed to be delivering at the end to the client and what the boundaries of the project are, there is a little chance for you to success. In most of the instances, you actually do not have any chance to success with this unorganized approach.
If you do not do a good job in project scope definition, project scope management during the project execution is almost impossible.
The main purpose of the scope definition is to clearly describe the boundaries of your project. Clearly describing the boundaries is not enough when it comes to project. You need to get the client's agreement as well.
Therefore, the defined scope of the project usually included into the contractual agreements between the client and the service provider. SOW, or in other words, Statement of Work, is one such document.
In the project scope definition, the elements within the scope and out of the scope are well defined in order to clearly understand what will be the area under the project control. Therefore, you should identify more elements in detailed manner and divide them among the scope and out of scope.
When the project is about to be funded, there should be a set of defined deliveries and objectives for the project. There can be a high level-scope statement prepared at this level.
This high-level scope statement can be taken from the initial documents such as SOW. In addition to the SOW, you need to use any other document or information in order to further define the project scope at this level.
In case, if you feel that you do not have enough information to come up with a high-level scope statement, you should then work closely with the client in order gather necessary information.
Project objectives can be used for defining the project scope. As a matter of fact, there should be one or more deliveries addressing each project objective in the project. By looking at the deliverables, you can actually gauge the project scope.
Once you get to know the main deliverables of the project, start asking questions about the other processes and different aspects of the project.
First identifying and clearly defining the out of scope also helps you to understand the scope of a project. When you go on defining the out of scope, you will automatically get an idea of the real project scope. In order to follow this method, you need to have a defined scope up to a certain level.
Whenever you identify an item for the scope or out-of-scope, make sure you document it then and there. Later, you can revisit these items and elaborate more on those.
Once you have successfully defined the scope of the project, you need to get the sign-off from the related and applicable parties. Without proper sign-off for the scope, the next phases of the project, i.e., requirements gathering, might have issues in executing.
Scope creep is something common with every project. This refers to the incremental expansion of the project scope. Most of the time, the client may come back to the service provider during the project execution and add more requirements.
Most of such requirements haven't been in the initial requirements. As a result, change requests need to be raised in order to cover the increasing costs of the service provider.
Due to business cope creep, there can be technological scope creep as well. The project team may require new technologies in order to address some of the new requirements in the scope.
In such instances, the service provider may want to work with the client closely and make necessary logistic and financial arrangements.
Project scope definition is the most important factor when it comes to project requirements. It is vital for service providers to define the scope of the project in order to successfully enter into an agreement with the client.
In addition to this, the scope of the project gives an idea to the services provider about the estimated cost of the project. Therefore, service provider's profit margins are wholly dependent on the accuracy of the project scope definition.
One of the biggest decisions that any organization would have to make is related to the projects they would undertake. Once a proposal has been received, there are numerous factors that need to be considered before an organization decides to take it up.
The most viable option needs to be chosen, keeping in mind the goals and requirements of the organization. How is it then that you decide whether a project is viable? How do you decide if the project at hand is worth approving? This is where project selection methods come in use.
Choosing a project using the right method is therefore of utmost importance. This is what will ultimately define the way the project is to be carried out.
But the question then arises as to how you would go about finding the right methodology for your particular organization. At this instance, you would need careful guidance in the project selection criteria, as a small mistake could be detrimental to your project as a whole, and in the long run, the organization as well.
There are various project selection methods practised by the modern business organizations. These methods have different features and characteristics. Therefore, each selection method is best for different organizations.
Although there are many differences between these project selection methods, usually the underlying concepts and principles are the same.
Following is an illustration of two of such methods (Benefit Measurement and Constrained Optimization methods):
As the value of one project would need to be compared against the other projects, you could use the benefit measurement methods. This could include various techniques, of which the following are the most common:
You and your team could come up with certain criteria that you want your ideal project objectives to meet. You could then give each project scores based on how they rate in each of these criteria and then choose the project with the highest score.
You and your team could come up with certain criteria that you want your ideal project objectives to meet. You could then give each project scores based on how they rate in each of these criteria and then choose the project with the highest score.
When it comes to the Discounted Cash flow method, the future value of a project is ascertained by considering the present value and the interest earned on the money. The higher the present value of the project, the better it would be for your organization.
When it comes to the Discounted Cash flow method, the future value of a project is ascertained by considering the present value and the interest earned on the money. The higher the present value of the project, the better it would be for your organization.
The rate of return received from the money is what is known as the IRR. Here again, you need to be looking for a high rate of return from the project.
The rate of return received from the money is what is known as the IRR. Here again, you need to be looking for a high rate of return from the project.
The mathematical approach is commonly used for larger projects. The constrained optimization methods require several calculations in order to decide on whether or not a project should be rejected.
Cost-benefit analysis is used by several organizations to assist them to make their selections. Going by this method, you would have to consider all the positive aspects of the project which are the benefits and then deduct the negative aspects (or the costs) from the benefits. Based on the results you receive for different projects, you could choose which option would be the most viable and financially rewarding.
These benefits and costs need to be carefully considered and quantified in order to arrive at a proper conclusion. Questions that you may want to consider asking in the selection process are:
Would this decision help me to increase organizational value in the long run?
Would this decision help me to increase organizational value in the long run?
How long will the equipment last for?
How long will the equipment last for?
Would I be able to cut down on costs as I go along?
Would I be able to cut down on costs as I go along?
In addition to these methods, you could also consider choosing based on opportunity cost - When choosing any project, you would need to keep in mind the profits that you would make if you decide to go ahead with the project.
Profit optimization is therefore the ultimate goal. You need to consider the difference between the profits of the project you are primarily interested in and the next best alternative.
The methods mentioned above can be carried out in various combinations. It is best that you try out different methods, as in this way you would be able to make the best decision for your organization considering a wide range of factors rather than concentrating on just a few. Careful consideration would therefore need to be given to each project.
In conclusion, you would need to remember that these methods are time-consuming, but are absolutely essential for efficient business planning.
It is always best to have a good plan from the inception, with a list of criteria to be considered and goals to be achieved. This will guide you through the entire selection process and will also ensure that you do make the right choice.
As a project manager, the main objective of the project manager is to deliver the project within the time stated and on budget defined. However, that's not all when it comes to project success criteria.
In addition to above conditions, the project manager needs to work closely with the customer and should ensure the project deliverables have met the customer expectations.
There are many parameters in a project success criterion.
The first project success criterion is to deliver projects bearing in mind the business drivers. Key Performance Indicators (KPI's) is a method used to measure the benefits gained from undertaking the project.
These provide an insight to the scope of the project. The performance indicators are:
Established by the clients at the start of the project and are listed on a priority basis.
Established by the clients at the start of the project and are listed on a priority basis.
Aligned with the business objectives.
Aligned with the business objectives.
Able to make critical decisions based on KPI's for the project.
Able to make critical decisions based on KPI's for the project.
Prove to be a stance for products to be accepted by the clients.
Prove to be a stance for products to be accepted by the clients.
It's a quantitative method and it's measurable.
It's a quantitative method and it's measurable.
To create a project success, criteria based on KPI is not enough and targets need to be set. These set targets need to be realistic and achievable at the end.
A project success criterion begins with the initiatives taken by the project manager to the project in question. This will increase the chances of the project becoming successful as well as meeting customer's expectations.
The project manager, who wants his/her project successful will definitely ask the customers for feedback.
This approach will prove to be successful and will be a learning curve if any mistakes had been done. KPI need to go hand in hand with the business objectives for a project to be considered successful.
Going the extra mile is not restricted to only customer services, it's also a magic word for project management. A top most important factor for a project success criterion is to exceed customer's expectations by completing the project within the stated deadline, budget and quality.
However, project manager needs to bear in mind that this could be misinterpreted and could lead to unnecessary cost. Ideas to make a better product than sticking to the original idea could be done with the approval of the customer. For this to be successful, proper implementation needs to be in place.
Success factors are contributions made by the management towards a successful project. These can be classified broadly into five groups as follows:
The project manager - The person needs to have an array of skills under his arm to use during the project.
The project manager - The person needs to have an array of skills under his arm to use during the project.
Project team - The team needs to consist of variety of skills and experience. Collectively as a team, success is easy to achieve with proper guidance.
Project team - The team needs to consist of variety of skills and experience. Collectively as a team, success is easy to achieve with proper guidance.
Project - The scope and timeline of the project is crucial.
Project - The scope and timeline of the project is crucial.
Organization - The organization needs to provide support to both the project manager and the project team.
Organization - The organization needs to provide support to both the project manager and the project team.
External environment - External constraints should not affect the project. Back-up plans need to be in place in case daily tasks cannot be carried by the team.
External environment - External constraints should not affect the project. Back-up plans need to be in place in case daily tasks cannot be carried by the team.
The project's quality should not be compromised under any circumstances as this will drive away potential customers.
The criteria for a successful project are not restricted to only above. However, following are some of other supporting factors that need to be considered when it comes to a successful project management and execution:
Negotiations
Negotiations
Proper and conducive project plan
Proper and conducive project plan
Assigning tasks to the team members
Assigning tasks to the team members
Developing a plan to achieve common tasks
Developing a plan to achieve common tasks
Reviewing and doing a rework when needed
Reviewing and doing a rework when needed
Managing project risks efficiently
Managing project risks efficiently
Allocating time for process improvement
Allocating time for process improvement
Learn from the learning curve
Learn from the learning curve
Proper estimation of project in terms of not only quantitatively but also qualitatively
Proper estimation of project in terms of not only quantitatively but also qualitatively
A project to be considered successful requires proper planning and the help from the management. Exceeding customer requirements will bring about success to the project.
Understanding the business drivers and ensuring that the project meets the objectives of the business will also contribute to success.
Aligning the key performance indicator to that of the business objective will not only help project managers to keep track but also measure and improve performance.
Time is a terrible resource to waste. This is the most valuable resource in a project.
Every delivery that you are supposed to make is time-bound. Therefore, without proper time management, a project can head towards a disaster.
When it comes to project time management, it is not just the time of the project manager, but it is the time management of the project team.
Scheduling is the easiest way of managing project time. In this approach, the activities of the project are estimated and the durations are determined based on the resource utilization for each activity.
In addition to the estimate and resource allocation, cost always plays a vital role in time management. This is due to the fact that schedule over-runs are quite expensive.
Following are the main steps in the project time management process. Each addresses a distinct area of time management in a project.
When it comes to a project, there are a few levels for identifying activities. First of all, the high-level requirements are broken down into high-level tasks or deliverables.
Then, based on the task granularity, the high-level tasks/deliverables are broken down into activities and presented in the form of WBS (Work Breakdown Structure).
In order to manage the project time, it is critical to identify the activity sequence. The activities identified in the previous step should be sequenced based on the execution order.
When sequencing, the activity interdependencies should be considered.
The estimation of amount and the types of resources required for activities is done in this step. Depending on the number of resources allocated for an activity, its duration varies.
Therefore, the project management team should have a clear understanding about the resources allocation in order to accurately manage the project time.
This is one of the key steps in the project planning process. Since estimates are all about the time (duration), this step should be completed with a higher accuracy.
For this step, there are many estimation mechanisms in place, so your project should select an appropriate one.
Most of the companies follow either WBS based estimating or Function Points based estimates in this step.
Once the activity estimates are completed, critical path of the project should be identified in order to determine the total project duration. This is one of the key inputs for the project time management.
In order to create an accurate schedule, a few parameters from the previous steps are required.
Activity sequence, duration of each activity and the resource requirements/allocation for each activity are the most important factors.
In case if you perform this step manually, you may end up wasting a lot of valuable project planning time. There are many software packages, such as Microsoft Project, that will assist you to develop reliable and accurate project schedule.
As part of the schedule, you will develop a Gantt chart in order to visually monitor the activities and the milestones.
No project in the practical world can be executed without changes to the original schedule. Therefore, it is essential for you to update your project schedule with ongoing changes.
Time management is a key responsibility of a project manager. The project manager should equip with a strong skill and sense for time management.
There are a number of time management techniques that have been integrated into the management theories and best practices.
As an example, Agile/Scrum project management style has its own techniques for time management.
In addition, if you are keen on learning time management into greater depths, you can always get into a training course of one of the reputed and respected time management trainers.
There are many logistic elements in a project. Different team members are responsible for managing each element and sometimes, the organization may have a mechanism to manage some logistic areas as well.
When it comes to project workforce management, it is all about managing all the logistic aspects of a project or an organization through a software application. Usually, this software has a workflow engine defined in them. So, all the logistic processes take place in the workflow engine.
Following are the regular and most common types of tasks handled by project workforce management software or a similar workflow engine:
Planning and monitoring the project schedules and milestones.
Planning and monitoring the project schedules and milestones.
Tracking the cost and revenue aspects of projects.
Tracking the cost and revenue aspects of projects.
Resource utilization and monitoring.
Resource utilization and monitoring.
Other management aspects of the project management.
Other management aspects of the project management.
Due to the software use, all of the project workflow management tasks can be fully automated with leaving much for the project managers. This returns high efficiency to the project management when it comes to project tracking purposes.
In addition to different tracking mechanisms, project workforce management software also offer a dashboard for the project team. Through the dashboard, the project team has a glance view of the overall progress of the project elements.
The dashboard is also a great place for the upper management to track the progress of each project during executive meetings.
Most of the times, project workforce management software can work with the existing legacy software systems such as ERP systems. This easy integration allows the organization use a combination of software systems for management purposes.
The traditional management and the project workflow management have significant differences. There are at least three main differences when it comes to operations and management. Following are the three main differences:
The management of all the processes is done through a graphical workflow engine. In this, the users can design, control and audit the different processes involved in the project.
The graphical workflow is quite attractive for the users of the system and allows the users to have a clear idea of the workflow engine.
Project workforce management provides the facility for work breakdown structure and organization of the same. The users can create, manage, edit and report work breakdown structures.
These work breakdown structures are done in different abstraction levels, so the information related to such can be tracked at any level.
Usually, project workforce management has approval hierarchies. Therefore, each workflow created will go through several verifications before it becomes an organizational or project standard. This helps the organization to reduce the inefficiencies of the process, as it is audited by many stakeholders.
In project workforce management software, everything is neatly connected. Once workforce and billing management software are integrated, it provides the organization all the necessary information and management facilities.
Due to the integrated nature of all these processes, the management and tracking functions are centralized. This allows the higher management to have a unified view of the project activities.
Project workflow management is one of the best methods for managing different aspects of project. If the project is complex, then the outcomes from the project workforce management could be more effective.
For simple projects or small organizations, project workflow management may not add much value. This is due to the fact that small organizations or projects do not have a significant overhead when it comes to managing processes.
There are many software systems in the market for project workflow management, but in many cases, organizations are too unique to adopt such ready-made solutions.
Therefore, organization gets software development companies to develop custom project workflow management systems for them. This has proved to be the most suitable way of getting the best project workforce management system acquired for the company.
Since the project management is one of the core functions of a business organization, the project management function should be supported by software. Before software was born, project management was fully done through papers. This eventually produced a lot of paper documents and searching through them for information which was not a pleasant experience.
Once software came available for an affordable cost for the business organizations, software development companies started developing project management software. This became quite popular among all the industries and these software were quickly adopted by the project management community.
There are two types of project management software available for project managers. The first category of such software is the desktop software. Microsoft Project is a good example for this type. You can manage your entire project using MS Project, but you need to share the electronic documents with others, when collaboration is required.
All the updates should be done to the same document by relevant parties time to time. Therefore, such desktop project management software has limitations when it should be updated and maintained by more than one person.
As a solution for the above issue, the web-based project management software was introduced. With this type, the users can access the web application and read, write or change the project management-related activities.
This was a good solution for distributed projects across departments and geographies. This way, all the stakeholders of the project have access to project details at any given time. Specially, this model is the best for virtual teams that operate on the Internet.
When it comes to choosing project management software, there are many things to consider. Not all the projects may utilize all the features offered by project management software.
Therefore, you should have a good understanding of your project requirements before attempting to select one for you. Following are the most important aspects of project management software:
The project management software should facilitate the team collaboration. This means that the relevant stakeholders of the project should be able to access and update the project documents whenever they want to.
Therefore, the project management software should have access control and authentication management in order to grand access levels to the project stakeholders.
Scheduling is one of the main features that should be provided by project management software. Usually, modern project management software provides the ability to draw Gantt charts when it comes to activity scheduling.
In addition to this, activity dependencies can also be added to the schedules, so such software will show you the project critical path and later changes to the critical path automatically.
Baselining is also a useful feature offered by project management software. Usually, a project is basedlined when the requirements are finalized.
When requirements are changed and new requirements are added to the project later, project management team can compare the new schedule with the baseline schedule automatically to understand the project scope and cost deviations.
During the project life cycle, there can be many issues related to project that needs constant tracking and monitoring. Software defects is one of the good examples for this.
Therefore, the project management software should have features to track and monitor the issues reported by various stakeholders of the project.
Project portfolio management is one of the key aspects when an organization has engaged in more than one project. The organization should be able measure and monitor multiple projects, so the organization knows how the projects progress overall.
If you are a small company with only a couple of projects, you may not want this feature. In such case, you should select project management software without project portfolio management, as such features could be quite expensive for you.
A project has many documents in use. Most of these documents should be accessible to the stakeholders of the project. Therefore, the project management software should have a document management facility with correct access control system.
In addition to this, documents need to be versioned whenever they are updated. Therefore, the document management feature should support document versioning as well.
Resource management of the project is one of the key expectations from project management software. This includes both human resources and other types.
The project management software should show the utilization of each resource throughout the entire project life cycle.
Modern project management practice requires the assistance of project management software. The modern project management practice is complicated to an extent that it cannot operate without the use of software.
When choosing the correct project management software for your purpose, you need to evaluate the characteristics of software and match with your project management requirements.
Never choose one with more feature than you require, as usually project management software come with a high price tag. In addition, having more than the required features could make confusions when using the software in practice.
Quality is an important factor when it comes to any product or service. With the high market competition, quality has become the market differentiator for almost all products and services.
Therefore, all manufacturers and service providers out there constantly look for enhancing their product or the service quality.
In order to maintain or enhance the quality of the offerings, manufacturers use two techniques, quality control and quality assurance. These two practices make sure that the end product or the service meets the quality requirements and standards defined for the product or the service.
There are many methods followed by organizations to achieve and maintain required level of quality. Some organizations believe in the concepts of Total Quality Management (TQM) and some others believe in internal and external standards.
The standards usually define the processes and procedures for organizational activities and assist to maintain the quality in every aspect of organizational functioning.
When it comes to standards for quality, there are many. ISO (International Standards Organization) is one of the prominent bodies for defining quality standards for different industries.
Therefore, many organizations try to adhere to the quality requirements of ISO. In addition to that, there are many other standards that are specific to various industries.
As an example, SEI-CMMi is one such standard followed in the field of software development.
Since standards have become a symbol for products and service quality, the customers are now keen on buying their product or the service from a certified manufacturer or a service provider.
Therefore, complying with standards such as ISO has become a necessity when it comes to attracting the customers.
Many people get confused between quality control (QC) and quality assurance (QA). Let's take a look at quality control function in high-level.
As we have already discussed, organizations can define their own internal quality standards, processes and procedures; the organization will develop these over time and then relevant stakeholders will be required to adhere by them.
The process of making sure that the stakeholders are adhered to the defined standards and procedures is called quality control. In quality control, a verification process takes place.
Certain activities and products are verified against a defined set of rules or standards.
Every organization that practices QC needs to have a Quality Manual. The quality manual outlines the quality focus and the objectives in the organization.
The quality manual gives the quality guidance to different departments and functions. Therefore, everyone in the organization needs to be aware of his or her responsibilities mentioned in the quality manual.
Quality Assurance is a broad practice used for assuring the quality of products or services. There are many differences between quality control and quality assurance.
In quality assurance, a constant effort is made to enhance the quality practices in the organization.
Therefore, continuous improvements are expected in quality functions in the company. For this, there is a dedicated quality assurance team commissioned.
Sometimes, in larger organizations, a 'Process' team is also allocated for enhancing the processes and procedures in addition to the quality assurance team.
Quality assurance team of the organization has many responsibilities. First and foremost responsibility is to define a process for achieving and improving quality.
Some organizations come up with their own process and others adopt a standard processes such as ISO or CMMi. Processes such as CMMi allow the organizations to define their own internal processes and adhere by them.
Quality assurance function of an organization uses a number of tools for enhancing the quality practices. These tools vary from simple techniques to sophisticated software systems.
The quality assurance professionals also should go through formal industrial trainings and get them certified. This is especially applicable for quality assurance functions in software development houses.
Since quality is a relative term, there is plenty of opportunity to enhance the quality of products and services.
The quality assurance teams of organizations constantly work to enhance the existing quality of products and services by optimizing the existing production processes and introducing new processes.
When it comes to our focus, we understand that quality control is a product-oriented process. When it comes to quality assurance, it is a process-oriented practice.
When quality control makes sure the end product meets the quality requirements, quality assurance makes sure that the process of manufacturing the product does adhere to standards.
Therefore, quality assurance can be identified as a proactive process, while quality control can be noted as a reactive process.
RACI denotes Responsible, Accountable, Consulted and Informed, which are four parameters used in a matrix used in decision making. RACI chart tool outlines the activities undertaken within an organization to that of the people or roles.
In an organization, people can be allocated or assigned to specific roles for which they are responsible, accountable, consulted or informed.
RACI chart tool is a great tool when it comes to identifying employee roles within an organization. This tool can be successfully used when there is role confusion within the company. Role confusion may lead to unproductive work culture.
RACI chart tool represents four parameters as we have already noted in the Introduction. Following are the meanings for each of these parameters:
Responsible: This is a person, who performs a task or work and he/she is responsible for the work.
Responsible: This is a person, who performs a task or work and he/she is responsible for the work.
Accountable: Primarily the person in charge of the task or work.
Accountable: Primarily the person in charge of the task or work.
Consulted: Person, who gives feedback, contribute as and when required.
Consulted: Person, who gives feedback, contribute as and when required.
Informed: Person in charge who needs to know the action or decision taken.
Informed: Person in charge who needs to know the action or decision taken.
Following are the well-noted benefits of this tool for the business organizations:
Identifying the workload that have been assigned to specific employees or departments
Identifying the workload that have been assigned to specific employees or departments
Making sure that the processes are not overlooked
Making sure that the processes are not overlooked
Ensuring that new recruits are explained of their roles and responsibilities
Ensuring that new recruits are explained of their roles and responsibilities
Finding the right balance between the line and project responsibilities
Finding the right balance between the line and project responsibilities
Redistributing work between groups to get the work done faster
Redistributing work between groups to get the work done faster
Open to resolving conflicts and discussions
Open to resolving conflicts and discussions
Documenting the roles and responsibilities of the people within the organization
Documenting the roles and responsibilities of the people within the organization
Identifying key functions and processes within an organization is the first step towards using the RACI chart tool. Then, the organization needs to outline the activities that take place and should avoid any miscellaneous activities.
Following are the detailed steps for using RACI chart tool:
Explain each activity that had taken place.
Explain each activity that had taken place.
Create phrases to indicate the result of the decision made.
Create phrases to indicate the result of the decision made.
Decisions and activities need to be applied to the role rather than targeting the person.
Decisions and activities need to be applied to the role rather than targeting the person.
Create a matrix, which represents the roles and activities and enter the RACI Code created.
Create a matrix, which represents the roles and activities and enter the RACI Code created.
Once all the relevant data have been collated and input onto the RACI chart tool, any discrepancies need to be resolved.
The primary reason for creating a RACI chart tool is to resolve organizational issues. It looks at three main factors:
Role conception: The attitude or thinking of people towards their work roles
Role conception: The attitude or thinking of people towards their work roles
Role expectation: The expectation of a person with regards to another person's job role.
Role expectation: The expectation of a person with regards to another person's job role.
Role behavior: The activities of people in their job function.
Role behavior: The activities of people in their job function.
These three concepts help management to identify the misconceptions that people have towards their job roles.
Although role confusion can be solved using RACI chart tool, it is always a good idea to identify the reasons behind such confusion. This helps the organization to avoid such situations occurring in the future.
Following are some of the reasons for role confusion:
Improper balance of work
Improper balance of work
Idle time
Idle time
Passing on the ball, being irresponsible
Passing on the ball, being irresponsible
Confused as to who makes the decisions
Confused as to who makes the decisions
Ineffective communications
Ineffective communications
De-motivation
De-motivation
Filling idle time by creating and attending to non-essential time
Filling idle time by creating and attending to non-essential time
Don't care since no one's bothered attitude
Don't care since no one's bothered attitude
RACI chart tool can be successfully used under the following conditions.
For employees to get a clear understanding of the role and responsibilities around the work process.
For employees to get a clear understanding of the role and responsibilities around the work process.
To improve the understanding of function between departments and responsibilities within one's department.
To improve the understanding of function between departments and responsibilities within one's department.
To clearly define the roles and responsibilities of team members, who are working on a project.
To clearly define the roles and responsibilities of team members, who are working on a project.
The first step towards designing RACI chart tool is that the management needs to identify the process or function that faces issues. The process or feature needs to be thoroughly investigated in terms of its requirements and objectives.
The first step towards designing RACI chart tool is that the management needs to identify the process or function that faces issues. The process or feature needs to be thoroughly investigated in terms of its requirements and objectives.
The roles or job functions need to be identified in terms as to which ones will be impacted and who will be implementing the changes.
The roles or job functions need to be identified in terms as to which ones will be impacted and who will be implementing the changes.
The roles to be created will have its owner. The management needs to assign a role to each individual.
The roles to be created will have its owner. The management needs to assign a role to each individual.
Identify who has an R role (responsible) and then it needs to be listed in terms of A, C and I. RACI chart tools do not work in a way that two people will be held responsible (R) for the same thing.
Identify who has an R role (responsible) and then it needs to be listed in terms of A, C and I. RACI chart tools do not work in a way that two people will be held responsible (R) for the same thing.
Review needs to be conducted so that there are no duplicates in the process.
Review needs to be conducted so that there are no duplicates in the process.
RACI chart tool is a useful and effective decision making tool that helps to define roles and responsibilities. This is used to identify inefficiencies of organizational roles.
It helps to resolve any functional issues that arise within departments or between individuals.
The main objective of RACI chart tool is to eliminate role confusions and to be able to deliver the product or service successfully to the customer and contribute to the long-term organizational objectives.
Rewards and recognition are considered powerful tools, which are used by an organization to motivate its employees.
Rewards and recognition are remuneration based systems, which include bonus, perks, allowances and certificates.
Often people are under the impression that companies only offer remuneration-based systems and not recognize the employees' performance. This is not the case.
In an organization, you will find following systems in place to boost motivation in addition to the regular compensation.
Remuneration pay
Remuneration pay
Nonfinancial benefits
Nonfinancial benefits
Share options
Share options
Following are the common methods of rewards that can be found in modern business organizations. Although not all these reward methods are used by the same company, the companies can adopt the best reward methods that suit the company culture and other company goals.
As an example, some companies do like to give all the benefits to the employees as financials, while other companies like giving the employees the other benefits such as insurance, better working environment, etc.
Pay is an essential factor, which is closely related to job satisfaction and motivation. Although pay may not be a reward as this is a static amount, which an employee will be paid every month, it will be considered as a reward if similar work is paid less.
This is similar to that of overtime. However, it is paid to employees if they put in an extra hour of work for working at unsocial hours or for working long hours on top of overtime hours.
Many organizations pay commission to sales staff based on the sales that they have generated. The commission is based on the number of successful sales and the total business revenue that they have made. This is a popular method of incentive.
Bonuses will be paid to employees, who meet their targets and objectives. This is aimed at employees to improve their performance and to work harder.
This is typically paid to employees, who have met or exceeded their targets and objectives. This method of reward can be measured at either team or department level.
Profits related pay is associated with if an organization is incurring a profit situation. If the organization is getting more than the expected profits, then employees receive an additional amount of money that has been defined as a variable component of the salary.
This is very similar to that of profit related pay. This reward is based on the number of sales and total revenue generated by the organization.
Piece rate reward is directly related to output. The employees get paid on the number of 'pieces' that they have produced. These pieces will be closely inspected to make sure that quality standards are being met.
Employees will not always be motivated by monetary value alone. They do require recognition to be motivated and to perform well in their work.
This is a common type of recognition that is aimed at employees to get motivated. Job enrichment allows more challenging tasks to be included in the day-to-day tasks performed by the employee.
Working the same way everyday may prove to be monotonous to the employees. Therefore, there will be a lack of interest and the performance drops.
Unlike job enrichment, job rotation refers to shifting employees between different functions. This will give them more experience and a sense of achievement.
Teamwork is also considered as recognition. Creating teamwork between team members will improve performance at work. Social relationships at work are essential for any organization.
Healthy social relationships are considered as recognition to the employees. This improves their morale and performance.
Empowerment refers to when employees are given authority to make certain decisions. This decision making authority is restricted only to the day-to-day tasks.
By giving employees authority and power can lead to wrong decisions to be made which will cost the company. Empowerment will not relate to day-to-day functioning authority. This will make employees more responsible, vigilant and increase their performance.
Many organizations place a greater emphasis on training. This is considered as recognition for employees. Training could vary from on the job training to personal development training.
Training workshops such as train the trainer or how to become a manager will give employees a chance to switch job roles and this will increase their motivation levels.
This again is an important type of recognition that is given to employees, who perform better. Organizations have introduced award systems such as best performer of the month, etc., and all these will lead employees to perform better.
Rewards and recognitions are equally important when trying to promote performance and morale amongst employees. The above methods can be used to motivate employees.
Since all the methods may not be applicable to the same organization, the organizations should make sure that they choose the best rewards that suit the organization.
When it comes to any type of project, requirement collection plays a key role. Requirements collection is not only important for the project, but it is also important for the project management function.
For the project, understanding what the project will eventually deliver is critical for its success. Through requirements, the project management can determine the end deliveries of the project and how the end deliveries should address client's specific requirements.
Although requirements collection looks quite straightforward; surprisingly, this is one of the project phases where most of the projects start with the wrong foot. In general, majority of the failed projects have failed due to the wrong or insufficient requirements gathering. We will discuss on this in the following section.
Following is an illustration indicating where the requirements collection comes in a project:
Let's take a software development project as an example. Once the project initiation is over, the business analyst team is in a hurry to collect requirements. The BA (business analysts) team use various methods to capture project requirements and then pass the requirements to the project team. Once business requirements are converted into technical requirements, the implementation starts.
Although the above cycle looks quite normal and trouble-free, the reality is somewhat different. In most of the cases, the BA team is unable to capture all the requirements related to the project. They always overlook a portion of requirements. During the construction of the project, usually the client recognizes the requirements gaps of the project.
The project team will have to implement these missing requirements with no additional client payments or with client approved change requests. In case if it was BA team's fault, the service provider may have to absorb the cost for implementing the missing requirements. In such instances, if the effort for missing requirements has a significant impact on the cost of the project, the project may be a financial loss for the service provider.
Therefore, the requirement collection process is the most important phase of any project.
For the purpose of requirements collection, there are a few methods used by the business analysts. These methods usually differ from one project to another and one client organization to another.
Usually requirements for a new system are gathered from the potential end-users of the system. The methods used for gathering requirements from these potential end-users vary depending on the nature of the end-users. As an example, if there is a large number of end-users, then the workshop method can be used for requirements collection.
In this method, all the potential end-users are asked to participate for a workshop. In this workshop, the business analysts do engage with the users and collect the requirements for the new system. Sometimes, the workshop session is video recorded in order to review and capture any user feedback.
If the user base is quite small in number, the business analysts can carry out face-to-face interviews. This is the most effective way of finding all the necessary requirements as the business analyst can have all their questions asked and cross questioned as well.
Questioners can be used effectively for requirements collection process, but this should not be the only method of interacting with the end-users. Questioners should be used as a supporting feature for interviews or a workshop.
In addition to the above methods, there are many other specific methods that can be used for specific conditions.
Following are some of the tips for making the requirements collection process successful:
Never assume that you know customer's requirements. What you usually think, could be quite different to what the customer wants. Therefore, always verify with the customer when you have an assumption or a doubt.
Never assume that you know customer's requirements. What you usually think, could be quite different to what the customer wants. Therefore, always verify with the customer when you have an assumption or a doubt.
Get the end-users involved from the start. Get their support for what you do.
Get the end-users involved from the start. Get their support for what you do.
At the initial levels, define the scope and get customer's agreement. This helps you to successfully focus on scope of features.
At the initial levels, define the scope and get customer's agreement. This helps you to successfully focus on scope of features.
When you are in the process of collecting the requirements, make sure that the requirements are realistic, specific and measurable.
When you are in the process of collecting the requirements, make sure that the requirements are realistic, specific and measurable.
Focus on making the requirements document crystal clear. Requirement document is the only way to get the client and the service provider to an agreement. Therefore, there should not be any gray area in this document. If there are gray areas, consider this would lead to potential business issues.
Focus on making the requirements document crystal clear. Requirement document is the only way to get the client and the service provider to an agreement. Therefore, there should not be any gray area in this document. If there are gray areas, consider this would lead to potential business issues.
Do not talk about the solution or the technology to the client until all the requirements are gathered. You are not in a position to promise or indicate anything to the client until you are clear about the requirements.
Do not talk about the solution or the technology to the client until all the requirements are gathered. You are not in a position to promise or indicate anything to the client until you are clear about the requirements.
Before moving into any other project phases, get the requirements document signed off by the client.
Before moving into any other project phases, get the requirements document signed off by the client.
If necessary, create a prototype to visually illustrate the requirements.
If necessary, create a prototype to visually illustrate the requirements.
Requirement collection is the most important step of a project. If the project team fails to capture all the necessary requirements for a solution, the project will be running with a risk. This may lead to many disputes and disagreements in the future, and as a result, the business relationship can be severely damaged.
Therefore, take requirement collection as a key responsibility of the project team. Until the requirements are signed off, do not promise or comment on the nature of the solution.
Resource leveling is a technique in project management that overlooks resource allocation and resolves possible conflict arising from over-allocation. When project managers undertake a project, they need to plan their resources accordingly.
This will benefit the organization without having to face conflicts and not being able to deliver on time. Resource leveling is considered one of the key elements to resource management in the organization.
An organization starts to face problems if resources are not allocated properly i.e., some resource may be over-allocated whilst others will be under-allocated. Both will bring about a financial risk to the organization.
As the main aim of resource leveling is to allocate resource efficiently, so that the project can be completed in the given time period. Hence, resource leveling can be broken down into two main areas; projects that can be completed by using up all resources, which are available and projects that can be completed with limited resources.
Projects, which use limited resources can be extended for over a period of time until the resources required are available. If then again, the number of projects that an organization undertakes exceeds the resources available, then it's wiser to postpone the project for a later date.
Many organizations have a structured hierarchy of resource leveling. A work-based structure is as follows:
Stage
Phase
Task/Deliverable
All of the above-mentioned layers will determine the scope of the project and find ways to organize tasks across the team. This will make it easier for the project team to complete the tasks.
In addition, depending on the three parameters above, the level of the resources required (seniority, experience, skills, etc.) may be different. Therefore, the resource requirement for a project is always a variable, which is corresponding to the above structure.
The main reason for a project manager to establish dependencies is to ensure that tasks get executed properly. By identifying correct dependencies from that of incorrect dependencies allows the project to be completed within the set timeframe.
Here are some of the constraints that a project manager will come across during the project execution cycle. The constraints a project manager will face can be categorized into three categories.
Mandatory - These constraints arise due to physical limitations such as experiments.
Mandatory - These constraints arise due to physical limitations such as experiments.
Discretionary - These are constraints based on preferences or decisions taken by teams.
Discretionary - These are constraints based on preferences or decisions taken by teams.
External - Often based on needs or desires involving a third party.
External - Often based on needs or desires involving a third party.
For resource leveling to take place, resources are delegated with tasks (deliverables), which needs execution. During the starting phase of a project, idealistically the roles are assigned to resources (human resources) at which point the resources are not identified.
Later, these roles are assigned to specific tasks, which require specialization.
Resource leveling helps an organization to make use of the available resources to the maximum. The idea behind resource leveling is to reduce wastage of resources i.e., to stop over-allocation of resources.
Project manager will identify time that is unused by a resource and will take measures to prevent it or making an advantage out of it.
By resource conflicts, there are numerous disadvantages suffered by the organization, such as:
Delay in certain tasks being completed
Delay in certain tasks being completed
Difficulty in assigning a different resource
Difficulty in assigning a different resource
Unable to change task dependencies
Unable to change task dependencies
To remove certain tasks
To remove certain tasks
To add more tasks
To add more tasks
Overall delays and budget overruns of projects
Overall delays and budget overruns of projects
Critical path is a common type of technique used by project managers when it comes to resource leveling. The critical path represents for both the longest and shortest time duration paths in the network diagram to complete the project.
However, apart from the widely used critical path concept, project managers use fast tracking and crashing if things get out of hand.
Fast tracking - This performs critical path tasks. This buys time. The prominent feature of this technique is that although the work is completed for the moment, possibility of rework is higher.
Fast tracking - This performs critical path tasks. This buys time. The prominent feature of this technique is that although the work is completed for the moment, possibility of rework is higher.
Crashing - This refers to assigning resources in addition to existing resources to get work done faster, associated with additional cost such as labor, equipment, etc.
Crashing - This refers to assigning resources in addition to existing resources to get work done faster, associated with additional cost such as labor, equipment, etc.
Resource leveling is aimed at increasing efficiency when undertaking projects by utilizing the resources available at hand. Proper resource leveling will not result in heavy expenditure.
The project manager needs to take into account several factors and identify critical to non-critical dependencies to avoid any last minute delays of the project deliverables.
Regardless of what you do in an organization, a staff is required in order to execute work tasks and activities. If you are a project manager, you need to have an adequate staff for executing your project activities.
Just having the required number of staff members for your project will not help you to successfully execute the project activities. These staff members selected for your project should have necessary skills to execute the project responsibilities as well. In addition, they should have the necessary motivation and availability as well.
Therefore, staffing of your project should be done methodologically with a proper and accurate plan.
Before you start staffing your project, you need to understand the purpose of your project. First of all, you need to understand the business goals for the project and other related objectives. Without you being clear about the end results, you may not be able to staff the best resources for your project.
Spend some time brainstorming about your project purpose and then try to understand the related staffing requirements. Understand the different skills required for project execution, in order to understand what kind of staff you want.
Be precise when you prepare your staffing management plan. Make your staffing plan in black and white. Do not include things just to make the people happy. Always include the truth in your plan in a bold way. Whenever required, emphasize the roles and responsibilities of the staff and organizational policies as well.
The workforce should be disciplined in order to execute a project successfully. Therefore, you need to include discipline requirements to the staffing plan as well.
When it comes to articulating the plan, you need to use a good template for that. First of all, there are chances that you can find a suitable one from your organization itself. Talk to your peers and see whether there are templates that they have used in the past. In case if your organization has a knowledge management system, search for a template there.
Once you get a good template, articulate everything in simple language. The audience of the plan is the management and the staff. Therefore, articulation should be clear and simple.
Connecting with your staff is the key. By properly connecting, you can measure them for their skills and attitude.
Interviewing the staff members is the best way to properly engaging with them. By doing this, you can measure their skills and you can see whether they are suitable for your project requirements. For interviews, you can come up with an interview schedule and a set of critical questions you may want to ask.
In case there are things you cannot uncover through interviews, ask assistance from HR.
Before you start staffing for the project, you need to know what skills required for your project. This way, you can measure the skills of your potential staff during the interviews. In most instances, you will not find all the staff members with desired skills.
In such cases, you will have to request for trainings from the training department. Get applicable staff members trained on required skills in advance to the project commencement.
Staffing management plan should be crystal clear about the staff rewards as well as the consequences. The plan should illustrate the rewards in detail and how a staff member or the entire staff becomes eligible for rewards.
As an example, early delivery of projects is rewarded by paying a bonus to the staff members, who are involved in the project. This is one of the best ways to keep the staff motivation and focused on the project activities.
In addition to the above areas, there can be additional considerations. One might be the duration of your staffing requirement. It's very rare that a project will require all the staff during the entire project life cycle.
Usually, the staffing requirement varies during different phases of the project. Refer to the following diagram in order to identify the staff variation.
Usually, during the initial phases of the project, the project requires only a limited number of staff members. When it comes to development or construction, it may need a lot. Again, when it reaches the end, it will require a less number of staff.
Staffing management plan for a project plays a critical role in project management. Since resources are the most critical factor for executing the project activities, you should be clear about your staffing requirements.
Once you know what you want, derive the plan to address the same.
When working on a project, there are many people or organizations that are dependent on and/or are affected by the final product or output. These people are the stakeholders of a project.
Stakeholder management involves taking into consideration the different interests and values stakeholders have and addressing them during the duration of the project to ensure that all stakeholders are happy at the end.
This branch of management is important because it helps an organization to achieve its strategic objectives by involving both the external and internal environments and by creating a positive relationship with stakeholders through good management of their expectations.
Stakeholder management is also important because it helps identify positive existing relationships with stakeholders. These relationships can be converted to coalitions and partnerships, which go on to build trust and encourage collaboration among the stakeholders.
Stakeholder management, in a business project sense, works through a strategy. This strategy is created using information gathered through the following processes:
Stakeholder Identification - It is first important to note all the stakeholders involved, whether internal or external. An ideal way to do this is by creating a stakeholder map.
Stakeholder Identification - It is first important to note all the stakeholders involved, whether internal or external. An ideal way to do this is by creating a stakeholder map.
Stakeholder Analysis - Through stakeholder analysis, it is the manager's job to identify a stakeholder's needs, interfaces, expectations, authority and common relationship.
Stakeholder Analysis - Through stakeholder analysis, it is the manager's job to identify a stakeholder's needs, interfaces, expectations, authority and common relationship.
Stakeholder Matrix - During this process, managers position stakeholders using information gathered during the stakeholder analysis process. Stakeholders are positioned according to their level of influence or enrichment they provide to the project.
Stakeholder Matrix - During this process, managers position stakeholders using information gathered during the stakeholder analysis process. Stakeholders are positioned according to their level of influence or enrichment they provide to the project.
Stakeholder Engagement - This is one of the most important processes of stakeholder management where all stakeholders engage with the manager to get to know each other and understand each other better, at an executive level.
This communication is important for it gives both the manager and stakeholder a chance to discuss and concur upon expectations and most importantly agree on a common set of Values and Principals, which all stakeholders will stand by.
Stakeholder Engagement - This is one of the most important processes of stakeholder management where all stakeholders engage with the manager to get to know each other and understand each other better, at an executive level.
This communication is important for it gives both the manager and stakeholder a chance to discuss and concur upon expectations and most importantly agree on a common set of Values and Principals, which all stakeholders will stand by.
Communicating Information - Here, expectations of communication are agreed upon and the manner in which communication is managed between the stakeholders is established, that is, how and when communication is received and who receives it.
Communicating Information - Here, expectations of communication are agreed upon and the manner in which communication is managed between the stakeholders is established, that is, how and when communication is received and who receives it.
Stakeholder Agreements - This is the Lexicon of the project or the objectives set forth. All key stakeholders sign this stakeholder agreement, which is a collection of all the agreed decisions.
Stakeholder Agreements - This is the Lexicon of the project or the objectives set forth. All key stakeholders sign this stakeholder agreement, which is a collection of all the agreed decisions.
In today's modern management project practice, managers and stakeholders favor an honest and transparent stakeholder relationship.
Some organizations still endure poor stakeholder management practices and this arises because of:
Communicating with a stakeholder too late. This does not allow for ample revision of stakeholder expectations and hence their views may not be taken into consideration.
Communicating with a stakeholder too late. This does not allow for ample revision of stakeholder expectations and hence their views may not be taken into consideration.
Inviting stakeholders to take part in the decision making process too early. This results in a complicated decision making process.
Inviting stakeholders to take part in the decision making process too early. This results in a complicated decision making process.
Involving the wrong stakeholders in a project. This results in a reduction in the value of their contribution and this leads to external criticism in the end.
Involving the wrong stakeholders in a project. This results in a reduction in the value of their contribution and this leads to external criticism in the end.
The management does not value the contribution of stakeholders. Their participation is viewed as unimportant and inconsequential.
The management does not value the contribution of stakeholders. Their participation is viewed as unimportant and inconsequential.
Whatever way stakeholder management is approached, it should be done attentively so as to achieve the best results.
Insufficient involvement and ineffective communication with stakeholders can lead to project failure. The following are a few ideas that can be used to achieve good stakeholder management practices:
Management and stakeholders should work together to draw up a realistic list of goals and objectives. Engaging stakeholders will improve business performance and they take an active interest in the project.
Management and stakeholders should work together to draw up a realistic list of goals and objectives. Engaging stakeholders will improve business performance and they take an active interest in the project.
Communication is the key. It is important for stakeholders and management to communicate throughout the course of the project on a regular basis. This ensures that both parties will be actively engaged and ensure smooth sailing during the course of the project.
Communication is the key. It is important for stakeholders and management to communicate throughout the course of the project on a regular basis. This ensures that both parties will be actively engaged and ensure smooth sailing during the course of the project.
Agreeing on deliverables is important. This makes sure there is no undue disappointment at the end. Prototypes and samples during the course of the project helps stakeholders have a clear understanding regarding the end project.
Agreeing on deliverables is important. This makes sure there is no undue disappointment at the end. Prototypes and samples during the course of the project helps stakeholders have a clear understanding regarding the end project.
In conclusion, in order to achieve an outcome from the projects, good stakeholder management practices are required. Stakeholder management is the effective management of all participants in a project, be it external or internal contributors.
Arguably, the most important element in stakeholder management is communication where a manager has to spend his 99% time in doing meetings, checking and replying e-mails and updating and distributing reports, etc.
When it comes to implementing or constructing large and complex systems (such as an enterprise software system), the work requirements and conditions should be properly documented. Statement of Work (SOW) is such document that describes what needs to be done in the agreed contract.
Usually, the SOW is written in a precise and definitive language that is relevant to the field of business. This prevents any misinterpretations of terms and requirements.
An SOW covers the work requirements for a specific project and addresses the performance and design requirements at the same time.
Whenever requirements are detailed or contained within a supplementary document, SOW makes reference to the specific document.
The SOW defines the scope and the working agreements between two parties, typically between a client and a service provider. Therefore, SOW carries a legal gravity as well.
The main purpose of a SOW is to define the liabilities, responsibilities and work agreements between clients and service providers.
A well-written SOW will define the scope of the engagement and Key Performance Indicators (KPIs) for the engagement.
Therefore, the KPIs can be used to determine whether the service provider has met conditions of the SOW and use it as a baseline for future engagements.
SOW contains all details of non-specifications requirements of the contractor or service provider's effort. Whenever specifications are involved, the references are made from SOW to specific specification documents.
These specification documents can be functional requirements or non-functional requirements.
Functional requirements (in a software system) define how the software should behave functionally and non-functional requirements detail other characteristics of the software such as performance, security, maintainability, configuration management, etc.
The SOW formats differ from one industry to another. Regardless of the industry, some key areas of the SOW are common. Following are the commonly addressed areas in a SOW:
This section describes the work to be done in a technical manner. If the system to be built is a software system, this section defines the hardware and software requirements along with the exact work to be done in terms of the final system.
If there is anything 'out of scope', those areas are also mentioned under a suitable subheading.
The location where the work is performed is mentioned under this section. This section also details the hardware and software specifications. In addition to that, a description about human resources and how they work are addressed here.
This defines the timeline allocated for the projects. It includes the development time, warranty time and maintenance time. In addition to calendar time, the man days (total effort) required to complete the project is also noted.
This section of the SOW describes the deliveries and the due dates for the deliveries.
The standards (internal or external) are defined in this section. All deliveries and work done should comply with the standards defined in this section of the document.
This section defines the minimum requirements for accepting deliverables. It also describes the criteria used for acceptance.
There are a number of engagement models when it comes to contracting a service provider.
In the domain of software development, there are two distinct contract models, fixed bid and a retainer.
In fixed bid, the project cost is a constant and it is up to the service provider to optimize the resource allocation in order to maintain the profit margins.
The client does not worry about the number of resources, as long as the delivery schedule is met. In the retainer model, the client pays for the number of resources allocated to the project.
Since SOW is an integrated part of a project, almost all senior members of the project team should become aware of terms and conditions of the SOW. Sometimes, especially in software development projects, a penalty is applied if the delivery dates are missed. Therefore, everyone should be aware of such demanding terms of a SOW.
SOW is a critical document for project management. It defines the scope of the work and the work agreements. Therefore, all stakeholders of the project should have a thorough understanding of the SOW of the project and adhere to it.
Whatever kind of job one is involved in, you would always find several factors that lead to severe stress.
It is not uncommon today, with everyone worrying about whether the state of the economy and high employment rates would mean that they are the next to losing their jobs. Like any other management technique, stress management too is very vital for the success of any organization.
If the employees of an organization are unable to work efficiently and be productive, it is the organization that would eventually collapse. It is therefore essential that stress management techniques are understood by all the stakeholders of any organization.
It isn't easy to point on just one or two causes of stress. There are several factors that could contribute towards a person suffering from all sorts of stress.
You must understand what causes stress if you are to efficiently try and reduce stress from your lifestyle.
Most often, employees find themselves in a state of confusion as to what their job entails and they may even worry as to whether they might lose their jobs given the current economic situation. This could lead to a lot of stress in the workplace.
Increased pressure from employers could also make an employee work too hard and maybe even work overtime in an attempt to impress the employer or outdo another employee.
There are of course other reasons that could contribute to individual employees suffering from severe stress outside the workplace such as family problems, health-related issues and so on.
Failure to understand and eliminate these elements that cause the stress could eventually lead to dire consequences. These elements are generally known as stressors and are found in plenty in the workplace.
It is not only the employees, who need to identify these stressors, but also the organization itself would need to take relevant steps.
It is of utmost importance that an organization takes this issue seriously. The organization can help reduce stress by:
Reducing the number of hours for which their employees would have to work per week. This will, in the long run, contribute to a more efficient functioning of the organization, as employees would have more time to rest at home and will come back the next day feeling refreshed.
Working hours should be flexible. This may also include shifts and the rotation of employees.
Reducing the number of hours for which their employees would have to work per week. This will, in the long run, contribute to a more efficient functioning of the organization, as employees would have more time to rest at home and will come back the next day feeling refreshed.
Working hours should be flexible. This may also include shifts and the rotation of employees.
A tried and tested technique that many organizations have begun using is the provision of lounges and other recreational facilities to help employees relax during the day should they require some time off.
You may even choose to add refreshments and a TV so that they could forget all the worries of work for a few minutes. Investing in such facilities is a great idea for any organization. You may also allow them to take more holidays throughout the year to ensure that they have a good break.
A tried and tested technique that many organizations have begun using is the provision of lounges and other recreational facilities to help employees relax during the day should they require some time off.
You may even choose to add refreshments and a TV so that they could forget all the worries of work for a few minutes. Investing in such facilities is a great idea for any organization. You may also allow them to take more holidays throughout the year to ensure that they have a good break.
Female employees may find that they do not have enough time to spend with their newborn if they have just had a baby.
You should make allowance for such situations. Providing longer maternity leave could help your female employee to come back to work without having too much on her mind with regard to the baby and any postnatal depression.
Another idea would be to provide childcare facilities at the office so that mothers with young children could peep in and ensure their kids are okay every few hours.
Female employees may find that they do not have enough time to spend with their newborn if they have just had a baby.
You should make allowance for such situations. Providing longer maternity leave could help your female employee to come back to work without having too much on her mind with regard to the baby and any postnatal depression.
Another idea would be to provide childcare facilities at the office so that mothers with young children could peep in and ensure their kids are okay every few hours.
As an employee, you should also make it a point to occasionally have a casual chat with your employees to ensure that they are satisfied with their jobs and have no issues at work.
You should also encourage them and appreciate and praise him/her for tasks carried out very well. This would reduce any worries they may have of the risks of losing their jobs and help them to feel more secure.
As an employee, you should also make it a point to occasionally have a casual chat with your employees to ensure that they are satisfied with their jobs and have no issues at work.
You should also encourage them and appreciate and praise him/her for tasks carried out very well. This would reduce any worries they may have of the risks of losing their jobs and help them to feel more secure.
If you are suffering from stress and have identified some of the causes, you should try different techniques to help you cope with the pressure or problems that you face.
Being positive and remaining calm would take you a very long way. Try not to worry about insignificant matters.
If you have any queries or any work-related problems, you should always take it up with your employer and try and get the issue sorted out.
It is important to keep in mind that you should take regular breaks while at work and even after you get home.
You can relieve yourself of most of the stress by taking part in relaxing activities, be it yoga or simply curling up on the couch with a good book and a cup of coffee.
Create a schedule and plan out how you would balance both your work life and family life without letting one overtake the other.
You would find that you are more relaxed this way and would actually look forward to going to work the next day.
Of course, nothing can beat a good night's sleep and a healthy lifestyle and diet.
Although most work-related worries may seem too huge to shake off, once you master the art of coping with stress and are able to get rid of any negative thoughts, you would find that peace would come to you naturally.
This is a systematic process, which encourages participants to actively involve by contributing ideas in a non critical or non-evaluative environment.
Structured brainstorming sessions are undertaken by organizations to find solution to problems that persists in a work environment. Many successful organizations use structured brainstorming as key tool when it comes to decision making.
The primary benefit of structured brainstorming is that it's a collaboration of ideas. However, there's a difference between structured brainstorming and unstructured brainstorming.
In structured brainstorming, the participants are given guidelines and rules to follow, so that the input from the sessions is in an orderly manner and constructive.
When it comes to unstructured brainstorming, there are many ideas by participants, but the brainstorming session may not be leading towards any specific goal.
The benefits gained from structured brainstorming are as follows:
A collection of ideas from the team members with regards to a particular issue or a problem will prove to be more successful.
A collection of ideas from the team members with regards to a particular issue or a problem will prove to be more successful.
Opens up a new culture within the organization where team members are free to voice their ideas.
Opens up a new culture within the organization where team members are free to voice their ideas.
It further prevents dominant team members from taking the lead and giving the rest of the team members an unfair chance.
It further prevents dominant team members from taking the lead and giving the rest of the team members an unfair chance.
Promotes synergy among team members.
Promotes synergy among team members.
Helps the team members to come up with ideas to achieve the mission at hand.
Helps the team members to come up with ideas to achieve the mission at hand.
Structured brainstorming can prove to be difficult as input comes from various team members. Hence, the following steps can be followed to ensure that constructive results can be obtained at the end.
State clearly the objective/theme behind the structured brainstorming. Make sure that each participant is fully aware of what is expected from the brainstorming session. This will save time and energy of the team.
State clearly the objective/theme behind the structured brainstorming. Make sure that each participant is fully aware of what is expected from the brainstorming session. This will save time and energy of the team.
Give each team member a chance to demonstrate or voice his/her idea.
Give each team member a chance to demonstrate or voice his/her idea.
During structured brainstorming, advise that team members are not allowed to criticize one another's opinion or idea. This promotes freedom of sharing one's idea without hesitation.
During structured brainstorming, advise that team members are not allowed to criticize one another's opinion or idea. This promotes freedom of sharing one's idea without hesitation.
Repeat the round until the team members do not have any more ideas or solutions.
Repeat the round until the team members do not have any more ideas or solutions.
Review the input from each team member and discard any duplicate input.
Review the input from each team member and discard any duplicate input.
A bad structured brainstorming session will cost your organization money, energy and time if the objective of the brainstorming session is not met. This may cause detrimental factors, which trigger to loss of projects, etc.
Hence, here are some methods for successful brainstorming to be used in your organization.
Focus is crucial when it comes to structured brainstorming session. Sharpen the concentration levels of the participants. You can use some exercises at the beginning of the session in order to increase the focus of the participants.
Focus is crucial when it comes to structured brainstorming session. Sharpen the concentration levels of the participants. You can use some exercises at the beginning of the session in order to increase the focus of the participants.
Instead of writing down arbitrary rules, positivity with playfulness helps.
Instead of writing down arbitrary rules, positivity with playfulness helps.
State the number of ideas.
State the number of ideas.
Build and jump.
Build and jump.
Make the space remember.
Make the space remember.
Stretch mental muscles.
Stretch mental muscles.
Get practical.
Get practical.
Talk and brainstorm about all the possibilities/causes etc., for the problem at hand. Never miss an idea. Have someone recording the brainstorming session.
SWOT Analysis & PEST Analysis are very effective tools for structured brainstorming.
SWOT analysis is a useful tool when it comes to decision making. SWOT stands for Strengths, Weakness, Opportunities and Threats. Brainstorming sessions often use SWOT as an analysis tool for reviewing strategies. SWOT analysis is used to assess the following factors:
Market capitalization
Market capitalization
Sales distribution methods
Sales distribution methods
A brand or a product
A brand or a product
A business idea
A business idea
A strategy e.g., entering new markets
A strategy e.g., entering new markets
A department of the organization
A department of the organization
PEST analysis refers to Political, Economical, Social and Technology. PEST analysis is also often used in brainstorming sessions to understand the market position of an organization. PEST can be used under the following reasons:
An organization analyzing its market
An organization analyzing its market
A product accessing its market
A product accessing its market
Assessing a particular brand in relation to a market
Assessing a particular brand in relation to a market
A newly venturing business
A newly venturing business
For new strategies based on entering a market
For new strategies based on entering a market
For an acquisition
For an acquisition
For an investment opportunity
For an investment opportunity
Once you have completed the brainstorming session, the following needs to be done:
Reduce the list of ideas given based on the agreed priority
Reduce the list of ideas given based on the agreed priority
Mix the points, which are similar in nature together
Mix the points, which are similar in nature together
Discussion is crucial, merits to be given for each feedback
Discussion is crucial, merits to be given for each feedback
Eradicate ideas that are not relevant to the topic
Eradicate ideas that are not relevant to the topic
Give the team members a chance to jot down ideas if they have any and communicate later
Give the team members a chance to jot down ideas if they have any and communicate later
Structured brainstorming is a technique used to generate ideas, which can help to solve a problem. Structured brainstorming helps to encourage creative thinking and enthusiasm between team members.
It also encourages freewill to accept each other's thoughts.
Succession planning is one of the most critical functions of an organization. This is the process that identifies the critical and core roles of an organization and identifies and assesses the suitable candidates for the same.
The succession planning process ramps up potential candidates with appropriate skills and experiences in an effort to train them to handle future responsibilities in their respective roles.
Succession planning is applicable for all critical roles in the organization. The upper management of each practice or department is responsible of coming up with a suitable succession plan for each core position under his or her department.
There are four main important steps in planning for succession.
This is one of the key steps of the succession planning. Hiring the right and skilled employees is the key to growing human resources in the organization. Sometimes, some companies require a paradigm shift in order to retain in the business.
In such cases, the organization requires to let go or redefine the roles and responsibilities of the portion of existing staff. Then, the organization hires the new blood in order to acquire the required skills and expertise.
When it comes to succession planning, organization should always hire people, who will have the potential to go up the corporate ladder.
All the organizational training can come under two categories; skills training and management training.
Skills training: Employees are trained to enhance their skills, so their day-to-day work becomes easy.
Skills training: Employees are trained to enhance their skills, so their day-to-day work becomes easy.
Management training: A selected set of employees undergoes training where they are trained to take over management responsibilities.
Management training: A selected set of employees undergoes training where they are trained to take over management responsibilities.
Based on their performance, the employees, who have the potential to become leaders in the organization should be appropriately compensated.
These employees should be considered for fast track promotions and special compensation benefits.
Talent management is one of the key factors that contribute for succession planning. The right candidate will have the required level of skills in order to execute responsibilities of the new role.
The upper management and mentors of the staff member should always make sure that the employee is constantly enhancing his/her skills by accepting challenging responsibilities.
Succession planning has many activities involved. Some of these activities are sequential and others can be performed in parallel to others.
Following are the core activities involved in succession planning.
Identification of the critical roles for the growth of the company. There are many tools such as Pareto charts in case if you need any assistance in prioritizing the roles.
Identification of the critical roles for the growth of the company. There are many tools such as Pareto charts in case if you need any assistance in prioritizing the roles.
Identification of gaps in the succession planning process. In this step, the process of succession planning is analyzed for its strength. If there are weaknesses and gaps, they will be methodologically addressed.
Identification of gaps in the succession planning process. In this step, the process of succession planning is analyzed for its strength. If there are weaknesses and gaps, they will be methodologically addressed.
In this step, the possible candidates for the potential role will be identified. This will be done by analyzing their past performances as well and for some other characteristics such as age.
In this step, the possible candidates for the potential role will be identified. This will be done by analyzing their past performances as well and for some other characteristics such as age.
All short-listed employees for potential roles will be then educated about their career path. The employees should understand that they are being trained and their skills are being developed in order to fill critical roles in the organization.
All short-listed employees for potential roles will be then educated about their career path. The employees should understand that they are being trained and their skills are being developed in order to fill critical roles in the organization.
When it comes to training and developing people, they should be developed for the positions that exist in the company as well as the positions (roles) that will be introduced in the future.
When it comes to training and developing people, they should be developed for the positions that exist in the company as well as the positions (roles) that will be introduced in the future.
Have a clear understanding of the timeline required for filling key roles. For this, an understanding of when key roles will be vacant is necessary.
Have a clear understanding of the timeline required for filling key roles. For this, an understanding of when key roles will be vacant is necessary.
Conduct regular meetings on the succession plans of the organization.
Conduct regular meetings on the succession plans of the organization.
Identify top players of every department and make necessary arrangements to keep them in the company for a long time.
Identify top players of every department and make necessary arrangements to keep them in the company for a long time.
Review past succession that took place based on the succession plan and review success. If there are issues, make necessary changes to the succession plan.
Review past succession that took place based on the succession plan and review success. If there are issues, make necessary changes to the succession plan.
Every organization requires succession planning. By succession planning, organization's key roles are constantly maintained with talented people, so organizations can maintain its strength.
When selecting people for key roles, their adherence to organization's mission and vision is important. This is how visionary leaders are sprung in organizations with commitment for the company's growth.
In an organization, if a product is manufactured using raw materials from various suppliers and if these products are sold to customers, a supply chain is created.
Depending on the size of the organization and the number of products that are manufactured, a supply chain may be complex or simple.
Supply Chain Management refers to the management of an interconnected network of businesses involved in the ultimate delivery of goods and services to customers.
It entails the storage and transport of raw materials, the process of inventory and the storage and transportation of the final goods from the point of manufacture to the point of consumption.
Customer - The start of the supply chain is the customer. The customer decides to purchase a product and in turn contacts the sales department of a company. A sales order is completed with the date of delivery and the quantity of the product requested. It may also include a segment for the production facility depending on whether the product is available in stock or not.
Customer - The start of the supply chain is the customer. The customer decides to purchase a product and in turn contacts the sales department of a company. A sales order is completed with the date of delivery and the quantity of the product requested. It may also include a segment for the production facility depending on whether the product is available in stock or not.
Planning - Once the customer has made his/her sales order, the planning department will create a production plan to produce the product adhering to the needs of the customer. At this stage, the planning department will be aware of raw materials needed.
Planning - Once the customer has made his/her sales order, the planning department will create a production plan to produce the product adhering to the needs of the customer. At this stage, the planning department will be aware of raw materials needed.
Purchasing - If raw materials are required, the purchasing department will be notified and they in turn send purchasing orders to the suppliers asking for the deliverance of a specific quantity of raw materials on the required date.
Purchasing - If raw materials are required, the purchasing department will be notified and they in turn send purchasing orders to the suppliers asking for the deliverance of a specific quantity of raw materials on the required date.
Inventory - Once the raw materials have been delivered, they are checked for quality and accuracy and then stored in a warehouse till they are required by the production department.
Inventory - Once the raw materials have been delivered, they are checked for quality and accuracy and then stored in a warehouse till they are required by the production department.
Production - Raw materials are moved to the production site, according to the specifics laid out in the production plan. The products required by the customer are now manufactured using the raw materials supplied by the suppliers. The completed products are then tested and moved back to the warehouse depending on the date of delivery required by the customer.
Production - Raw materials are moved to the production site, according to the specifics laid out in the production plan. The products required by the customer are now manufactured using the raw materials supplied by the suppliers. The completed products are then tested and moved back to the warehouse depending on the date of delivery required by the customer.
Transportation - When the finished product is moved into storage, the shipping department or the transportation department determines when the product leaves the warehouse to reach the customer on time.
Transportation - When the finished product is moved into storage, the shipping department or the transportation department determines when the product leaves the warehouse to reach the customer on time.
In order to make sure that the above supply chain is running smoothly and also to ensure maximum customer satisfaction at the lowest possible cost, organizations adopt supply chain management processes and various technologies to assist in these processes.
There are three levels of activities Supply Chain Management in that different departments of an organization focus on to achieve the smooth running of the supply chain. They are:
Strategic - At this level, senior management is involved in the supply chain process and makes decisions that concern the entire organization. Decisions made at this level include the size and site of the production area, the collaborations with suppliers, and the type of that product that is going to be manufactured and so forth.
Strategic - At this level, senior management is involved in the supply chain process and makes decisions that concern the entire organization. Decisions made at this level include the size and site of the production area, the collaborations with suppliers, and the type of that product that is going to be manufactured and so forth.
Tactical - Tactical level of activity focuses on achieving lowest costs for running the supply chain. Some of the ways this is done is by creating a purchasing plan with a preferred suppliers and working with transportation companies for cost effective transport.
Tactical - Tactical level of activity focuses on achieving lowest costs for running the supply chain. Some of the ways this is done is by creating a purchasing plan with a preferred suppliers and working with transportation companies for cost effective transport.
Operational - At the operational level, activity decisions are made on a day-to-day basis and these decisions affect how the product shifts along the supply chain. Some of the decisions taken at this level include taking customer orders and the movement of goods from the warehouse to the point of consumption.
Operational - At the operational level, activity decisions are made on a day-to-day basis and these decisions affect how the product shifts along the supply chain. Some of the decisions taken at this level include taking customer orders and the movement of goods from the warehouse to the point of consumption.
In order to maximize benefits from the supply chain management process, organizations need to invest in technology.
For the optimal working of the supply chain management process, organizations mainly invest in Enterprise Resource Planning suites.
Also, the advancement of Internet technologies allows organizations to adopt Web-based software and Internet communications.
A number of experts in the field of supply chain management have tried to provide theoretical foundations for some areas of supply chain management by adopting organizational theory.
Some of these theories are:
Resource-Based View (RBV)
Transaction Cost Analysis (TCA)
Knowledge-Based View (KBV)
Strategic Choice Theory (SCT)
Agency Theory (AT)
Institutional theory (InT)
Systems Theory (ST)
Network Perspective (NP)
Supply Chain Management is a branch of management that involves suppliers, manufacturers, logistic providers, and most importantly, the customers.
The supply chain management process works through the implication of a strategic plan that ensures the desired end product leaving a customer with maximum satisfaction levels at the lowest possible cost.
The activities or the functions involved in this type of management process are divided into three levels: the strategic level, the tactical level and the operational level.
Team building programs can be found everywhere nowadays. Almost all the business organizations send their project teams for team building programs every now and then. But what is a team building program?
In team building programs, the entire program focuses on improving the group dynamics of the target team. Therefore, first of all, all the team members of the group should be present for such team building programs.
Usually, team building programs take various faces and there are a lot of activities included in such programs. Each activity is focused on improving one or more aspects of teamwork. Take trust as an example.
Trust towards other team members is one of the most important aspects when it comes to teamwork. In a corporate environment, you may not get an opportunity to get to know the other team members in detail and build trust in them.
Therefore, team building programs address this matter during the teamwork activities and improve the trust between the team members. A good example is the blinded guidance.
In this exercise, one person is blind-folded and the other person is supposed to take the blind-folded person through a rough terrain, just by guiding through voice.
If team building programs are very serious, teamwork should also be a serious matter right? Yes, in order to understand the importance of team building programs, one should first understand the value of teamwork.
Following are the benefits gained through team building programs for teamwork:
Improved communication with the rest of the team
Improved communication with the rest of the team
Ease the conflicts and frustrations in the workplace and especially within the team
Ease the conflicts and frustrations in the workplace and especially within the team
Enhanced client relationships and conflict resolution
Enhanced client relationships and conflict resolution
High team productivity through understanding
High team productivity through understanding
Enhanced management and soft skills
Enhanced management and soft skills
Enhanced relationships
Enhanced relationships
In addition to the above benefits, there can be many other enhancements to the team culture. If the team was a brand new team assembled for a new project, the team members will develop a good relationship with others. After a team building program, usually a change in the team dynamics can be observed.
Sending a team for team building programs is not just enough. The management should track the progress of such programs and should send the team again for similar experiences when the effect of the first program is reduced overtime.
The work pressure of the workplace and new comers to the team are two of key reasons for reduced effectiveness that occur overtime.
There are many types of team building programs in use. Each type is suitable for addressing certain types of team building requirements. As an example, sending middle-aged employees to a program designed for youth will not create a great result.
Following are some of the most common types of team building programs:
Corporate conferences
Corporate conferences
Executive team building and guidance programs
Executive team building and guidance programs
Adventure programs
Adventure programs
Outdoor sports
Outdoor sports
Game shows
Game shows
Youth programs
Youth programs
Religious or charity programs sponsored by the organization
Religious or charity programs sponsored by the organization
Management training programs
Management training programs
White-water rafting
White-water rafting
Residential workshops
Residential workshops
There are two main categories of team building programs; internal and external. Internal team building programs are designed usually by the training and development department of the organization. The events may take place in the workplace or at a location outside of the workplace. In these programs, someone from the organization will conduct the training.
For the next category, an external party is invited to do the team building program. This event may also take place inside the workplace or at an outside location.
When it comes to the effectiveness of the team building programs, usually the programs conducted by outside parties at a remote location are quite successful.
The very feeling of being away from the workplace gives the team a fresh state of mind and they are freer to engage with team building activities.
For any team, regardless of what they should be collectively achieved, team building is a key strength. In order to get the best out of a team, the team should go through team building programs.
Although most of the companies try to conduct indoor programs for this purpose, they deliver less effective results compared to team building events done by 3rd party professionals at remote locations.
Motivation plays an impeccably valuable role in any organization. It is a trait that should be instilled in every employee of an organization, despite their designation or responsibilities. Having stated that, it is imperative that senior management looks at ways of increasing team motivation within an organization.
Team structures may vary depending on the function in an organization that is assigned to a group of people to the mere fact of a group of people belonging to an organization.
Whatever the nature of the team formation is, it is important that such groups of people falling into one or more teams act in harmony and in line with an organization's ultimate goals.
On the outset you may feel that some managers really enjoy belittling employees and shouting at them all the time.
Such approach to motivation is guided by the fear factor principal and is a very primary approach; one that we know from our childhood. Therefore, the effects of such negative motivational techniques will surely be effective in short term as against the desired result of long term.
Some managers also tend to set unrealistic goals before their teams in hopes of getting team members to work harder and more effectively.
However, as this delusion takes its stance, employees will become understanding of the unrealistic nature of the goals and also will feel demotivated at the same time due to the lack of achievement orientation.
Since the primary approach of negative motivation techniques have not brought about effective results, more and more managers have now turned to positive motivational techniques.
Guiding a team's motivation based on positive reinforcement involves a few steps:
You will need to understand individual strengths and weaknesses and how these strengths and weaknesses affect the person and his/her team when operating within a team.
You will need to understand individual strengths and weaknesses and how these strengths and weaknesses affect the person and his/her team when operating within a team.
Building self-esteem of both the team and individuals.
Building self-esteem of both the team and individuals.
Assigning value to each team member (e.g., seeking their opinion, sharing information and allowing their contribution to play a role in team decisions).
Assigning value to each team member (e.g., seeking their opinion, sharing information and allowing their contribution to play a role in team decisions).
So you may evaluate an individual's strengths and weaknesses and may falsely conclude that this person will not function effectively within a team due to his/her personal traits.
But unless otherwise you put this person in a team environment and observe the team dynamics, you wouldn't definitely know the outcome. Therefore, the rule of the thumb for any manager is not to isolate their team members due to assumptions that you may hold.
Secondly, it should be noted that people differ from one another. Therefore, when it comes to team motivation, the managers will need to do certain things to balance out negative effects.
You will be dealing with different personalities therefore, although there are set of rules by which a team operates, your diplomacy and flexibility in operation too will contribute to successful team motivation to be retained.
The third factor is not to isolate black sheep. Any family or any organization will have black sheep. These are radical individuals, who seek extra attention.
Therefore, rather than isolating these characters, you will need to be skillful enough to reassure a sense of belonging to such individuals. The truth of the matter is that once such individuals feel secured and important, they will become very loyal to his clan.
A little bit of psychology goes a long way in motivating teams. You do not need to have studied psychology formally to understand the basic concepts.
However, it would come in handy if you have read about a couple of motivational theories and motivational factors that contribute to human dynamics. When you know underlying factors of a certain concept, you will be better able to address the issue.
If you are mentoring a team and if you are trying to build team spirit among the individuals, but if you are not a good spirited individual yourself, it will become extremely difficult for you to get your team to achieve a sense of identity as a team.
So a team should always have someone leading by example in order to become motivated sufficiently.
And lastly but not in the very least, try to strike a balance between work and fun. Every team needs to engage in work and non-work related activities to build up their spirit.
Therefore, make sure that your team received plenty of opportunities to mingle with one another and share a good laughter. Little things go a long way in human dynamics and such spirits built over a cup of coffee will take your organization a long way at the end of the day.
The balance scorecard is used as a strategic planning and a management technique. This is widely used in many organizations, regardless of their scale, to align the organization's performance to its vision and objectives.
The scorecard is also used as a tool, which improves the communication and feedback process between the employees and management and to monitor performance of the organizational objectives.
As the name depicts, the balanced scorecard concept was developed not only to evaluate the financial performance of a business organization, but also to address customer concerns, business process optimization, and enhancement of learning tools and mechanisms.
Following is the simplest illustration of the concept of balanced scorecard. The four boxes represent the main areas of consideration under balanced scorecard. All four main areas of consideration are bound by the business organization's vision and strategy.
The balanced scorecard is divided into four main areas and a successful organization is one that finds the right balance between these areas.
Each area (perspective) represents a different aspect of the business organization in order to operate at optimal capacity.
Financial Perspective - This consists of costs or measurement involved, in terms of rate of return on capital (ROI) employed and operating income of the organization.
Financial Perspective - This consists of costs or measurement involved, in terms of rate of return on capital (ROI) employed and operating income of the organization.
Customer Perspective - Measures the level of customer satisfaction, customer retention and market share held by the organization.
Customer Perspective - Measures the level of customer satisfaction, customer retention and market share held by the organization.
Business Process Perspective - This consists of measures such as cost and quality related to the business processes.
Business Process Perspective - This consists of measures such as cost and quality related to the business processes.
Learning and Growth Perspective - Consists of measures such as employee satisfaction, employee retention and knowledge management.
Learning and Growth Perspective - Consists of measures such as employee satisfaction, employee retention and knowledge management.
The four perspectives are interrelated. Therefore, they do not function independently. In real-world situations, organizations need one or more perspectives combined together to achieve its business objectives.
For example, Customer Perspective is needed to determine the Financial Perspective, which in turn can be used to improve the Learning and Growth Perspective.
From the above diagram, you will see that there are four perspectives on a balanced scorecard. Each of these four perspectives should be considered with respect to the following factors.
When it comes to defining and assessing the four perspectives, following factors are used:
Objectives - This reflects the organization's objectives such as profitability or market share.
Objectives - This reflects the organization's objectives such as profitability or market share.
Measures - Based on the objectives, measures will be put in place to gauge the progress of achieving objectives.
Measures - Based on the objectives, measures will be put in place to gauge the progress of achieving objectives.
Targets - This could be department based or overall as a company. There will be specific targets that have been set to achieve the measures.
Targets - This could be department based or overall as a company. There will be specific targets that have been set to achieve the measures.
Initiatives - These could be classified as actions that are taken to meet the objectives.
Initiatives - These could be classified as actions that are taken to meet the objectives.
The objective of the balanced scorecard was to create a system, which could measure the performance of an organization and to improve any back lags that occur.
The popularity of the balanced scorecard increased over time due to its logical process and methods. Hence, it became a management strategy, which could be used across various functions within an organization.
The balanced scorecard helped the management to understand its objectives and roles in the bigger picture. It also helps management team to measure the performance in terms of quantity.
The balanced scorecard also plays a vital role when it comes to communication of strategic objectives.
One of the main reasons for many organizations to be unsuccessful is that they fail to understand and adhere to the objectives that have been set for the organization.
The balanced scorecard provides a solution for this by breaking down objectives and making it easier for management and employees to understand.
Planning, setting targets and aligning strategy are two of the key areas where the balanced scorecard can contribute. Targets are set out for each of the four perspectives in terms of long-term objectives.
However, these targets are mostly achievable even in the short run. Measures are taken in align with achieving the targets.
Strategic feedback and learning is the next area, where the balanced scorecard plays a role. In strategic feedback and learning, the management gets up-to-date reviews regarding the success of the plan and the performance of the strategy.
Following are some of the points that describe the need for implementing a balanced scorecard:
Increases the focus on the business strategy and its outcomes.
Increases the focus on the business strategy and its outcomes.
Leads to improvised organizational performance through measurements.
Leads to improvised organizational performance through measurements.
Align the workforce to meet the organization's strategy on a day-to-day basis.
Align the workforce to meet the organization's strategy on a day-to-day basis.
Targeting the key determinants or drivers of future performance.
Targeting the key determinants or drivers of future performance.
Improves the level of communication in relation to the organization's strategy and vision.
Improves the level of communication in relation to the organization's strategy and vision.
Helps to prioritize projects according to the timeframe and other priority factors.
Helps to prioritize projects according to the timeframe and other priority factors.
As the name denotes, balanced scorecard creates a right balance between the components of organization's objectives and vision.
It's a mechanism that helps the management to track down the performance of the organization and can be used as a management strategy.
It provides an extensive overview of a company's objectives rather than limiting itself only to financial values.
This creates a strong brand name amongst its existing and potential customers and a reputation amongst the organization's workforce.
The halo effect has a close relationship with marketing. Marketing is the number one field where halo effect is successfully used.
Halo effect simply explains the biasness showed by customers to certain products or services based on some favourable or pleasant experience with some other products or services offered by the same manufacturer.
Let's take an example. Apple introduced the iPod some years ago and it was creative in its functions and design. Apple iPod introduced a gateway to novel thinking and extremely eye-pleasing experience for iPod users.
The positive perception about Apple's iPod then had a positive effect on other Apple products. With the introduction of iPod, Apple noticed a high demand and increased sales for rest of their products.
This is again common in the automotive industry. An automaker may introduce a halo vehicle in order to create positive perception of their products in the hope of increasing sales of their other vehicle models as well. The halo cars are mostly sports cars that are mostly related to eye-pleasing designs, superior performance and technology.
Halo effect has its drawbacks as well. Although one halo product can make a huge difference in sales, one bad product can also ruin the reputation of an entire company. This is the reverse of halo effect.
Toyoto Prius, the hybrid car, is one of the best examples of reverse halo effect in the recent times. Toyota is usually considered as the best quality car manufacturer in Japan.
But recently, an issue cropped up with the latest Prius model where, it had a faulty accelerator pad. Due to this issue, Prius gas pedal could jam once pressed hard and could lead to accidents as well. Once this was uncovered by a few customers, Toyota recalled thousands of Prius cars to replace the faulty gas pedal.
The issue did not stop there. Customers then started noticing similar problems, not essentially related to the gas pedals, in other, more established models, where there were no issues reported earlier. This is an incident describing reverse halo effect. Sometimes, this is also called cannibalization.
Halo effect is best described using the concept of unconscious judgement. When we judge something, we may run through an analysis and critical thinking. But, there is part of judgement which is done unconsciously.
We are not consciously aware of this judgement process. This is why we cannot explain why we are attracted to certain products from certain companies more than the same products from other companies.
The halo effect is one of the best tools for marketing. Marketing concepts and strategies employ the halo effect in order to get the best results when it comes to promoting products and services.
Although a halo product or a service is used for making a positive impact on a customer's mind in order to sell rest of the goods or services, sometimes other techniques are also used. One of the popular tricks is to use 'go green' or 'save environment' themes to create a positive perception among the customers.
The pleasant experience the customer may have with such campaigns may be useful for selling more products and services to them.
Although halo effect is useful and advantageous for businesses, it is not quite beneficial for the end customers. Judging a product or service by some other product or service from the same manufacturer may mislead them in their buying process.
In such cases, people do not assess the pros and cons of the product or the service they want to buy. Instead they allow the perceptions to influence their buying decision.
Are you outsourcing enough? This was one of the main questions asked by management consultants during the outsourcing boom. Outsourcing was viewed as one of the best ways of getting things done for a fraction of the original cost.
Outsourcing is closely related to make or buy decision. The corporations made decisions on what to make internally and what to buy from outside in order to maximize the profit margins.
As a result of this, the organizational functions were divided into segments and some of those functions were outsourced to expert companies, who can do the same job for much less cost.
Make or buy decision is always a valid concept in business. No organization should attempt to make something by their own, when they stand the opportunity to buy the same for much less price.
This is why most of the electronic items manufactured and software systems developed in the Asia, on behalf of the organizations in the USA and Europe.
When you are supposed to make a make-or-buy decision, there are four numbers you need to be aware of. Your decision will be based on the values of these four numbers. Let's have a look at the numbers now. They are quite self-explanatory.
The volume
The fixed cost of making
Per-unit direct cost when making
Per-unit cost when buying
Now, there are two formulas that use the above numbers. They are 'Cost to Buy' and 'Cost to Make'. The higher value loses and the decision maker can go ahead with the less costly solution.
Cost to Buy (CTB) = Volume x Per-unit cost when buying
Cost to Make (CTM) = Fixed costs + (Per-unit direct cost x volume)
There are number of reasons a company would consider when it comes to making in-house. Following are a few:
Cost concerns
Desire to expand the manufacturing focus
Need of direct control over the product
Intellectual property concerns
Quality control concerns
Supplier unreliability
Lack of competent suppliers
Volume too small to get a supplier attracted
Reduction of logistic costs (shipping etc.)
To maintain a backup source
Political and environment reasons
Organizational pride
Following are some of the reasons companies may consider when it comes to buying from a supplier:
Lack of technical experience
Lack of technical experience
Supplier's expertise on the technical areas and the domain
Supplier's expertise on the technical areas and the domain
Cost considerations
Cost considerations
Need of small volume
Need of small volume
Insufficient capacity to produce in-house
Insufficient capacity to produce in-house
Brand preferences
Brand preferences
Strategic partnerships
Strategic partnerships
The make or buy decision can be in many scales. If the decision is small in nature and has less impact on the business, then even one person can make the decision. The person can consider the pros and cons between making and buying and finally arrive at a decision.
When it comes to larger and high impact decisions, usually organizations follow a standard method to arrive at a decision. This method can be divided into four main stages as below.
Team creation and appointment of the team leader
Team creation and appointment of the team leader
Identifying the product requirements and analysis
Identifying the product requirements and analysis
Team briefing and aspect/area destitution
Team briefing and aspect/area destitution
Collecting information on various aspects of make-or-buy decision
Collecting information on various aspects of make-or-buy decision
Workshops on weightings, ratings, and cost for both make-or-buy
Workshops on weightings, ratings, and cost for both make-or-buy
Analysis of data gathered
Analysis of data gathered
Feedback on the decision made
Feedback on the decision made
By following the above structured process, the organization can make an informed decision on make-or-buy. Although this is a standard process for making the make-or-buy decision, the organizations can have their own varieties.
Make-or-buy decision is one of the key techniques for management practice. Due to the global outsourcing, make-or-buy decision making has become popular and frequent.
Since the manufacturing and services industries have been diversified across the globe, there are a number of suppliers offering products and services for a fraction of the original price. This has enhanced the global product and service markets by giving the consumer the eventual advantage.
If you make a make-or-buy decision that can create a high impact, always use a process for doing that. When such a process is followed, the activities are transparent and the decisions are made for the best interest of the company.
The rule of seven is one of the oldest concepts in marketing. Although it is old, it doesn't mean that it is outdated. The rule of seven simply says that the prospective buyer should hear or see the marketing message at least seven times before they buy it from you. There may be many reasons why number seven is used. Why not rule of six or rule of eight?
Traditionally, number seven have been given precedence over other numbers by many cultures. Therefore, you may notice various things coming in number seven.
The important thing in the rule of seven is not the number, but the message. This simply tells you that you need to let the prospect hear and see your marketing message so many times before they buy it. There are many reasons for the need of repetition. Buyers just can't trust you and make the buying decision at the first time you show your message.
So, this simply means that your marketing effort should be repetitive and consistent. You cannot just run a couple of advertisements one time and expect the customers to buy the product. The hidden message of rule of seven is the continuous and repetitive effort that should be put in for marketing.
In order to enhance your marketing through the message of rule of seven, consider the following points:
Today's world is an information world. People are overloaded with information. People have access to the best information source at all times, so you cannot fool them at all.
If you want to convey your marketing message to the people, who have been bombarded with information, you are having tough luck. It is never easy for a person or a company to be heard by the prospective buyers. For this, you may want to use some special tricks and strategies.
Due to the above reason, one should repeat their marketing message. In the first few times, a person will not notice the message. People are usually resistant to marketing messages by nature. Otherwise, people will be overwhelmed by the noise made by the marketing companies.
You have to compete in this noisy market. So, you need to repeat your message until they hear you out.
You may be targeting the exact type of customers for your product or service. But there are chances that they may not need your product yet. In case if they see your marketing message once, they may not remember you when they want to buy the product by next week or next month. Therefore, you need to keep your marketing message in sight. Out of sight for marketing is out of mind.
Let me take an example. Most people do see and hear about great products or service and they make a mental note that they will buy those when they need it. But in reality, when they buy the actual product, they go with the latest marketing message they heard or saw. That's why you need to keep playing your record.
Sometimes, people do not buy things due to the price. This is nothing to do with the price of the product or the service. This simply means that you have not been able to convince the customers fully about the value of your offering.
If someone sees the value of your product or the service, they find a way to buy it. They never worry about the price if it's the right thing they want.
Therefore, through your message, convince them about the value you offer. Through rule of seven, they will hear about the value you offer many times, so the money will not be a problem.
This is the main reason why people do not buy your products or services. Let them know who you are through rule of seven. More they hear about you, higher they will accept you.
Rule of seven is one of the oldest, but practical concepts in marketing. Similarly, rule of seven can be applied to many other areas, where the consumers are concerned. The main learning from rule of seven is the need to repeat what you do.
A virtual team is a team where the primary method of interaction is done through electronic mediums. When it comes to the medium, it could range from e-mail communications to video conferencing.
Some virtual teams do not interact face-to-face (when team members reside in different demographics) and some virtual teams physically meet up occasionally.
Think of an online business for web development. Someone can start such a business and hire developers, QA engineers, UI engineers and project managers from different parts of the globe.
Since web development does not involve in physical delivery of goods and all the deliveries are done electronically, such a company can exist on the Internet.
Team meetings can be held through conference voice calls or video calls. This virtual team can work towards their company goals and act as a single entity just by telecommuting.
There are many reasons for having a virtual team. First of all, it is the technology.
The Internet and related technologies helped enhancing the communication across the globe, where certain industries that do not require the person to be present in physical sense could make much use of it. A good example is a web development team.
Following are some of the top reasons for having virtual teams:
Team members are not located in the same demography.
Team members are not located in the same demography.
The transportation cost and time is quite an overhead.
The transportation cost and time is quite an overhead.
Team members may work in different times.
Team members may work in different times.
The company does not require a physical office, so the logistics and related costs are minimum.
The company does not require a physical office, so the logistics and related costs are minimum.
The type of work done may require high level of creativity, so the employees will have better creativity when they work from a place they are comfortable with (home).
The type of work done may require high level of creativity, so the employees will have better creativity when they work from a place they are comfortable with (home).
There are many types of virtual teams operating at present. Following are a few of those teams:
Entire companies that operate virtually
Entire companies that operate virtually
Tasks teams, responsible of carrying out a specific task
Tasks teams, responsible of carrying out a specific task
Friendship teams such as groups in Facebook or any other social network
Friendship teams such as groups in Facebook or any other social network
Command teams, such as a sales team of a company distributed throughout the US
Command teams, such as a sales team of a company distributed throughout the US
Interest teams where the members share a common interest
Interest teams where the members share a common interest
The technology plays a vital role for virtual teams. Without the use of advanced technology, virtual teams cannot be effective.
The Internet is the primary technology used by the virtual teams. The Internet offers many facilities for the virtual teams. Some of them are:
E-mail
E-mail
VoIP (Voice Over IP) - voice conferencing
VoIP (Voice Over IP) - voice conferencing
Video conferencing
Video conferencing
Groupware software programs such as Google Docs where teams can work collaboratively.
Groupware software programs such as Google Docs where teams can work collaboratively.
Software for conducting demonstrations and trainings such as Microsoft Live Meeting and WebEx.
Software for conducting demonstrations and trainings such as Microsoft Live Meeting and WebEx.
When it comes to the technology, not only the software matters, the virtual teams should be equipped with necessary hardware as well.
As an example, for a video conference, the team members should be equipped with a web camera and a microphone.
First of all, let's look at the advantages of operating as a virtual team.
Team members can work from anywhere and any time of the day. They can choose the place they work based on the mood and the comfort.
Team members can work from anywhere and any time of the day. They can choose the place they work based on the mood and the comfort.
You can recruit people for their skills and suitability to the job. The location does not matter.
You can recruit people for their skills and suitability to the job. The location does not matter.
There is no time and money wasted for commuting and clothing.
There is no time and money wasted for commuting and clothing.
Physical handicaps are not an issue.
Physical handicaps are not an issue.
The company does not have to have a physical office maintained. This reduces a lot of costs to the company. By saving this money, the company can better compensate the employees.
The company does not have to have a physical office maintained. This reduces a lot of costs to the company. By saving this money, the company can better compensate the employees.
Along with the above-mentioned advantages, following are few disadvantages of using virtual team:
Since team members do not frequently meet or do not meet at all, the teamwork spirit may not be present.
Since team members do not frequently meet or do not meet at all, the teamwork spirit may not be present.
Some people prefer to be in a physical office when working. These people will be less productive in virtual environments.
Some people prefer to be in a physical office when working. These people will be less productive in virtual environments.
To work for virtual teams, individuals need to have a lot of self-discipline. If the individual is not disciplined, he or she may be less productive.
To work for virtual teams, individuals need to have a lot of self-discipline. If the individual is not disciplined, he or she may be less productive.
Virtual teams are rising in numbers nowadays. Small technology companies are now adapting virtual team practice for recruiting the best people from all over the globe.
In addition, these companies minimize their operating costs and maximize the profit margins. Additionally, the employees working in virtual teams are at advantages when it comes to working in their own home, own time, and reduction of commuting costs.
Therefore, organizations should look into setting up virtual teams for different tasks whenever possible.
The total productive maintenance (TPM) is a concept for maintenance activities. In the structure, total productive maintenance resembles many aspects of Total Quality Management (TQM), such as employee empowerment, management's commitment, long-term goal settings, etc.
In addition, changes in the staff mindset towards their assignments and responsibilities is one of the other similarities between the two.
Maintenance is one of the key aspects of any organization. When it comes to maintenance, it could represent many domains and areas within a business organization.
In order for an organization to function properly, every running process, activity and resource should be properly maintained for their quality, effectiveness and other productivity factors.
TPM is the process which brings the maintenance aspect of the organization under the spotlight. Although maintenance was regarded as a non-profit activity by the traditional management methodologies, TPM puts a brake on it.
With the emphasis on TPM, downtime for maintenance has become an integral part of the manufacturing or production process itself. Now, the maintenance events are properly scheduled and executed with organized plans.
Maintenance events are no longer squeezed in when there is low production requirements or low material flow in the production lines.
By practicing TPM, the organizations can avoid unexpected interrupts to the production and avoid unscheduled maintenance.
The parent of TPM is TQM. TQM was evolved after the quality concerns the Japan had after the Second World War.
As a part of TQM, the plant maintenance was examined. Although TQM is one of the best quality methodologies for organizations, some of the TQM concepts did not fit or work properly in the area of maintenance.
Therefore, there was a need to develop a separate branch of practices in order to address unique conditions and issues related maintenance. This is how TPM was introduced as a child of TQM.
Although there is a story behind the origin on TPM, the origin itself is disputed by many parties.
Some believe that the concepts of TPM were introduced by American manufacturers about forty years ago and other believe TPM been introduced by the Japanese manufacturers of automotive electrical devices. Regardless of the origin, TPM can now be used across the globe.
Before start implementing TPM concepts for the organization, the employees of the organization should be convinced about the upper management's commitment towards TPM.
This is the first step towards establishing good TPM practices in the organization as shown below.
To emphasize the upper management's commitment, the organization can appoint a TPM coordinator. ,Then it is coordinator's responsibility to educate the staff on TPM concepts.
For this, the TPM coordinator can come up with an education program designed in-house or hired from outside of the organization. Usually, in order to establish TPM concepts in an organization, it takes a long time.
Once the coordinator is convinced about the staff readiness, 'study and action' team are performed. These action teams usually include the people, who directly interface with the maintenance problems.
Machine operators, shift supervisors, mechanics and representatives from the upper management can also be included in these teams. Usually, the coordinator should head each team until the team leads are chosen.
Then, the 'study and action' teams are given the responsibilities of the respective areas. The team are supposed to analyze the problem areas and come up with a set of suggestions and possible solutions.
When it comes to studying the problems at hand, there is a benchmarking process going on in parallel. In benchmarking, the organization identifies certain productivity thresholds defined for certain machinery and processes in the industry.
Once the suitable measure for rectifying the issues are identifies, it is time to apply them in practice. As a safety measure, these measures are only applied to one area or one machine in the production line.
This serves as a pilot program and the TPM team can measure the outcome without jeopardizing the productivity of the entire company. If the outcome is successful, then the same measures are applied to the next set of machines or areas. By following an incremental process, TPM minimizes any potential risks.
Majority of world's first class manufacturing companies follow TPM as an integrated practice in their organizations. Ford, Harley Davidson and Dana Corp. are just a few to mention.
All these first class corporate citizens have reported high rates of productivity enhancements after implementing TPM. As baseline, almost all the companies, who have adopted TPM have reported productivity enhancements close to 50% in many areas.
Today, with increasing competition and tough markets, TPM may decide the success or the failure of a company. TPM has been a proven program for many years and organizations, especially into manufacturing, can adopt this methodology without any risk.
Employees and the upper management should be educated in TPM by the time it is rolled out. The organization should have long-term objectives for TPM.
There are many approaches in the business domain in order to achieve and exceed the quality expectations of the clients.
For this, most companies integrate all quality-related processes and functions together and control it from a central point.
As the name suggests, Total Quality Management takes everything related to quality into consideration, including the company processes, process outcomes (usually products or services) and employees.
The origin of the TQM goes back to the time of the First World War. During the World War I, there have been a number of quality assurance initiatives taken place due to the large-scale manufacturing required for war efforts.
The military fronts could not afford poor quality products and suffered heavy losses due to the poor quality. Therefore, different stakeholders of the war initiated efforts to enhance the manufacturing quality.
First of all, quality inspectors were introduced to the assembly lines in order to inspect the quality. Products below certain quality standard were sent back for fixing.
Even after World War I ended, the practice of using quality inspectors continued in manufacturing plants. By this time, quality inspectors had more time in their hands to perform their job.
Therefore, they came up with different ideas of assuring the quality. These efforts led to the origin of Statistical Quality Control (SQC). Sampling was used in this method for quality control.
As a result, quality assurance and quality control cost reduced, as inspection of every production item was need in this approach.
During the post World War II era, Japanese manufacturers produced poor quality products. As a result of this, Japanese government invited Dr. Deming to train Japanese engineers in quality assurance processes.
By 1950, quality control and quality assurance were core components of Japanese manufacturing processes and employees of all levels within the company adopted these quality processes.
By 1970s, the idea of total quality started surfacing. In this approach, all the employees (from CEO to the lowest level) were supposed to take responsibility of implementing quality processes for their respective work areas.
In addition, it was their responsibility to quality control, their own work.
In TQM, the processes and initiatives that produce products or services are thoroughly managed. By this way of managing, process variations are minimized, so the end product or the service will have a predictable quality level.
Following are the key principles used in TQM:
Top management - The upper management is the driving force behind TQM. The upper management bears the responsibility of creating an environment to rollout TQM concepts and practices.
Top management - The upper management is the driving force behind TQM. The upper management bears the responsibility of creating an environment to rollout TQM concepts and practices.
Training needs - When a TQM rollout is due, all the employees of the company need to go through a proper cycle of training. Once the TQM implementation starts, the employees should go through regular trainings and certification process.
Training needs - When a TQM rollout is due, all the employees of the company need to go through a proper cycle of training. Once the TQM implementation starts, the employees should go through regular trainings and certification process.
Customer orientation - The quality improvements should ultimately target improving the customer satisfaction. For this, the company can conduct surveys and feedback forums for gathering customer satisfaction and feedback information.
Customer orientation - The quality improvements should ultimately target improving the customer satisfaction. For this, the company can conduct surveys and feedback forums for gathering customer satisfaction and feedback information.
Involvement of employees - Pro-activeness of employees is the main contribution from the staff. The TQM environment should make sure that the employees who are proactive are rewarded appropriately.
Involvement of employees - Pro-activeness of employees is the main contribution from the staff. The TQM environment should make sure that the employees who are proactive are rewarded appropriately.
Techniques and tools - Use of techniques and tools suitable for the company is one of the main factors of TQM.
Techniques and tools - Use of techniques and tools suitable for the company is one of the main factors of TQM.
Corporate culture - The corporate culture should be such that it facilitates the employees with the tools and techniques where the employees can work towards achieving higher quality.
Corporate culture - The corporate culture should be such that it facilitates the employees with the tools and techniques where the employees can work towards achieving higher quality.
Continues improvements - TQM implementation is not a one time exercise. As long as the company practices TQM, the TQM process should be improved continuously.
Continues improvements - TQM implementation is not a one time exercise. As long as the company practices TQM, the TQM process should be improved continuously.
Some companies are under the impression that the cost of TQM is higher than the benefits it offers. This might be true for the companies in small scale, trying to do everything that comes under TQM.
According to a number of industrial researches, the total cost of poor quality for a company always exceeds the cost of implementing TQM.
In addition, there is a hidden cost for the companies with poor quality products such as handling customer complaints, re-shipping, and the overall brand name damage.
Total Quality Management is practiced by many business organizations around the world. It is a proven method for implementing a quality conscious culture across all the vertical and horizontal layers of the company.
Although there are many benefits, one should take the cost into the account when implementing TQM.
For small-scale companies, the cost could be higher than the short and mid term benefits.
Project management is a practice that can be found everywhere. Project management does not belong to any specific domain or a field. It is a universal practice with a few basic concepts and objectives.
Regardless of the size of the activities or effort, every 'project' requires project management.
There are many variations of project management that have been customized for different domains. Although the basic principles are the same among any of these variations, there are unique features present to address unique problems and conditions specific to each domain.
There are two main types of project management:
Traditional Project management
Modern Project management
The traditional project management uses orthodox methods and techniques in the management process. These methods and techniques have been evolved for decades and are applicable for most of the domains. But for some domains, such as software development, traditional project management is not a 100% fit.
Therefore, there have been a few modern project management practices introduced to address the shortcomings of the traditional method. Agile and Scrum are two such modern project management methods.
First of all, having an idea of the project management definition is required when it comes to discussing traditional project management. Following is a definition for traditional project management.
PMBOK defines the traditional project management as 'a set of techniques and tools that can be applied to an activity that seeks an end product, outcomes or a service'.
If you Google, you will find hundreds of definitions given by many project management 'gurus' on traditional project management. But, it is always a great idea to stick to the standard definitions such as PMBOK.
You are working for a company where everyone has a desktop or a laptop computer. Currently, the company uses Windows XP as the standard operating system across the company.
Since Windows XP is somewhat outdated and there is a newer version called Windows 7, the management decides on upgrading the OS. The objective of the upgrade is to enhance the productivity and reduce the OS security threats.
If you have one office with about 100 computers, it could be considered as a medium scale project. In case if your company has 10-15 branches, then the project is a large scale one with high complexity. In such case, you will be overwhelmed by the tasks at hand and will feel confused. You may have no clue of how to start and proceed. This is where traditional project management comes in.
Traditional project management has everything required for managing and successfully executing a project like this. Since this type of project does not require any customizations, modern project management methods are not required.
The company can hire or use an existing project manager to manage the OS upgrade project. The project manager will plan the entire project, derive a schedule, and indicate the required resources.
The cost will be elaborated to the higher management, so everyone knows what to expect in the project. Usually, a competent project manager knows what processes and artifacts are required in order to execute a project. There will be frequent updates coming from the project manager to all stakeholders.
In addition to the regular project activities, project manager will attend to risk management as well. If certain risks have an impact on the business processes, the project manager will suggest suitable mitigation criteria.
Traditional project management is a project management approach that will work for most domains and environments. This approach uses orthodox tools and techniques for management and solving problems.
These tools and techniques have been proven for decades, so the outcome of such tools and techniques can be accurately predicted.
When it comes to special environments and conditions, one should move away from traditional project management approach and should look into modern methods that have been specifically developed for such environments and conditions.
Dividing complex projects to simpler and manageable tasks is the process identified as Work Breakdown Structure (WBS).
Usually, the project managers use this method for simplifying the project execution. In WBS, much larger tasks are broken down to manageable chunks of work. These chunks can be easily supervised and estimated.
WBS is not restricted to a specific field when it comes to application. This methodology can be used for any type of project management.
Following are a few reasons for creating a WBS in a project:
Accurate and readable project organization.
Accurate and readable project organization.
Accurate assignment of responsibilities to the project team.
Accurate assignment of responsibilities to the project team.
Indicates the project milestones and control points.
Indicates the project milestones and control points.
Helps to estimate the cost, time and risk.
Helps to estimate the cost, time and risk.
Illustrate the project scope, so the stakeholders can have a better understanding of the same.
Illustrate the project scope, so the stakeholders can have a better understanding of the same.
Identifying the main deliverables of a project is the starting point for deriving a work breakdown structure.
This important step is usually done by the project managers and the subject matter experts (SMEs) involved in the project. Once this step is completed, the subject matter experts start breaking down the high-level tasks into smaller chunks of work.
In the process of breaking down the tasks, one can break them down into different levels of detail. One can detail a high-level task into ten sub-tasks while another can detail the same high-level task into 20 sub-tasks.
Therefore, there is no hard and fast rule on how you should breakdown a task in WBS. Rather, the level of breakdown is a matter of the project type and the management style followed for the project.
In general, there are a few "rules" used for determining the smallest task chunk. In "two weeks" rule, nothing is broken down smaller than two weeks worth of work.
This means, the smallest task of the WBS is at least two-week long. 8/80 is another rule used when creating a WBS. This rule implies that no task should be smaller than 8 hours of work and should not be larger than 80 hours of work.
One can use many forms to display their WBS. Some use tree structure to illustrate the WBS, while others use lists and tables. Outlining is one of the easiest ways of representing a WBS.
Following example is an outlined WBS:
There are many design goals for WBS. Some important goals are as follows:
Giving visibility to important work efforts.
Giving visibility to important work efforts.
Giving visibility to risky work efforts.
Giving visibility to risky work efforts.
Illustrate the correlation between the activities and deliverables.
Illustrate the correlation between the activities and deliverables.
Show clear ownership by task leaders.
Show clear ownership by task leaders.
In a WBS diagram, the project scope is graphically expressed. Usually the diagram starts with a graphic object or a box at the top, which represents the entire project. Then, there are sub-components under the box.
These boxes represent the deliverables of the project. Under each deliverable, there are sub-elements listed. These sub-elements are the activities that should be performed in order to achieve the deliverables.
Although most of the WBS diagrams are designed based on the deliveries, some WBS are created based on the project phases. Usually, information technology projects are perfectly fit into WBS model.
Therefore, almost all information technology projects make use of WBS.
In addition to the general use of WBS, there is specific objective for deriving a WBS as well. WBS is the input for Gantt charts, a tool that is used for project management purpose.
Gantt chart is used for tracking the progression of the tasks derived by WBS.
Following is a sample WBS diagram:
The efficiency of a work breakdown structure can determine the success of a project.
The WBS provides the foundation for all project management work, including, planning, cost and effort estimation, resource allocation, and scheduling.
Therefore, one should take creating WBS as a critical step in the process of project management.
20 Lectures
3.5 hours
Richa Maheshwari
15 Lectures
1 hours
Ajay
15 Lectures
1 hours
Ajay
12 Lectures
2 hours
Richa Maheshwari
12 Lectures
1.5 hours
Richa Maheshwari
15 Lectures
1 hours
Ajay
Print
Add Notes
Bookmark this page | [
{
"code": null,
"e": 3900,
"s": 3682,
"text": "There are a number of costing models used in the domain of business and Activity-Based Costing is one of them. In activity-based costing, various activities in the organization are identified and assigned with a cost."
},
{
"code": null,
"e": 4249,
"s": 3900,
"text": "When it comes to pricing of products and services produced by the company, activity cost is calculated for activities that have been performed in the process of producing the products and services. In other words, activity-based costing assigns indirect costs to direct costs. These indirect costs are also known as overheads in the business world."
},
{
"code": null,
"e": 4557,
"s": 4249,
"text": "Let us take an example. There are a number of activities performed in a business organization and these activities belong to many departments and phases such as planning, manufacturing, or engineering. All these activities eventually contribute to producing products or offering services to the end clients."
},
{
"code": null,
"e": 4899,
"s": 4557,
"text": "Quality Control activity of a garment manufacturing company is one of the fine examples for such an activity. By identifying the cost for the Quality Control function, the management can recognize the costing for each product, service, or resource. This understanding helps the executive management to run the business organization smoothly."
},
{
"code": null,
"e": 4990,
"s": 4899,
"text": "Activity-based costing is more effective when used in long-term rather than in short-term."
},
{
"code": null,
"e": 5361,
"s": 4990,
"text": "When it comes to implementing activity-based costing in an organization, commitment of senior management is a must. Activity-based costing requires visionary leadership that should sustain long-term. Therefore, it is required that the senior management has comprehensive awareness of how activity-based costing works and management's interaction points with the process."
},
{
"code": null,
"e": 5580,
"s": 5361,
"text": "Before implementing activity-based costing for the entire organization, it is always a great idea to do a pilot run. The best candidate for this pilot run is the department that suffers from profit making deficiencies."
},
{
"code": null,
"e": 6026,
"s": 5580,
"text": "Although one might take it as risky, such departments may stand an opportunity to succeed when managed with activity-based costing. Lastly, this would give the organization a measurable illustration of activity-based costing and its success. In case, if no cost saving occurs after the pilot study is implemented, it is most likely that the model has not been properly implemented or the model does not suit the department or company as a whole."
},
{
"code": null,
"e": 6428,
"s": 6026,
"text": "If an organization is planning to impalement activity-based costing, commissioning a core team is of great advantage. If the organization is small in scale, a team can be commissioned with the help of volunteers, who will contribute their time on part-time basis. This team is responsible for identifying and assessing the activities that should be revised in order to optimize the product or service."
},
{
"code": null,
"e": 6582,
"s": 6428,
"text": "The team should ideally consist of professionals from all practices in the organization. However, hiring an external consultant could also become a plus."
},
{
"code": null,
"e": 6900,
"s": 6582,
"text": "When implementing activity-based costing, it is advantageous for an organization to use computer software for calculations and data storage. The computer software can be a simple database that will store the information such as customized ABC software for the organization or a general-purpose off-the-shelf software."
},
{
"code": null,
"e": 7004,
"s": 6900,
"text": "The procedure for successful implementation of activity-based costing in an organization is as follows:"
},
{
"code": null,
"e": 7090,
"s": 7004,
"text": "Identification of a team that is responsible for implementing activity-based costing."
},
{
"code": null,
"e": 7176,
"s": 7090,
"text": "Identification of a team that is responsible for implementing activity-based costing."
},
{
"code": null,
"e": 7275,
"s": 7176,
"text": "The team identifies and assesses the activities that involve in products and services in question."
},
{
"code": null,
"e": 7374,
"s": 7275,
"text": "The team identifies and assesses the activities that involve in products and services in question."
},
{
"code": null,
"e": 7463,
"s": 7374,
"text": "The team selects a subset of activities that should be taken for activity-based costing."
},
{
"code": null,
"e": 7552,
"s": 7463,
"text": "The team selects a subset of activities that should be taken for activity-based costing."
},
{
"code": null,
"e": 7789,
"s": 7552,
"text": "The team identifies the elements of selected activities that cost too much money for the organization. The team should pay attention to detail in this step as many activities may shield their cost and may look innocent from the outside."
},
{
"code": null,
"e": 8026,
"s": 7789,
"text": "The team identifies the elements of selected activities that cost too much money for the organization. The team should pay attention to detail in this step as many activities may shield their cost and may look innocent from the outside."
},
{
"code": null,
"e": 8099,
"s": 8026,
"text": "The fixed costs and variable costs related to activities are identified."
},
{
"code": null,
"e": 8172,
"s": 8099,
"text": "The fixed costs and variable costs related to activities are identified."
},
{
"code": null,
"e": 8239,
"s": 8172,
"text": "The cost information gathered will be entered to the ABC software."
},
{
"code": null,
"e": 8306,
"s": 8239,
"text": "The cost information gathered will be entered to the ABC software."
},
{
"code": null,
"e": 8400,
"s": 8306,
"text": "The software then performs calculations and produces reports to support management decisions."
},
{
"code": null,
"e": 8494,
"s": 8400,
"text": "The software then performs calculations and produces reports to support management decisions."
},
{
"code": null,
"e": 8646,
"s": 8494,
"text": "Based on the reports, management can identify the steps that should be taken to increase profit margins in order to make the activities more efficient."
},
{
"code": null,
"e": 8798,
"s": 8646,
"text": "Based on the reports, management can identify the steps that should be taken to increase profit margins in order to make the activities more efficient."
},
{
"code": null,
"e": 9047,
"s": 8798,
"text": "The management steps and decisions taken after an activity-based costing experience is generally known as Activity-Based Management. In this process, the management makes business decisions to optimize certain activities and let some activities go."
},
{
"code": null,
"e": 9300,
"s": 9047,
"text": "Sometimes, organizations face the risk of spending too much time, money and resources on gathering and analysing data required for activity-based costing model. This can eventually lead to frustration and the organization may give up on ABC eventually."
},
{
"code": null,
"e": 9685,
"s": 9300,
"text": "Failure to connect the outcomes from the activity-based costing usually hinders the success of the implementation. This usually happens when the decision makers are not aware of the \"big picture\" of how activity-based costing can be used throughout the organization. Understanding the concepts and getting actively involved in the ABC implementation process can easily eliminate this."
},
{
"code": null,
"e": 9878,
"s": 9685,
"text": "If the business organization requires quick fixes, activity-based costing will not be the correct answer. Therefore, ABC should not be implemented for situations where quick wins are required."
},
{
"code": null,
"e": 9995,
"s": 9878,
"text": "Activity-based costing is a different way of looking at an organization's costs in order to optimize profit margins."
},
{
"code": null,
"e": 10132,
"s": 9995,
"text": "If ABC is implemented with the correct understanding for the correct purpose, it can return a great long-term value to the organization."
},
{
"code": null,
"e": 10495,
"s": 10132,
"text": "Agile Project Management is one of the revolutionary methods introduced for the practice of project management. This is one of the latest project management strategies that is mainly applied to project management practice in software development. Therefore, it is best to relate agile project management to the software development process when understanding it."
},
{
"code": null,
"e": 10784,
"s": 10495,
"text": "From the inception of software development as a business, there have been a number of processes following, such as the waterfall model. With the advancement of software development, technologies and business requirements, the traditional models are not robust enough to cater the demands."
},
{
"code": null,
"e": 11007,
"s": 10784,
"text": "Therefore, more flexible software development models were required in order to address the agility of the requirements. As a result of this, the information technology community developed agile software development models."
},
{
"code": null,
"e": 11253,
"s": 11007,
"text": "'Agile' is an umbrella term used for identifying various models used for agile development, such as Scrum. Since agile development model is different from conventional models, agile project management is a specialized area in project management."
},
{
"code": null,
"e": 11387,
"s": 11253,
"text": "It is required for one to have a good understanding of the agile development process in order to understand agile project management."
},
{
"code": null,
"e": 11478,
"s": 11387,
"text": "There are many differences in agile development model when compared to traditional models:"
},
{
"code": null,
"e": 11658,
"s": 11478,
"text": "The agile model emphasizes on the fact that entire team should be a tightly integrated unit. This includes the developers, quality assurance, project management, and the customer."
},
{
"code": null,
"e": 11838,
"s": 11658,
"text": "The agile model emphasizes on the fact that entire team should be a tightly integrated unit. This includes the developers, quality assurance, project management, and the customer."
},
{
"code": null,
"e": 12015,
"s": 11838,
"text": "Frequent communication is one of the key factors that makes this integration possible. Therefore, daily meetings are held in order to determine the day's work and dependencies."
},
{
"code": null,
"e": 12192,
"s": 12015,
"text": "Frequent communication is one of the key factors that makes this integration possible. Therefore, daily meetings are held in order to determine the day's work and dependencies."
},
{
"code": null,
"e": 12317,
"s": 12192,
"text": "Deliveries are short-term. Usually a delivery cycle ranges from one week to four weeks. These are commonly known as sprints."
},
{
"code": null,
"e": 12442,
"s": 12317,
"text": "Deliveries are short-term. Usually a delivery cycle ranges from one week to four weeks. These are commonly known as sprints."
},
{
"code": null,
"e": 12735,
"s": 12442,
"text": "Agile project teams follow open communication techniques and tools which enable the team members (including the customer) to express their views and feedback openly and quickly. These comments are then taken into consideration when shaping the requirements and implementation of the software."
},
{
"code": null,
"e": 13028,
"s": 12735,
"text": "Agile project teams follow open communication techniques and tools which enable the team members (including the customer) to express their views and feedback openly and quickly. These comments are then taken into consideration when shaping the requirements and implementation of the software."
},
{
"code": null,
"e": 13253,
"s": 13028,
"text": "In an agile project, the entire team is responsible in managing the team and it is not just the project manager's responsibility. When it comes to processes and procedures, the common sense is used over the written policies."
},
{
"code": null,
"e": 13365,
"s": 13253,
"text": "This makes sure that there is no delay is management decision making and therefore things can progress faster. "
},
{
"code": null,
"e": 13602,
"s": 13365,
"text": "In addition to being a manager, the agile project management function should also demonstrate the leadership and skills in motivating others. This helps retaining the spirit among the team members and gets the team to follow discipline."
},
{
"code": null,
"e": 13809,
"s": 13602,
"text": "Agile project manager is not the 'boss' of the software development team. Rather, this function facilitates and coordinates the activities and resources required for quality and speedy software development."
},
{
"code": null,
"e": 13992,
"s": 13809,
"text": "The responsibilities of an agile project management function are given below. From one project to another, these responsibilities can slightly change and are interpreted differently."
},
{
"code": null,
"e": 14072,
"s": 13992,
"text": "Responsible for maintaining the agile values and practices in the project team."
},
{
"code": null,
"e": 14152,
"s": 14072,
"text": "Responsible for maintaining the agile values and practices in the project team."
},
{
"code": null,
"e": 14232,
"s": 14152,
"text": "The agile project manager removes impediments as the core function of the role."
},
{
"code": null,
"e": 14312,
"s": 14232,
"text": "The agile project manager removes impediments as the core function of the role."
},
{
"code": null,
"e": 14413,
"s": 14312,
"text": "Helps the project team members to turn the requirements backlog into working software functionality."
},
{
"code": null,
"e": 14514,
"s": 14413,
"text": "Helps the project team members to turn the requirements backlog into working software functionality."
},
{
"code": null,
"e": 14591,
"s": 14514,
"text": "Facilitates and encourages effective and open communication within the team."
},
{
"code": null,
"e": 14668,
"s": 14591,
"text": "Facilitates and encourages effective and open communication within the team."
},
{
"code": null,
"e": 14776,
"s": 14668,
"text": "Responsible for holding agile meetings that discusses the short-term plans and plans to overcome obstacles."
},
{
"code": null,
"e": 14884,
"s": 14776,
"text": "Responsible for holding agile meetings that discusses the short-term plans and plans to overcome obstacles."
},
{
"code": null,
"e": 14949,
"s": 14884,
"text": "Enhances the tool and practices used in the development process."
},
{
"code": null,
"e": 15014,
"s": 14949,
"text": "Enhances the tool and practices used in the development process."
},
{
"code": null,
"e": 15127,
"s": 15014,
"text": "Agile project manager is the chief motivator of the team and plays the mentor role for the team members as well."
},
{
"code": null,
"e": 15240,
"s": 15127,
"text": "Agile project manager is the chief motivator of the team and plays the mentor role for the team members as well."
},
{
"code": null,
"e": 15278,
"s": 15240,
"text": "manage the software development team."
},
{
"code": null,
"e": 15316,
"s": 15278,
"text": "manage the software development team."
},
{
"code": null,
"e": 15375,
"s": 15316,
"text": "overrule the informed decisions taken by the team members."
},
{
"code": null,
"e": 15434,
"s": 15375,
"text": "overrule the informed decisions taken by the team members."
},
{
"code": null,
"e": 15484,
"s": 15434,
"text": "direct team members to perform tasks or routines."
},
{
"code": null,
"e": 15534,
"s": 15484,
"text": "direct team members to perform tasks or routines."
},
{
"code": null,
"e": 15595,
"s": 15534,
"text": "drive the team to achieve specific milestones or deliveries."
},
{
"code": null,
"e": 15656,
"s": 15595,
"text": "drive the team to achieve specific milestones or deliveries."
},
{
"code": null,
"e": 15689,
"s": 15656,
"text": "assign task to the team members."
},
{
"code": null,
"e": 15722,
"s": 15689,
"text": "assign task to the team members."
},
{
"code": null,
"e": 15760,
"s": 15722,
"text": "make decisions on behalf of the team."
},
{
"code": null,
"e": 15798,
"s": 15760,
"text": "make decisions on behalf of the team."
},
{
"code": null,
"e": 15869,
"s": 15798,
"text": "involve in technical decision making or deriving the product strategy."
},
{
"code": null,
"e": 15940,
"s": 15869,
"text": "involve in technical decision making or deriving the product strategy."
},
{
"code": null,
"e": 16114,
"s": 15940,
"text": "In agile projects, it is everyone's (developers, quality assurance engineers, designers, etc.) responsibility to manage the project to achieve the objectives of the project."
},
{
"code": null,
"e": 16322,
"s": 16114,
"text": "In addition to that, the agile project manager plays a key role in agile team in order to provide the resources, keep the team motivated, remove blocking issues, and resolve impediments as early as possible."
},
{
"code": null,
"e": 16431,
"s": 16322,
"text": "In this sense, an agile project manager is a mentor and a protector of an agile team, rather than a manager."
},
{
"code": null,
"e": 16578,
"s": 16431,
"text": "Management is a topic that is as vast as the sky. When it comes to the skills that are required to become a good manager, the list may be endless."
},
{
"code": null,
"e": 16781,
"s": 16578,
"text": "In everyday life, we observe many people considering management as - whatever that needs to be done in order to keep a company afloat - but in reality, it is far more complicated than the common belief."
},
{
"code": null,
"e": 16893,
"s": 16781,
"text": "So let us get down to the most basic skills that need to be acquired, if one is to become a successful manager."
},
{
"code": null,
"e": 17158,
"s": 16893,
"text": "You will understand that management involves managing people and thereby, managing the output garnered in favor of the company. According to Dr. Ken Blanchard, in his famous book \"Putting the One minute Manager to Work\", the ABC's of management world are as below:"
},
{
"code": null,
"e": 17262,
"s": 17158,
"text": "Activators - The type of strategy followed by a manager before his workforce sets on with performance."
},
{
"code": null,
"e": 17366,
"s": 17262,
"text": "Activators - The type of strategy followed by a manager before his workforce sets on with performance."
},
{
"code": null,
"e": 17492,
"s": 17366,
"text": "Behaviors - How the workforce performs or behaves within the activity or situation as a result of activators or consequences."
},
{
"code": null,
"e": 17618,
"s": 17492,
"text": "Behaviors - How the workforce performs or behaves within the activity or situation as a result of activators or consequences."
},
{
"code": null,
"e": 17695,
"s": 17618,
"text": "Consequences - How the manager handles the workforce after the performance."
},
{
"code": null,
"e": 17772,
"s": 17695,
"text": "Consequences - How the manager handles the workforce after the performance."
},
{
"code": null,
"e": 18059,
"s": 17772,
"text": "Research shows that although we may be inclined to think that an activator's role brings about the most efficient behavior in a workforce, in effect; it is how managers handle the workforce after a particular behavior that influences future behavior or performance up to a great extent."
},
{
"code": null,
"e": 18249,
"s": 18059,
"text": "To quantify, activators' base behavior contribution is calculated to make up for 15 to 25 percent of behavior, while 75-85 percent of the behavior is known to be influenced by consequences."
},
{
"code": null,
"e": 18394,
"s": 18249,
"text": "Therefore, it is crucial that we understand and develop the basic management skills that will help bring out expected outcomes from a workforce."
},
{
"code": null,
"e": 18632,
"s": 18394,
"text": "This is where most managers either get stamped in to good or bad books. However, the type of decisions you make should not ideally make you a good or bad manager; rather how you make such decisions is what need to be the deciding factor."
},
{
"code": null,
"e": 18794,
"s": 18632,
"text": "You will need to know the basic ethics of problem solving and this should be thoroughly practiced in every occasion, even if the problem concerns you personally."
},
{
"code": null,
"e": 18964,
"s": 18794,
"text": "Unless otherwise, a manager becomes impartial and entirely professional, he/she may find it difficult to build a working relationship with co-workers in an organization."
},
{
"code": null,
"e": 19282,
"s": 18964,
"text": "The last thing you would want your co-workers to think is that you get by your working hours, cuddled up in an office chair, enjoying light music while doing nothing! Planning and Time management is essential for any manager; however, it is even more important for them to realize why these two aspects are important."
},
{
"code": null,
"e": 19413,
"s": 19282,
"text": "Although you may be entitled to certain privileges as a manager, that does not necessarily mean you could slay time as you please."
},
{
"code": null,
"e": 19585,
"s": 19413,
"text": "Assuming responsibility to manage the time is important so that you could become the first to roll the die which will soon become a chain reaction within the organization."
},
{
"code": null,
"e": 19804,
"s": 19585,
"text": "Having said that, when you conduct yourself with efficiency, you will also end up portraying yourself as a role model for co-workers which may add a lot of value as you move along with management duties in the company."
},
{
"code": null,
"e": 20024,
"s": 19804,
"text": "Planning ahead of time for events and activities that you foresee in your radar and taking the necessary initiatives as well as precautions as you move along are undoubtedly, some of the main expectations from managers."
},
{
"code": null,
"e": 20233,
"s": 20024,
"text": "If you could adapt a methodical style at your workplace and adapt effective techniques to carry out your duties with the least hindrance, you will soon build the sacred skills of planning and time management."
},
{
"code": null,
"e": 20446,
"s": 20233,
"text": "Having planned everything that lies ahead and having come up with a plan for time management, you may feel that you have got more than you could chew on your plate. This is where delegation should come into play."
},
{
"code": null,
"e": 20623,
"s": 20446,
"text": "Becoming a good manager does not mean carrying out every task by him/herself. Rather, it is about being able to delegate work effectively in order to complete the task on time."
},
{
"code": null,
"e": 20805,
"s": 20623,
"text": "Many managers mishandle delegation either because they do not have enough confidence in their co-workers and subordinates or because they do not master the techniques of delegation."
},
{
"code": null,
"e": 21122,
"s": 20805,
"text": "Therefore, the key for delegation would be to identify the individuals that are capable of carrying out the task, delegating the work with accurate instructions and providing enough moral support. Once the task is complete, you will get an opportunity to evaluate their performance and provide constructive feedback."
},
{
"code": null,
"e": 21320,
"s": 21122,
"text": "Nothing could be ever accomplished in the world of a manager without him or her being able to accurately, precisely and positively communicate their instructions, suggestions or feedback to others."
},
{
"code": null,
"e": 21472,
"s": 21320,
"text": "Therefore, you should be extremely careful in picking out your words. A 'Can-Do' attitude is something that can be easily portrayed through your words."
},
{
"code": null,
"e": 21573,
"s": 21472,
"text": "When your communication bears a positive note, it will run across your audience almost contagiously."
},
{
"code": null,
"e": 21772,
"s": 21573,
"text": "No matter how much charisma you may have in your personality or how good your positive communication skills may be, a manager never fails to be the one to communicate all things whether good or bad."
},
{
"code": null,
"e": 21927,
"s": 21772,
"text": "In your managerial position, you are exposed to both the executive layer and the working layer of an organization which makes you the ham in the sandwich."
},
{
"code": null,
"e": 22029,
"s": 21927,
"text": "Therefore, you may find yourself squashing and thrilling in between when it comes to many decisions. "
},
{
"code": null,
"e": 22269,
"s": 22029,
"text": "The number one rule in managing yourself is to realize that you are a professional, who is being paid for the designation that you bear in the company. If you remember this fact, you will always remember never to take any issue personally."
},
{
"code": null,
"e": 22512,
"s": 22269,
"text": "Always draw a line between your managerial persona and your actual persona. It is good to bond with co-workers at a personal level while maintaining a distance in your profession. Therefore, you will also be required to draw a line somewhere."
},
{
"code": null,
"e": 22758,
"s": 22512,
"text": "And most importantly, you will become the sponge that absorbs heat from the higher strata of the company and delivers the minimum heat and pressure to the lower strata. Therefore, you will need to practice a fair share of diplomacy in your role."
},
{
"code": null,
"e": 22920,
"s": 22758,
"text": "Managing people and processes is a style in itself that requires dedication and experience-blended practice. The skills needed are as vast and deep as the ocean."
},
{
"code": null,
"e": 23047,
"s": 22920,
"text": "The basic management skills presented herein is only a doorway for you to get started on the management path that lies ahead. "
},
{
"code": null,
"e": 23150,
"s": 23047,
"text": "Most organizations use quality tools for various purposes related to controlling and assuring quality."
},
{
"code": null,
"e": 23390,
"s": 23150,
"text": "Although a good number of quality tools specific are available for certain domains, fields and practices, some of the quality tools can be used across such domains. These quality tools are quite generic and can be applied to any condition."
},
{
"code": null,
"e": 23569,
"s": 23390,
"text": "There are seven basic quality tools used in organizations. These tools can provide much information about problems in the organization assisting to derive solutions for the same."
},
{
"code": null,
"e": 23718,
"s": 23569,
"text": "A number of these quality tools come with a price tag. A brief training, mostly a self-training, is sufficient for someone to start using the tools."
},
{
"code": null,
"e": 23780,
"s": 23718,
"text": "Let us have a look at the seven basic quality tools in brief."
},
{
"code": null,
"e": 23871,
"s": 23780,
"text": "This is one of the basic quality tool that can be used for analyzing a sequence of events."
},
{
"code": null,
"e": 24082,
"s": 23871,
"text": "The tool maps out a sequence of events that take place sequentially or in parallel. The flow chart can be used to understand a complex process in order to find the relationships and dependencies between events."
},
{
"code": null,
"e": 24197,
"s": 24082,
"text": "You can also get a brief idea about the critical path of the process and the events involved in the critical path."
},
{
"code": null,
"e": 24371,
"s": 24197,
"text": "Flow charts can be used for any field to illustrate complex processes in a simple way. There are specific software tools developed for drawing flow charts, such as MS Visio."
},
{
"code": null,
"e": 24469,
"s": 24371,
"text": "You can download some of the open source flow chart tools developed by the open source community."
},
{
"code": null,
"e": 24566,
"s": 24469,
"text": "Histogram is used for illustrating the frequency and the extent in the context of two variables."
},
{
"code": null,
"e": 24714,
"s": 24566,
"text": "Histogram is a chart with columns. This represents the distribution by mean. If the histogram is normal, the graph takes the shape of a bell curve."
},
{
"code": null,
"e": 24910,
"s": 24714,
"text": "If it is not normal, it may take different shapes based on the condition of the distribution. Histogram can be used to measure something against another thing. Always, it should be two variables."
},
{
"code": null,
"e": 25076,
"s": 24910,
"text": "Consider the following example: The following histogram shows morning attendance of a class. The X-axis is the number of students and the Y-axis the time of the day."
},
{
"code": null,
"e": 25191,
"s": 25076,
"text": "Cause and effect diagrams (Ishikawa Diagram) are used for understanding organizational or business problem causes."
},
{
"code": null,
"e": 25384,
"s": 25191,
"text": "Organizations face problems everyday and it is required to understand the causes of these problems in order to solve them effectively. Cause and effect diagrams exercise is usually a teamwork."
},
{
"code": null,
"e": 25484,
"s": 25384,
"text": "A brainstorming session is required in order to come up with an effective cause and effect diagram."
},
{
"code": null,
"e": 25583,
"s": 25484,
"text": "All the main components of a problem area are listed and possible causes from each area is listed."
},
{
"code": null,
"e": 25670,
"s": 25583,
"text": "Then, most likely causes of the problems are identified to carry out further analysis."
},
{
"code": null,
"e": 25738,
"s": 25670,
"text": "A check sheet can be introduced as the most basic tool for quality."
},
{
"code": null,
"e": 25805,
"s": 25738,
"text": "A check sheet is basically used for gathering and organizing data."
},
{
"code": null,
"e": 25961,
"s": 25805,
"text": "When this is done with the help of software packages such as Microsoft Excel, you can derive further analysis graphs and automate through macros available."
},
{
"code": null,
"e": 26075,
"s": 25961,
"text": "Therefore, it is always a good idea to use a software check sheet for information gathering and organizing needs."
},
{
"code": null,
"e": 26225,
"s": 26075,
"text": "One can always use a paper-based check sheet when the information gathered is only used for backup or storing purposes other than further processing."
},
{
"code": null,
"e": 26430,
"s": 26225,
"text": "When it comes to the values of two variables, scatter diagrams are the best way to present. Scatter diagrams present the relationship between two variables and illustrate the results on a Cartesian plane."
},
{
"code": null,
"e": 26509,
"s": 26430,
"text": "Then, further analysis, such as trend analysis can be performed on the values."
},
{
"code": null,
"e": 26603,
"s": 26509,
"text": "In these diagrams, one variable denotes one axis and another variable denotes the other axis."
},
{
"code": null,
"e": 26783,
"s": 26603,
"text": "Control chart is the best tool for monitoring the performance of a process. These types of charts can be used for monitoring any processes related to function of the organization."
},
{
"code": null,
"e": 26891,
"s": 26783,
"text": "These charts allow you to identify the following conditions related to the process that has been monitored."
},
{
"code": null,
"e": 26916,
"s": 26891,
"text": "Stability of the process"
},
{
"code": null,
"e": 26941,
"s": 26916,
"text": "Stability of the process"
},
{
"code": null,
"e": 26971,
"s": 26941,
"text": "Predictability of the process"
},
{
"code": null,
"e": 27001,
"s": 26971,
"text": "Predictability of the process"
},
{
"code": null,
"e": 27045,
"s": 27001,
"text": "Identification of common cause of variation"
},
{
"code": null,
"e": 27089,
"s": 27045,
"text": "Identification of common cause of variation"
},
{
"code": null,
"e": 27150,
"s": 27089,
"text": "Special conditions where the monitoring party needs to react"
},
{
"code": null,
"e": 27211,
"s": 27150,
"text": "Special conditions where the monitoring party needs to react"
},
{
"code": null,
"e": 27384,
"s": 27211,
"text": "Pareto charts are used for identifying a set of priorities. You can chart any number of issues/variables related to a specific concern and record the number of occurrences."
},
{
"code": null,
"e": 27481,
"s": 27384,
"text": "This way you can figure out the parameters that have the highest impact on the specific concern."
},
{
"code": null,
"e": 27573,
"s": 27481,
"text": "This helps you to work on the propriety issues in order to get the condition under control."
},
{
"code": null,
"e": 27664,
"s": 27573,
"text": "Above seven basic quality tools help you to address different concerns in an organization."
},
{
"code": null,
"e": 27776,
"s": 27664,
"text": "Therefore, use of such tools should be a basic practice in the organization in order to enhance the efficiency."
},
{
"code": null,
"e": 27920,
"s": 27776,
"text": "Trainings on these tools should be included in the organizational orientation program, so all the staff members get to learn these basic tools."
},
{
"code": null,
"e": 28015,
"s": 27920,
"text": "If a company is to be successful, it needs to evaluate its performance in a consistent manner."
},
{
"code": null,
"e": 28251,
"s": 28015,
"text": "In order to do so, businesses need to set standards for themselves and measure their processes and performance against recognized industry leaders or against best practices from other industries, which operate in a similar environment."
},
{
"code": null,
"e": 28320,
"s": 28251,
"text": "This is commonly referred to as benchmarking in management parlance."
},
{
"code": null,
"e": 28466,
"s": 28320,
"text": "The benchmarking process is relatively uncomplicated. Some knowledge and a practical dent is all that is needed to make such a process a success."
},
{
"code": null,
"e": 28629,
"s": 28466,
"text": "Therefore, for the benefit of corporate executives, students and the interested general populace, the key steps in the benchmarking process are highlighted below."
},
{
"code": null,
"e": 28687,
"s": 28629,
"text": "Following are the steps involved in benchmarking process:"
},
{
"code": null,
"e": 28820,
"s": 28687,
"text": "Prior to engaging in benchmarking, it is imperative that corporate stakeholders identify the activities that need to be benchmarked."
},
{
"code": null,
"e": 28990,
"s": 28820,
"text": "For instance, the processes that merit such consideration would generally be core activities that have the potential to give the business in question a competitive edge."
},
{
"code": null,
"e": 29290,
"s": 28990,
"text": "Such processes would generally command a high cost, volume or value. For the optimal results of benchmarking to be reaped, the inputs and outputs need to be redefined; the activities chosen should be measurable and thereby easily comparable, and thus the benchmarking metrics needs to be arrived at."
},
{
"code": null,
"e": 29497,
"s": 29290,
"text": "Prior to engaging in the benchmarking process, the total process flow needs to be given due consideration. For instance, improving one core competency at the detriment to another proves to be of little use."
},
{
"code": null,
"e": 29824,
"s": 29497,
"text": "Therefore, many choose to document such processes in detail (a process flow chart is deemed to be ideal for this purpose), so that omissions and errors are minimized; thus enabling the company to obtain a clearer idea of its strategic goals, its primary business processes, customer expectations and critical success factors."
},
{
"code": null,
"e": 29967,
"s": 29824,
"text": "An honest appraisal of the company's strengths, weaknesses and problem areas would prove to be of immense use when fine-tuning such a process."
},
{
"code": null,
"e": 30114,
"s": 29967,
"text": "The next step in the planning process would be for the company to choose an appropriate benchmark against which their performance can be measured."
},
{
"code": null,
"e": 30224,
"s": 30114,
"text": "The benchmark can be a single entity or a collective group of companies, which operate at optimal efficiency."
},
{
"code": null,
"e": 30405,
"s": 30224,
"text": "As stated before, if such a company operates in a similar environment or if it adopts a comparable strategic approach to reach their goals, its relevance would, indeed, be greater."
},
{
"code": null,
"e": 30528,
"s": 30405,
"text": "Measures and practices used in such companies should be identified, so that business process alternatives can be examined."
},
{
"code": null,
"e": 30649,
"s": 30528,
"text": "Also, it is always prudent for a company to ascertain its objectives, prior to commencement of the benchmarking process."
},
{
"code": null,
"e": 30965,
"s": 30649,
"text": "The methodology adopted and the way in which output is documented should be given due consideration too. On such instances, a capable team should be found in order to carry out the benchmarking process, with a leader or leaders being duly appointed, so as to ensure the smooth, timely implementation of the project."
},
{
"code": null,
"e": 31059,
"s": 30965,
"text": "Information can be broadly classified under the sub texts of primary data and secondary data."
},
{
"code": null,
"e": 31277,
"s": 31059,
"text": "To clarify further, here, primary data refers to collection of data directly from the benchmarked company/companies itself, while secondary data refers to information garnered from the press, publications or websites."
},
{
"code": null,
"e": 31465,
"s": 31277,
"text": "Exploratory research, market research, quantitative research, informal conversations, interviews and questionnaires, are still, some of the most popular methods of collecting information."
},
{
"code": null,
"e": 31613,
"s": 31465,
"text": "When engaging in primary research, the company that is due to undertake the benchmarking process needs to redefine its data collection methodology."
},
{
"code": null,
"e": 31897,
"s": 31613,
"text": "Drafting a questionnaire or a standardized interview format, carrying out primary research via the telephone, e-mail or in face-to-face interviews, making on-site observations, and documenting such data in a systematic manner is vital, if the benchmarking process is to be a success."
},
{
"code": null,
"e": 31999,
"s": 31897,
"text": "Once sufficient data is collected, the proper analysis of such information is of foremost importance."
},
{
"code": null,
"e": 32289,
"s": 31999,
"text": "Data analysis, data presentation (preferably in graphical format, for easy reference), results projection, classifying the performance gaps in processes, and identifying the root cause that leads to the creation of such gaps (commonly referred to as enablers), need to be then carried out."
},
{
"code": null,
"e": 32551,
"s": 32289,
"text": "This is the stage in the benchmarking process where it becomes mandatory to walk the talk. This generally means that far-reaching changes need to be made, so that the performance gap between the ideal and the actual is narrowed and eliminated wherever possible."
},
{
"code": null,
"e": 32735,
"s": 32551,
"text": "A formal action plan that promotes change should ideally be formulated keeping the organization's culture in mind, so that the resistance that usually accompanies change is minimized."
},
{
"code": null,
"e": 32963,
"s": 32735,
"text": "Ensuring that the management and staff are fully committed to the process and that sufficient resources are in place to meet facilitate the necessary improvements would be critical in making the benchmarking process, a success."
},
{
"code": null,
"e": 33119,
"s": 32963,
"text": "As with most projects, in order to reap the maximum benefits of the benchmarking process, a systematic evaluation should be carried out on a regular basis."
},
{
"code": null,
"e": 33305,
"s": 33119,
"text": "Assimilating the required information, evaluating the progress made, re-iterating the impact of the changes and making any necessary adjustments, are all part of the monitoring process."
},
{
"code": null,
"e": 33457,
"s": 33305,
"text": "As is clearly apparent, benchmarking can add value to the organization's workflow and structure by identifying areas for improvement and rectification."
},
{
"code": null,
"e": 33536,
"s": 33457,
"text": "It is indeed invaluable in an organization's quest for continuous improvement."
},
{
"code": null,
"e": 33849,
"s": 33536,
"text": "There are a number of productivity and management tools used in business organizations. Cause and Effect Diagram, in other words, Ishikawa or Fishbone diagram, is one such management tool. Due to the popularity of this tool, majority of managers make use of this tool regardless of the scale of the organization."
},
{
"code": null,
"e": 34048,
"s": 33849,
"text": "Problems are meant to exist in organizations. That's why there should be a strong process and supporting tools for identifying the causes of the problems before the problems damage the organization."
},
{
"code": null,
"e": 34142,
"s": 34048,
"text": "Following are the steps that can be followed to successfully draw a cause and effect diagram:"
},
{
"code": null,
"e": 34415,
"s": 34142,
"text": "Start articulating the exact problem you are facing. Sometimes, identification of the problem may not be straightforward. In such instances, write down all the effects and observations in detail. A short brainstorming session may be able to point out t the actual problem."
},
{
"code": null,
"e": 34833,
"s": 34415,
"text": "When it comes to properly identifying the problem, there are four properties to consider; who are involved, what the problem is, when it occurs, and where it occurs. Write down the problem in a box, which is located at the left hand corner (refer the example cause and effect diagram). From the box, draw a line horizontally to the right hand side. The arrangement will now look like the head and the spine of a fish."
},
{
"code": null,
"e": 35069,
"s": 34833,
"text": "In this step, the main factors of the problem are identified. For each factor, draw off a line from the fish's spine and properly label it. These factors can be various things such as people, material, machinery or external influences."
},
{
"code": null,
"e": 35142,
"s": 35069,
"text": "Think more and add as many as factors into the cause and effect diagram."
},
{
"code": null,
"e": 35291,
"s": 35142,
"text": "Brainstorming becomes quite useful in this phase, as people can look at the problem in different angles and identify different contributing factors."
},
{
"code": null,
"e": 35347,
"s": 35291,
"text": "The factors you added now become the bones of the fish."
},
{
"code": null,
"e": 35546,
"s": 35347,
"text": "Take one factor at a time when identifying possible causes. Brainstorm and try to identify all causes that apply to each factor. Add these causes horizontally off from the fish bones and label them."
},
{
"code": null,
"e": 35734,
"s": 35546,
"text": "If the cause is large in size or complex in nature, you can further breakdown and add them as sub causes to the main cause. These sub causes should come off from the relevant cause lines."
},
{
"code": null,
"e": 35814,
"s": 35734,
"text": "Spend more time in this step; the collection of causes should be comprehensive."
},
{
"code": null,
"e": 35951,
"s": 35814,
"text": "When this step starts, you have a diagram that indicates the problem, the contributing factors, and all possible causes for the problem."
},
{
"code": null,
"e": 36085,
"s": 35951,
"text": "Depending on the brainstorming ideas and nature of the problem, you can now prioritize the causes and look for the most likely cause."
},
{
"code": null,
"e": 36231,
"s": 36085,
"text": "This analysis may lead to further activities such as investigations, interviews and surveys. Refer the following sample cause and effect diagram:"
},
{
"code": null,
"e": 36405,
"s": 36231,
"text": "When it comes to the use of cause and effect diagrams, brainstorming is a critical step. Without proper brainstorming, a fruitful cause and effect diagram cannot be derived."
},
{
"code": null,
"e": 36516,
"s": 36405,
"text": "Therefore, following considerations should be addressed in the process of deriving a cause and effect diagram:"
},
{
"code": null,
"e": 36668,
"s": 36516,
"text": "There should be a problem statement that describes the problem accurately. Everyone in the brainstorming session should agree on the problem statement."
},
{
"code": null,
"e": 36820,
"s": 36668,
"text": "There should be a problem statement that describes the problem accurately. Everyone in the brainstorming session should agree on the problem statement."
},
{
"code": null,
"e": 36856,
"s": 36820,
"text": "Need to be succinct in the process."
},
{
"code": null,
"e": 36892,
"s": 36856,
"text": "Need to be succinct in the process."
},
{
"code": null,
"e": 36965,
"s": 36892,
"text": "For each node, think all the possible causes and add them into the tree."
},
{
"code": null,
"e": 37038,
"s": 36965,
"text": "For each node, think all the possible causes and add them into the tree."
},
{
"code": null,
"e": 37089,
"s": 37038,
"text": "Connect each casualty line back to its root cause."
},
{
"code": null,
"e": 37140,
"s": 37089,
"text": "Connect each casualty line back to its root cause."
},
{
"code": null,
"e": 37185,
"s": 37140,
"text": "Connect relatively empty branches to others."
},
{
"code": null,
"e": 37230,
"s": 37185,
"text": "Connect relatively empty branches to others."
},
{
"code": null,
"e": 37286,
"s": 37230,
"text": "If a branch is too bulky, consider splitting it in two."
},
{
"code": null,
"e": 37342,
"s": 37286,
"text": "If a branch is too bulky, consider splitting it in two."
},
{
"code": null,
"e": 37428,
"s": 37342,
"text": "Cause and Effect diagrams can be used to resolve organizational problems efficiently."
},
{
"code": null,
"e": 37624,
"s": 37428,
"text": "There are no limitations or restrictions on applying the diagrams to different problems or domains. The level and intensity of brainstorming defines the success rate of cause and effect diagrams."
},
{
"code": null,
"e": 37745,
"s": 37624,
"text": "Therefore, all relevant parties should be present in the brainstorming session in order to identify all possible causes."
},
{
"code": null,
"e": 37847,
"s": 37745,
"text": "Once most likely causes are identified, further investigation is required to unearth further details."
},
{
"code": null,
"e": 37991,
"s": 37847,
"text": "Philosophically thinking, change is the only constant in the world. Same as for anything else, this is true for business organizations as well."
},
{
"code": null,
"e": 38198,
"s": 37991,
"text": "Every now and then, business organizations change the way they operate and the services/products they offer. There are new initiatives in organizations and the old ineffective practices are forced to leave."
},
{
"code": null,
"e": 38315,
"s": 38198,
"text": "In addition to that, technology is constantly changing and the business organizations need to par with that as well."
},
{
"code": null,
"e": 38672,
"s": 38315,
"text": "There are many approaches about how to change. Of course, we may all agree that the change is required for an organization, but can we all be in agreement of how the change should take place? Usually not! Therefore, deriving a change management process should be a collective effort and should result from intensive brainstorming and refining of the ideas."
},
{
"code": null,
"e": 38891,
"s": 38672,
"text": "In this tutorial, we will have a look at the change management process suggested by John Kotter. Since this process has shown results for many Fortune 500 companies, Kotter's approach should be considered with respect."
},
{
"code": null,
"e": 38958,
"s": 38891,
"text": "Let's go through the steps of Kotter's change management approach."
},
{
"code": null,
"e": 39171,
"s": 38958,
"text": "A change is only successful if the whole company really wants it. If you are planning to make a change, then you need to make others want it. You can create urgency around what you want to change and create hype."
},
{
"code": null,
"e": 39380,
"s": 39171,
"text": "This will make your idea well received when you start your initiative. Use statistics and visual presentations to convey why the change should take place and how the company and employees can be at advantage."
},
{
"code": null,
"e": 39601,
"s": 39380,
"text": "If your convincing is strong, you will win a lot of people in favour of change. You can now build a team to carry out the change from the people, who support you. Since changing is your idea, make sure you lead the team."
},
{
"code": null,
"e": 39735,
"s": 39601,
"text": "Organize your team structure and assign responsibilities to the team members. Make them feel that they are important within the team."
},
{
"code": null,
"e": 39997,
"s": 39735,
"text": "When a change takes place, having a vision is a must. The vision makes everything clear to everyone. When you have a clear vision, your team members know why they are working on the change initiative and rest of the staff know why your team is doing the change."
},
{
"code": null,
"e": 40118,
"s": 39997,
"text": "If you are facing difficulties coming up with a vision, read chapter one (Mission and Values) of WINNING, by Jack Welch."
},
{
"code": null,
"e": 40246,
"s": 40118,
"text": "Deriving the vision is not just enough for you to implement the change. You need to communicate your vision across the company."
},
{
"code": null,
"e": 40492,
"s": 40246,
"text": "This communication should take place frequently and at important forums. Get the influential people in the company to endorse your effort. Use every chance to communicate your vision; this could be a board meeting or just talking over the lunch."
},
{
"code": null,
"e": 40685,
"s": 40492,
"text": "No change takes place without obstacles. Once you communicate your vision, you will only be able to get the support of a fraction of the staff. Always, there are people, who resist the change."
},
{
"code": null,
"e": 40904,
"s": 40685,
"text": "Sometimes, there are processes and procedures that resist the change too! Always watch out for obstacles and remove them as soon as they appear. This will increase the morale of your team as well the rest of the staff."
},
{
"code": null,
"e": 41095,
"s": 40904,
"text": "Quick wins are the best way to keep the momentum going. By quick wins, your team will have a great satisfaction and the company will immediately see the advantages of your change initiative."
},
{
"code": null,
"e": 41272,
"s": 41095,
"text": "Every now and then, produce a quick win for different stakeholders, who get affected by the change process. But always remember to keep the eye on the long-term goals as well. "
},
{
"code": null,
"e": 41470,
"s": 41272,
"text": "Many change initiatives fail due to early declaration of victory. If you haven't implemented the change 100% by the time you declare the victory, people will be dissatisfied when they see the gaps."
},
{
"code": null,
"e": 41668,
"s": 41470,
"text": "Therefore, complete the change process 100% and let it be there for sometime. Let it have its own time to get integrated to the people's lives and organizational processes before you say it 'over.'"
},
{
"code": null,
"e": 41937,
"s": 41668,
"text": "Use mechanisms to integrate the change into people's daily life and corporate culture. Have a continuous monitoring mechanism in place in order to monitor whether every aspect of the change taking place in the organization. When you see noncompliance, act immediately."
},
{
"code": null,
"e": 42046,
"s": 41937,
"text": "In the constantly changing corporate world, the one who welcomes the changes stays ahead of the competition."
},
{
"code": null,
"e": 42194,
"s": 42046,
"text": "If you are not much comfortable with changes happening around you, reserve some of your time to read 'Who Moved My Cheese?' by Dr. Spencer Johnson."
},
{
"code": null,
"e": 42326,
"s": 42194,
"text": "This will tell you the whole story about why the change is required and how you can make use of the change to excel in what you do."
},
{
"code": null,
"e": 42480,
"s": 42326,
"text": "If you are unable to communicate what you think and what you want, your will not be much successful in getting your work done in a corporate environment."
},
{
"code": null,
"e": 42658,
"s": 42480,
"text": "Therefore, it is necessary for you to get to know what the communication barriers are, so you can avoid them if you intentionally or unintentionally practice them at the moment."
},
{
"code": null,
"e": 42770,
"s": 42658,
"text": "Have a close look at the following communication blockers that can be commonly found in corporate environments:"
},
{
"code": null,
"e": 42958,
"s": 42770,
"text": "Accusing and blaming are the most destructive forms of communication. When accusing, the other person feels that you assume he/she is guilty, even without hearing their side of the story."
},
{
"code": null,
"e": 43127,
"s": 42958,
"text": "Never accuse or blame unless it is highly required to address certain exceptional issues. In a corporate environment, accusing and blaming should not take place at all."
},
{
"code": null,
"e": 43353,
"s": 43127,
"text": "Judging is one of the blockers that prevent the information flow in communication. As an example, if one person is suspecting that you judge him/her, he/she will not open up to you and tell you all what they want to tell you."
},
{
"code": null,
"e": 43569,
"s": 43353,
"text": "Instead, they will tell you what they think as 'safe' to tell you. Make sure that you do not judge people when you communicate with them. Judging makes others feel that one person is on a higher level than the rest."
},
{
"code": null,
"e": 43777,
"s": 43569,
"text": "Insulting takes you nowhere in communication. Do you like to be insulted by someone else? Therefore, you should not insult another person regardless of how tempered you are or how wrong you think others are."
},
{
"code": null,
"e": 43911,
"s": 43777,
"text": "There are many ways of managing your temper other than insulting others. Insulting does not provide you any information you require. "
},
{
"code": null,
"e": 44131,
"s": 43911,
"text": "If you are to diagnose something said by another person, think twice before actually doing it. If you diagnose something, you should be having more expertise than the person, who originally related to the communication."
},
{
"code": null,
"e": 44289,
"s": 44131,
"text": "When you try to diagnose something without a proper background to do so, others understand as if you are trying to show your expertise over the other person."
},
{
"code": null,
"e": 44406,
"s": 44289,
"text": "This is a communication blocker and the other person may be reluctant to provide you all the information he/she has."
},
{
"code": null,
"e": 44567,
"s": 44406,
"text": "In order to have effective communication, you need to show respect to others. If you show no respect, you get no information. This is exactly what sarcasm does."
},
{
"code": null,
"e": 44765,
"s": 44567,
"text": "If you become sarcastic towards a person, that person will surely hold back a lot of valuable information that is important to you. Showing your sense of humour is one thing and sarcasm is another!"
},
{
"code": null,
"e": 44922,
"s": 44765,
"text": "Do not use words such as \"always\" or \"never.\" These make the parties involved in the discussions uncomfortable as well as it gives the notion of negativity."
},
{
"code": null,
"e": 44997,
"s": 44922,
"text": "Try to avoid such globalizing words and try to focus on the issue in hand."
},
{
"code": null,
"e": 45209,
"s": 44997,
"text": "Understanding what other person says is the key for a successful outcome from communication. Overpowering rather than understanding the other person has many negative consequences when it comes to communication."
},
{
"code": null,
"e": 45395,
"s": 45209,
"text": "With threats and orders, there is only one-way communication and nothing collaborative will take place. Therefore, it is necessary for you to avoid threats or orders when communicating."
},
{
"code": null,
"e": 45593,
"s": 45395,
"text": "Interrupting is a good thing when you want to get something just said, clarified. But most of the times, people interrupt another person to express their own views and to oppose what has been said."
},
{
"code": null,
"e": 45802,
"s": 45593,
"text": "When such interruptions take place, the person, who talks may feel that you are no longer interested in what they are saying. Therefore, interrupt when it is really necessary and only to get things clarified."
},
{
"code": null,
"e": 45932,
"s": 45802,
"text": "If the other person is keen on talking about something, changing the subject by you might result in some issues in communication."
},
{
"code": null,
"e": 46160,
"s": 45932,
"text": "Changing subject in the middle of some discussion can be understood as your lack of interest on the subject as well as your unwillingness to pay attention. This may result in unproductive and ineffective communication outcomes."
},
{
"code": null,
"e": 46300,
"s": 46160,
"text": "Sometimes, we tend to do this. When one person is telling you something, you try to get the reassurance for what has been said from others."
},
{
"code": null,
"e": 46431,
"s": 46300,
"text": "This behaviour makes the first person uncomfortable and it is an indication that you do not believe or trust what the person says."
},
{
"code": null,
"e": 46557,
"s": 46431,
"text": "If you need a reassurance of what has been said, do it in a more private manner after the discussion or conversation is over."
},
{
"code": null,
"e": 46760,
"s": 46557,
"text": "Communication barriers are the ones you should always avoid. If you are a manager of a business organization, you should know each and every communication barrier and remove them from corporate culture."
},
{
"code": null,
"e": 46934,
"s": 46760,
"text": "Encourage others to avoid communication barriers by educating them. With communication barriers, neither the management nor employees will be able to achieve what they want."
},
{
"code": null,
"e": 47177,
"s": 46934,
"text": "In an organization, information flows forward, backwards and sideways. This information flow is referred to as communication. Communication channels refer to the way this information flows within the organization and with other organizations."
},
{
"code": null,
"e": 47369,
"s": 47177,
"text": "In this web known as communication, a manager becomes a link. Decisions and directions flow upwards or downwards or sideways depending on the position of the manager in the communication web."
},
{
"code": null,
"e": 47587,
"s": 47369,
"text": "For example, reports from lower level manager will flow upwards. A good manager has to inspire, steer and organize his employees efficiently, and for all this, the tools in his possession are spoken and written words."
},
{
"code": null,
"e": 47729,
"s": 47587,
"text": "For the flow of information and for a manager to handle his employees, it is important for an effectual communication channel to be in place."
},
{
"code": null,
"e": 47899,
"s": 47729,
"text": "Through a modem of communication, be it face-to-face conversations or an inter-department memo, information is transmitted from a manager to a subordinate or vice versa."
},
{
"code": null,
"e": 48013,
"s": 47899,
"text": "An important element of the communication process is the feedback mechanism between the management and employees."
},
{
"code": null,
"e": 48183,
"s": 48013,
"text": "In this mechanism, employees inform managers that they have understood the task at hand while managers provide employees with comments and directions on employee's work."
},
{
"code": null,
"e": 48384,
"s": 48183,
"text": "A breakdown in the communication channel leads to an inefficient flow of information. Employees are unaware of what the company expects of them. They are uninformed of what is going on in the company."
},
{
"code": null,
"e": 48644,
"s": 48384,
"text": "This will cause them to become suspicious of motives and any changes in the company. Also without effective communication, employees become department minded rather than company minded, and this affects their decision making and productivity in the workplace."
},
{
"code": null,
"e": 48942,
"s": 48644,
"text": "Eventually, this harms the overall organizational objectives as well. Hence, in order for an organization to be run effectively, a good manager should be able to communicate to his/her employees what is expected of them, make sure they are fully aware of company policies and any upcoming changes."
},
{
"code": null,
"e": 49104,
"s": 48942,
"text": "Therefore, an effective communication channel should be implemented by managers to optimize worker productivity to ensure the smooth running of the organization."
},
{
"code": null,
"e": 49324,
"s": 49104,
"text": "The number of communication channels available to a manager has increased over the last 20 odd years. Video conferencing, mobile technology, electronic bulletin boards and fax machines are some of the new possibilities."
},
{
"code": null,
"e": 49442,
"s": 49324,
"text": "As organizations grow in size, managers cannot rely on face-to-face communication alone to get their message across. "
},
{
"code": null,
"e": 49595,
"s": 49442,
"text": "A challenge the managers face today is to determine what type of communication channel should they opt for in order to carryout effective communication."
},
{
"code": null,
"e": 49742,
"s": 49595,
"text": "In order to make a manager's task easier, the types of communication channels are grouped into three main groups: formal, informal and unofficial."
},
{
"code": null,
"e": 50065,
"s": 49742,
"text": "A formal communication channel transmits information such as the goals, policies and procedures of an organization. Messages in this type of communication channel follow a chain of command. This means information flows from a manager to his subordinates and they in turn pass on the information to the next level of staff."
},
{
"code": null,
"e": 50388,
"s": 50065,
"text": "A formal communication channel transmits information such as the goals, policies and procedures of an organization. Messages in this type of communication channel follow a chain of command. This means information flows from a manager to his subordinates and they in turn pass on the information to the next level of staff."
},
{
"code": null,
"e": 50692,
"s": 50388,
"text": "An example of a formal communication channel is a company's newsletter, which gives employees as well as the clients a clear idea of a company's goals and vision. It also includes the transfer of information with regard to memoranda, reports, directions, and scheduled meetings in the chain of command. "
},
{
"code": null,
"e": 50996,
"s": 50692,
"text": "An example of a formal communication channel is a company's newsletter, which gives employees as well as the clients a clear idea of a company's goals and vision. It also includes the transfer of information with regard to memoranda, reports, directions, and scheduled meetings in the chain of command. "
},
{
"code": null,
"e": 51134,
"s": 50996,
"text": "A business plan, customer satisfaction survey, annual reports, employer's manual, review meetings are all formal communication channels. "
},
{
"code": null,
"e": 51272,
"s": 51134,
"text": "A business plan, customer satisfaction survey, annual reports, employer's manual, review meetings are all formal communication channels. "
},
{
"code": null,
"e": 51692,
"s": 51272,
"text": "Within a formal working environment, there always exists an informal communication network. The strict hierarchical web of communication cannot function efficiently on its own and hence there exists a communication channel outside of this web. While this type of communication channel may disrupt the chain of command, a good manager needs to find the fine balance between the formal and informal communication channel."
},
{
"code": null,
"e": 52112,
"s": 51692,
"text": "Within a formal working environment, there always exists an informal communication network. The strict hierarchical web of communication cannot function efficiently on its own and hence there exists a communication channel outside of this web. While this type of communication channel may disrupt the chain of command, a good manager needs to find the fine balance between the formal and informal communication channel."
},
{
"code": null,
"e": 52430,
"s": 52112,
"text": "An example of an informal communication channel is lunchtime at the organization's cafeteria/canteen. Here, in a relaxed atmosphere, discussions among employees are encouraged. Also managers walking around, adopting a hands-on approach to handling employee queries is an example of an informal communication channel. "
},
{
"code": null,
"e": 52748,
"s": 52430,
"text": "An example of an informal communication channel is lunchtime at the organization's cafeteria/canteen. Here, in a relaxed atmosphere, discussions among employees are encouraged. Also managers walking around, adopting a hands-on approach to handling employee queries is an example of an informal communication channel. "
},
{
"code": null,
"e": 52908,
"s": 52748,
"text": "Quality circles, team work, different training programs are outside of the chain of command and so, fall under the category of informal communication channels."
},
{
"code": null,
"e": 53068,
"s": 52908,
"text": "Quality circles, team work, different training programs are outside of the chain of command and so, fall under the category of informal communication channels."
},
{
"code": null,
"e": 53319,
"s": 53068,
"text": "Good managers will recognize the fact that sometimes communication that takes place within an organization is interpersonal. While minutes of a meeting may be a topic of discussion among employees, sports, politics and TV shows also share the floor. "
},
{
"code": null,
"e": 53570,
"s": 53319,
"text": "Good managers will recognize the fact that sometimes communication that takes place within an organization is interpersonal. While minutes of a meeting may be a topic of discussion among employees, sports, politics and TV shows also share the floor. "
},
{
"code": null,
"e": 54190,
"s": 53570,
"text": "The unofficial communication channel in an organization is the organization's 'grapevine.' It is through the grapevine that rumors circulate. Also those engaging in 'grapevine' discussions often form groups, which translate into friendships outside of the organization. While the grapevine may have positive implications, more often than not information circulating in the grapevine is exaggerated and may cause unnecessary alarm to employees. A good manager should be privy to information circulating in this unofficial communication channel and should take positive measures to prevent the flow of false information. "
},
{
"code": null,
"e": 54810,
"s": 54190,
"text": "The unofficial communication channel in an organization is the organization's 'grapevine.' It is through the grapevine that rumors circulate. Also those engaging in 'grapevine' discussions often form groups, which translate into friendships outside of the organization. While the grapevine may have positive implications, more often than not information circulating in the grapevine is exaggerated and may cause unnecessary alarm to employees. A good manager should be privy to information circulating in this unofficial communication channel and should take positive measures to prevent the flow of false information. "
},
{
"code": null,
"e": 54899,
"s": 54810,
"text": "An example of an unofficial communication channel is social gatherings among employees. "
},
{
"code": null,
"e": 54988,
"s": 54899,
"text": "An example of an unofficial communication channel is social gatherings among employees. "
},
{
"code": null,
"e": 55087,
"s": 54988,
"text": "In any organization, three types of communication channels exist: formal, informal and unofficial."
},
{
"code": null,
"e": 55256,
"s": 55087,
"text": "While the ideal communication web is a formal structure in which informal communication can take place, unofficial communication channels also exist in an organization."
},
{
"code": null,
"e": 55416,
"s": 55256,
"text": "Through these various channels, it is important for a manager to get his/her ideas across and then listen, absorb, glean and further communicate to employees. "
},
{
"code": null,
"e": 55594,
"s": 55416,
"text": "We all know the importance of communication in our daily lives. Nothing can take place without some method of communication being used to express ourselves for whatever purpose."
},
{
"code": null,
"e": 55838,
"s": 55594,
"text": "Communication is even more valuable in a business environment as there are several parties involved. Various stakeholders, whether they are customers, employees or the media, are always sending important information to each other at all times."
},
{
"code": null,
"e": 56110,
"s": 55838,
"text": "We are therefore constantly using some form of communication or another to send a message across. Without these different methods of communication available today, it would take eons for us to carry out business as efficiently as it is done today and with the same speed."
},
{
"code": null,
"e": 56176,
"s": 56110,
"text": "Let's try and understand what these methods of communication are."
},
{
"code": null,
"e": 56269,
"s": 56176,
"text": "Numerous new instruments have emerged over the years to help people communicate effectively."
},
{
"code": null,
"e": 56462,
"s": 56269,
"text": "Oral communication could be said to be the most used form of communication. Whether it is to present some important data to your colleagues or lead a boardroom meeting, these skills are vital."
},
{
"code": null,
"e": 56621,
"s": 56462,
"text": "We are constantly using words verbally to inform our subordinates of a decision, provide information, and so on. This is done either by phone or face-to-face."
},
{
"code": null,
"e": 56756,
"s": 56621,
"text": "The person on the receiving end would also need to exercise much caution to ensure that he/she clearly understands what is being said."
},
{
"code": null,
"e": 56934,
"s": 56756,
"text": "This shows therefore that you would need to cultivate both your listening and speaking skills, as you would have to carry out both roles in the workplace, with different people."
},
{
"code": null,
"e": 57057,
"s": 56934,
"text": "Writing is used when you have to provide detailed information such as figures and facts, even while giving a presentation."
},
{
"code": null,
"e": 57356,
"s": 57057,
"text": "It is also generally used to send documents and other important material to stakeholders which could then be stored for later use as it can be referred to easily as it is recorded. Other important documents such as contracts, memos and minutes of meetings are also in written form for this purpose."
},
{
"code": null,
"e": 57520,
"s": 57356,
"text": "It can be seen in recent years, however, that verbal communication has been replaced to a great extent by a faster form of written communication and that is email."
},
{
"code": null,
"e": 57746,
"s": 57520,
"text": "You could also use video conferencing and multiple way phone calls with several individuals simultaneously. Apart from a few glitches that could occur, these methods of communication have helped organizations come a long way."
},
{
"code": null,
"e": 57942,
"s": 57746,
"text": "Although the most common methods of communication are carried out orally or in writing, when it comes to management techniques, the power of non-verbal communication must never be underestimated."
},
{
"code": null,
"e": 58126,
"s": 57942,
"text": "Your smile, your gestures and several other body movements send out a message to the people around you. You need to be mindful of this while dealing with your employees and customers."
},
{
"code": null,
"e": 58244,
"s": 58126,
"text": "Always remember to maintain eye contact. This would show that you are serious and confident about what is being said."
},
{
"code": null,
"e": 58344,
"s": 58244,
"text": "You may ask why it is important that we use different methods of communication in one organization."
},
{
"code": null,
"e": 58480,
"s": 58344,
"text": "The answer is very simple. The reason for this is the pivotal role that communication plays in the effective functioning of a business."
},
{
"code": null,
"e": 58808,
"s": 58480,
"text": "Imagine an organization today without e-mail facilities. How would a customer then be able to send an important proposal quickly and directly to the employer in-charge? Similarly, an organization may have to stall their work if certain managers are not in the country and are thereby unable to give a presentation to the board."
},
{
"code": null,
"e": 58884,
"s": 58808,
"text": "But, of course, this can be done today with the help of video conferencing."
},
{
"code": null,
"e": 58963,
"s": 58884,
"text": "Therefore, it is crucial that different methods of communication are employed."
},
{
"code": null,
"e": 59166,
"s": 58963,
"text": "It is important that the most cost-effective methods of communication are chosen for any organization. Simply choosing a method of communication due to it being a famous instrument is not going to help."
},
{
"code": null,
"e": 59297,
"s": 59166,
"text": "You would need to understand the needs of your organization in particular. There are certain questions that you would need to ask:"
},
{
"code": null,
"e": 59326,
"s": 59297,
"text": "What is our target audience?"
},
{
"code": null,
"e": 59355,
"s": 59326,
"text": "What is our target audience?"
},
{
"code": null,
"e": 59411,
"s": 59355,
"text": "How much are we willing to spend on such an instrument?"
},
{
"code": null,
"e": 59467,
"s": 59411,
"text": "How much are we willing to spend on such an instrument?"
},
{
"code": null,
"e": 59523,
"s": 59467,
"text": "Will it increase employee productivity in the long run?"
},
{
"code": null,
"e": 59579,
"s": 59523,
"text": "Will it increase employee productivity in the long run?"
},
{
"code": null,
"e": 59631,
"s": 59579,
"text": "What kind of information do we send out most often?"
},
{
"code": null,
"e": 59683,
"s": 59631,
"text": "What kind of information do we send out most often?"
},
{
"code": null,
"e": 59930,
"s": 59683,
"text": "You may have more questions to ask based on the type of work you carry out and the message that you need to send across. Remember that there is no 'right' method of communication. You would need different methods for different purposes and tasks."
},
{
"code": null,
"e": 60032,
"s": 59930,
"text": "In conclusion, it is important to always remember the importance of communication in an organization."
},
{
"code": null,
"e": 60230,
"s": 60032,
"text": "The methods of communication you choose could in a sense make or break the management structure of your organization and could also affect your relationship with customers, if not chosen carefully."
},
{
"code": null,
"e": 60343,
"s": 60230,
"text": "It is vital therefore that you spend some time \nchoosing the right methods to aid you in your \nmanagement tasks."
},
{
"code": null,
"e": 60563,
"s": 60343,
"text": "For decades, man has known the importance of communication. Today, with various means by which one can communicate, it has become much easier to communicate a message to the other party, than it was several decades ago."
},
{
"code": null,
"e": 60728,
"s": 60563,
"text": "Every organization, no matter what their expertise and where they are situated, and what scale they operate, realize and value the importance of good communication."
},
{
"code": null,
"e": 60858,
"s": 60728,
"text": "This communication for organizations takes place both within the organization as well as with other outside stakeholders outside."
},
{
"code": null,
"e": 61041,
"s": 60858,
"text": "Therefore, it is vital for any business organization to understand the communication models out there, so they can use them for enhancing effective communication in the organization."
},
{
"code": null,
"e": 61086,
"s": 61041,
"text": "Communication today is mainly of three types"
},
{
"code": null,
"e": 61185,
"s": 61086,
"text": "Written communication, in the form of emails, letters, reports, memos and various other documents."
},
{
"code": null,
"e": 61284,
"s": 61185,
"text": "Written communication, in the form of emails, letters, reports, memos and various other documents."
},
{
"code": null,
"e": 61375,
"s": 61284,
"text": "Oral communication. This is either face-to-face or over the phone/video conferencing, etc."
},
{
"code": null,
"e": 61466,
"s": 61375,
"text": "Oral communication. This is either face-to-face or over the phone/video conferencing, etc."
},
{
"code": null,
"e": 61751,
"s": 61466,
"text": "A third type of communication, also commonly used but often underestimated is non-verbal communication, which is by using gestures or even simply body movements that are made. These too could send various signals to the other party and is an equally important method of communication."
},
{
"code": null,
"e": 62036,
"s": 61751,
"text": "A third type of communication, also commonly used but often underestimated is non-verbal communication, which is by using gestures or even simply body movements that are made. These too could send various signals to the other party and is an equally important method of communication."
},
{
"code": null,
"e": 62222,
"s": 62036,
"text": "The basic flow of communication can be seen in the diagram below. In this flow, the sender sends a message to the receiver and then they share the feedback on the communication process."
},
{
"code": null,
"e": 62405,
"s": 62222,
"text": "The methods of communication too need to be carefully considered before you decide on which method to uses for your purposes. Not all communication methods work for all transactions."
},
{
"code": null,
"e": 62640,
"s": 62405,
"text": "Once the methods of communication have been understood, the next step would be to consider various communication models. Due to the importance of communication, different types of models have been introduced by experts over the years."
},
{
"code": null,
"e": 62876,
"s": 62640,
"text": "The models help the business organizations and other institutions to understand how communication works, how messages are transmitted, how it is received by the other party, and how the message is eventually interpreted and understood."
},
{
"code": null,
"e": 62972,
"s": 62876,
"text": "Let's have a look at some of the famous and frequently used communication models used nowadays."
},
{
"code": null,
"e": 63089,
"s": 62972,
"text": "One of the earliest models of communication that introduced was Claude Shannon's model. This was introduced in 1948."
},
{
"code": null,
"e": 63337,
"s": 63089,
"text": "This laid the foundation for the different communication models that we have today, and has greatly helped and enhanced the communication process in various fields. This model can be considered as the granddaddy of many later communication models."
},
{
"code": null,
"e": 63387,
"s": 63337,
"text": "Following is a simple illustration of this model."
},
{
"code": null,
"e": 63509,
"s": 63387,
"text": "The diagram above clearly illustrates how communication takes place, and also helps one to determine what could go wrong."
},
{
"code": null,
"e": 63638,
"s": 63509,
"text": "In Shannon's model, the information source typically refers to a person, who then sends a message with the use of a transmitter."
},
{
"code": null,
"e": 63823,
"s": 63638,
"text": "This transmitter could be any instrument today, from phones to computers and other devices. The signals that are sent and received can be vary depending on the method of communication."
},
{
"code": null,
"e": 63987,
"s": 63823,
"text": "The box at the bottom called NOISE refers to any signals that may interfere with the message being carried. This again would depend on the method of communication."
},
{
"code": null,
"e": 64160,
"s": 63987,
"text": "The receiver is the instrument or the person on the other side that receives the. This model is the simplest models to understand the workings of the communication process."
},
{
"code": null,
"e": 64317,
"s": 64160,
"text": "Another famous communication model is Berlo's model. In this model, he stresses on the relationship between the person sending the message and the receiver."
},
{
"code": null,
"e": 64548,
"s": 64317,
"text": "According to this model, for the message to be properly encoded and decoded, the communication skills of both the source and the receiver should be at best. The communication will be at its best only if the two points are skilled."
},
{
"code": null,
"e": 64676,
"s": 64548,
"text": "Berlo's model has four main components and each component has its own sub components describing the assisting factors for each."
},
{
"code": null,
"e": 64721,
"s": 64676,
"text": "Following is the illustration of this model."
},
{
"code": null,
"e": 64896,
"s": 64721,
"text": "Schramm on the other hand, emphasized in 1954 that both the sender and the receiver take turns playing the role of the encoder and the decoder when it comes to communication."
},
{
"code": null,
"e": 64961,
"s": 64896,
"text": "The following diagram illustrates the model proposed by Schramm."
},
{
"code": null,
"e": 65091,
"s": 64961,
"text": "These models have been followed by various other models such as the 'Helical' model, Aristotle's models and several other models."
},
{
"code": null,
"e": 65347,
"s": 65091,
"text": "You should always keep in mind that each of these models has both their advantages and disadvantages. While some communication models try to break down the whole process in order to make it easier to understand, they are not always as simple as they seem."
},
{
"code": null,
"e": 65524,
"s": 65347,
"text": "There are several complexities involved in communications models. This is one thing that needs to be carefully understood in the process of understanding how these models work."
},
{
"code": null,
"e": 65672,
"s": 65524,
"text": "You need to keep in mind that these complexities that accompany the communication models may only make understanding the communication much harder."
},
{
"code": null,
"e": 65839,
"s": 65672,
"text": "It is best that both parties, the source (sender) and the receiver, are clear about what they would like to discuss. This is also known as the context of the message."
},
{
"code": null,
"e": 66100,
"s": 65839,
"text": "This would make it much easier to decode what the other party is saying without too much trouble. The process of communication, if kept simple and to the point, should not usually have too many issues, and the message will be easily understood by both parties."
},
{
"code": null,
"e": 66282,
"s": 66100,
"text": "Often you would come across organizations that stress the importance of good communication management. It's empirical for an organization to have a proper communication management."
},
{
"code": null,
"e": 66514,
"s": 66282,
"text": "Once this is achieved, the organization is one step closer to achieving its overall business objectives. Communication management refers to a systematic plan, which implements and monitors the channels and content of communication."
},
{
"code": null,
"e": 66632,
"s": 66514,
"text": "To become a good manager, one must have a contingency approach at hand when it comes to communicating with employees."
},
{
"code": null,
"e": 66798,
"s": 66632,
"text": "An effective communication management is considered to be a lifeline for many projects that an organization undertakes as well as any department of the organization."
},
{
"code": null,
"e": 66974,
"s": 66798,
"text": "The five W's in communication are crucial and need to be addressed for a project or organizational function to be successful by means of an effective communication management."
},
{
"code": null,
"e": 67031,
"s": 66974,
"text": "Following are the five W's of communications management:"
},
{
"code": null,
"e": 67078,
"s": 67031,
"text": "What information is essential for the project?"
},
{
"code": null,
"e": 67125,
"s": 67078,
"text": "What information is essential for the project?"
},
{
"code": null,
"e": 67190,
"s": 67125,
"text": "Who requires information and what type of information is needed?"
},
{
"code": null,
"e": 67255,
"s": 67190,
"text": "Who requires information and what type of information is needed?"
},
{
"code": null,
"e": 67314,
"s": 67255,
"text": "What is the duration of time required for the information?"
},
{
"code": null,
"e": 67373,
"s": 67314,
"text": "What is the duration of time required for the information?"
},
{
"code": null,
"e": 67421,
"s": 67373,
"text": "What type or format of information is required?"
},
{
"code": null,
"e": 67469,
"s": 67421,
"text": "What type or format of information is required?"
},
{
"code": null,
"e": 67557,
"s": 67469,
"text": "Who are the person/s who will be responsible for transmitting the collated information?"
},
{
"code": null,
"e": 67645,
"s": 67557,
"text": "Who are the person/s who will be responsible for transmitting the collated information?"
},
{
"code": null,
"e": 67817,
"s": 67645,
"text": "The five W's in communication management are only the guidelines. Therefore, you do need to take other considerations into account, such as cost and access to information."
},
{
"code": null,
"e": 67947,
"s": 67817,
"text": "The main objective of communication management is to ensure smooth flow of information from either between two people or a group."
},
{
"code": null,
"e": 68015,
"s": 67947,
"text": "Let us examine the communication process with the use of a diagram."
},
{
"code": null,
"e": 68236,
"s": 68015,
"text": "The communication process consists of three main divisions; sender transmits a message via a channel to the receiver. As per the above diagram, the sender first develops an idea, which then can be processed as a message."
},
{
"code": null,
"e": 68350,
"s": 68236,
"text": "This message is transmitted to the receiver. The receiver has to interpret the message to understand its meaning."
},
{
"code": null,
"e": 68551,
"s": 68350,
"text": "When it comes to the interpretation, the context of the message should be used for deriving the meaning. Furthermore, for this communication process model, you will also utilize encoding and decoding."
},
{
"code": null,
"e": 68743,
"s": 68551,
"text": "Encoding refers to developing a message and decoding refers to interpreting or understanding the message. You will also notice the feedback factor, which the sender and receiver both involve."
},
{
"code": null,
"e": 68967,
"s": 68743,
"text": "Feedback is crucial for any communication process to be successful. Feedback allows immediate managers or supervisors to analyze how well subordinates understand the information provided and to know the performance of work."
},
{
"code": null,
"e": 69149,
"s": 68967,
"text": "Understanding the communication process alone will not guarantee success for managers or an organization. Managers need to be aware of the methods used in the communication process."
},
{
"code": null,
"e": 69291,
"s": 69149,
"text": "The standard methods of communication that are widely used by managers and organizations across the world are either written or oral methods."
},
{
"code": null,
"e": 69431,
"s": 69291,
"text": "Apart from these two mechanisms, non-verbal communication is another prominent method used to assess communication within the organization."
},
{
"code": null,
"e": 69628,
"s": 69431,
"text": "Non-verbal communication refers to the use of body language as a method of communication. This method will include gestures, actions, physical appearance as well as facial appearance and attitude."
},
{
"code": null,
"e": 69847,
"s": 69628,
"text": "Although most of these methods are still in use for a larger part of the organization, the usage of e-mail and other electronic mediums as a method of communication has lessened the need for face-to-face communication."
},
{
"code": null,
"e": 70011,
"s": 69847,
"text": "This sometimes leads to situations where both parties involved do not trust or feel comfortable with each other and also the messages can be easily misinterpreted."
},
{
"code": null,
"e": 70243,
"s": 70011,
"text": "A large proportion of oral communication is directly involved in communications management. For example, if a manager does not converse or make it clear to a sales team, this may lead to differences in objectives and achievements."
},
{
"code": null,
"e": 70332,
"s": 70243,
"text": "There are two aspects of oral communication, active listening and constructive feedback."
},
{
"code": null,
"e": 70444,
"s": 70332,
"text": "This is where the person, who receives the message pays attention to the information, interprets and remembers."
},
{
"code": null,
"e": 70570,
"s": 70444,
"text": "As you would be aware, listening helps you to pay attention and following are some points, which illustrate active listening."
},
{
"code": null,
"e": 70613,
"s": 70570,
"text": "Making eye contact with the relevant party"
},
{
"code": null,
"e": 70656,
"s": 70613,
"text": "Making eye contact with the relevant party"
},
{
"code": null,
"e": 70707,
"s": 70656,
"text": "Making sure to clarify questions if it's not clear"
},
{
"code": null,
"e": 70758,
"s": 70707,
"text": "Making sure to clarify questions if it's not clear"
},
{
"code": null,
"e": 70822,
"s": 70758,
"text": "Avoiding using gestures, which are distracting or uncomfortable"
},
{
"code": null,
"e": 70886,
"s": 70822,
"text": "Avoiding using gestures, which are distracting or uncomfortable"
},
{
"code": null,
"e": 71061,
"s": 70886,
"text": "This is where managers fail most of the time. Feedback needs to be constructive and then it will help the employees to shape up their performance instead of mere criticism. "
},
{
"code": null,
"e": 71259,
"s": 71061,
"text": "Communication management is vital for any organization irrespective of its size. It contributes to achieving the company's overall objectives as well as creates a positive and friendly environment."
},
{
"code": null,
"e": 71406,
"s": 71259,
"text": "An effective communication process within the organization will lead to an increase in profits, high employee satisfaction and brand recognition. "
},
{
"code": null,
"e": 71653,
"s": 71406,
"text": "Organizational conflict occurs when two or more parties, who have different objectives, values or attitudes compete for the same resources. Conflicts can arise due to disagreements between individuals or departments due to their dissimilar focus."
},
{
"code": null,
"e": 71795,
"s": 71653,
"text": "Contrary to popular belief, not all organizational conflicts are detrimental to the effective functioning of the business or project at hand."
},
{
"code": null,
"e": 72218,
"s": 71795,
"text": "Popular management theorists have recognized the fact that groups tend to storm before performing, and in one sense, this can be advantageous, as it brings problems out into the open, addresses the need to resolve such issues satisfactorily, motivates staff to seek acceptable solutions and each department or person embroiled in the conflict learns to respect and even benefit from the inherent differences of each other."
},
{
"code": null,
"e": 72432,
"s": 72218,
"text": "However, some conflicts spin out of control. This lower employee morale results in unacceptable behavioral patterns, reduces productivity and causes an escalation in differences that makes bridges harder to build."
},
{
"code": null,
"e": 72631,
"s": 72432,
"text": "Identifying actions that aggravate conflict, others that resolve differences and the different method of coping with conflict are all part of conflict management which are discussed in detail below."
},
{
"code": null,
"e": 72891,
"s": 72631,
"text": "Ill-defined expectations, non-consultative changes and feelings of helplessness in the decision making process tend to aggravate conflict. Poor communication, an authoritative style of leadership and impromptu planning are at the very heart of these problems."
},
{
"code": null,
"e": 73195,
"s": 72891,
"text": "Ambiguous objectives, inadequate allocation of resources, be it time, money or personnel, and badly defined process structures heighten such issues even further. Egotistic behavior, battle between Alpha dogs for supremacy and poor management techniques also play a pivotal role in aggravating conflicts."
},
{
"code": null,
"e": 73328,
"s": 73195,
"text": "A lack of understanding, an excuse-ridden culture and avoidance of accountability too increase the detrimental effects of conflicts."
},
{
"code": null,
"e": 73585,
"s": 73328,
"text": "Formulating well-defined job descriptions in a consultative manner, ensuring that any overlaps are minimized and carrying out periodical reviews to ascertain that such documentation is accurate, give the employees a sense of control over their own destiny."
},
{
"code": null,
"e": 73690,
"s": 73585,
"text": "This participative approach goes a long way in minimizing conflicts and helps foster better work ethics."
},
{
"code": null,
"e": 74042,
"s": 73690,
"text": "Formulating cross-departmental teams to solve specific problems, conducting outbound training, which fosters team spirit, holding regular meeting where feedback on performance is given and where the challenges faced are addressed and the solutions are discussed are some of the other relationship building techniques used by progressive organizations."
},
{
"code": null,
"e": 74143,
"s": 74042,
"text": "The four most popular methods of handling conflict can be summarized as fight, flight, fake or fold."
},
{
"code": null,
"e": 74278,
"s": 74143,
"text": "To elaborate further, fighting is where one party tends to dominate another by way of repetitive arguments, labeling and name-calling."
},
{
"code": null,
"e": 74525,
"s": 74278,
"text": "Flight is where people run away from problems instead of confronting them and turns to avoidance as a means of handling conflict. Faking, as its name implies, means agreeing to the solution presented, although in reality, the opposite holds true."
},
{
"code": null,
"e": 74706,
"s": 74525,
"text": "Folding is where an individual is made to agree to a solution by means of browbeating. However, none of the aforementioned method would yield satisfactory results in the long term."
},
{
"code": null,
"e": 74930,
"s": 74706,
"text": "Even today, compromise and collaboration go a long way in resolving conflicts in an optimal manner, as both are win-win situations for the most part, after which, interested parties can work together to reach a common goal."
},
{
"code": null,
"e": 75147,
"s": 74930,
"text": "Effective dialogue paves the way for conflict resolution. If the disagreements cannot be resolved by the two parties themselves, then a third party arbitrator or counselor might need to be consulted for best results."
},
{
"code": null,
"e": 75430,
"s": 75147,
"text": "Communication skills, negotiation skills and the ability to see the whole picture are necessary skills in conflict management. Listening skills and the ability to find solutions that do not compromise any party's interest are also worth developing when handling conflict management."
},
{
"code": null,
"e": 75452,
"s": 75430,
"text": "Identify the problem."
},
{
"code": null,
"e": 75474,
"s": 75452,
"text": "Identify the problem."
},
{
"code": null,
"e": 75572,
"s": 75474,
"text": "Identify the limiting resource or constraint that is generally at the root cause of the conflict."
},
{
"code": null,
"e": 75670,
"s": 75572,
"text": "Identify the limiting resource or constraint that is generally at the root cause of the conflict."
},
{
"code": null,
"e": 75787,
"s": 75670,
"text": "Engage in participatory dialogue and find a range of solutions that will be acceptable to all the parties concerned."
},
{
"code": null,
"e": 75904,
"s": 75787,
"text": "Engage in participatory dialogue and find a range of solutions that will be acceptable to all the parties concerned."
},
{
"code": null,
"e": 76016,
"s": 75904,
"text": "See which solutions clash with the organizational objectives and are not in keeping with the company's culture."
},
{
"code": null,
"e": 76128,
"s": 76016,
"text": "See which solutions clash with the organizational objectives and are not in keeping with the company's culture."
},
{
"code": null,
"e": 76200,
"s": 76128,
"text": "Eliminate those that do not promote mutual understanding or acceptance."
},
{
"code": null,
"e": 76272,
"s": 76200,
"text": "Eliminate those that do not promote mutual understanding or acceptance."
},
{
"code": null,
"e": 76359,
"s": 76272,
"text": "Choose the best solution that satisfy most people most of the time and implement this."
},
{
"code": null,
"e": 76446,
"s": 76359,
"text": "Choose the best solution that satisfy most people most of the time and implement this."
},
{
"code": null,
"e": 76536,
"s": 76446,
"text": "Conflicts are inevitable in one's personal life in organizations or even between nations."
},
{
"code": null,
"e": 76852,
"s": 76536,
"text": "It does have some noteworthy advantages if handled correctly as it brings problems out into the open and compels interested parties to find solutions that are acceptable to all. However, conflicts that escalate out of control are detrimental to everybody in the equation, so conflict management becomes a necessity."
},
{
"code": null,
"e": 77035,
"s": 76852,
"text": "Some basic skills, some knowledge, and having the best interest of the organization at heart, together with respect for its people, will go a long way in handling conflict admirably."
},
{
"code": null,
"e": 77172,
"s": 77035,
"text": "In any organization or business, it is always essential that you are prepared for any problems that may arise when it is least expected."
},
{
"code": null,
"e": 77487,
"s": 77172,
"text": "It is in the way that you deal with these issues that the success of your business will be based on. It is a well known fact that the biggest blow to an organization comes from the major unpredictable disasters that occur often leaving everyone, from the management to the public, involved in a state of confusion."
},
{
"code": null,
"e": 77680,
"s": 77487,
"text": "No organization however big or famous is immune from various crises. This may include situations such as your computer systems failing or even worse, infrastructure being completely destroyed."
},
{
"code": null,
"e": 77841,
"s": 77680,
"text": "Crisis management has entered the field of management only very recently but has since contributed a great deal to the prevention of major management disasters."
},
{
"code": null,
"e": 78023,
"s": 77841,
"text": "What crisis management typically requires is that you carry out forecasting of certain crises that you think could occur in the near future, putting your organization into jeopardy."
},
{
"code": null,
"e": 78239,
"s": 78023,
"text": "You then also come up with a solution as to how you would go about dealing with such a crisis. This would also require you to have a clear plan of all steps that would need to be taken should such a situation arise."
},
{
"code": null,
"e": 78479,
"s": 78239,
"text": "However, it may not always be the case that the organization has time to prepare for such a crisis. In such a situation, the management team would need to work on mitigating the amount of loss caused and recovering from the crisis at hand."
},
{
"code": null,
"e": 78605,
"s": 78479,
"text": "It is important that you have a good understanding of the different types of crises that could take place at the very outset."
},
{
"code": null,
"e": 78854,
"s": 78605,
"text": "This is vital as all crises cannot be handled in the same manner and would require different approaches and various techniques to be applied. Although types of crises can be categorized into several kinds, the most common categories are as follows:"
},
{
"code": null,
"e": 79106,
"s": 78854,
"text": "Financial crises - This would be a huge problem for any organization, but is fairly predictable to quite an extent when compared with other types of crises. Such a crisis would basically involve the organization heading in the direction of bankruptcy."
},
{
"code": null,
"e": 79358,
"s": 79106,
"text": "Financial crises - This would be a huge problem for any organization, but is fairly predictable to quite an extent when compared with other types of crises. Such a crisis would basically involve the organization heading in the direction of bankruptcy."
},
{
"code": null,
"e": 79696,
"s": 79358,
"text": "Natural disasters - This type of crisis is highly unpredictable and could come by at any time. Several examples of such situations could be given today, from example, earthquakes in countries such as China a few years ago and Haiti and other disasters such as tsunamis and hurricanes, you should always be ready to face such a situation."
},
{
"code": null,
"e": 80034,
"s": 79696,
"text": "Natural disasters - This type of crisis is highly unpredictable and could come by at any time. Several examples of such situations could be given today, from example, earthquakes in countries such as China a few years ago and Haiti and other disasters such as tsunamis and hurricanes, you should always be ready to face such a situation."
},
{
"code": null,
"e": 80517,
"s": 80034,
"text": "Technological crises - This is where a system collapses due to failure in the functioning of different equipment and machinery used. As mentioned previously, a computer system failure is one example of such a crisis. These crises could occur either because of human error or a fault in the system used which has multiple consequences. This may also include chemical spills and oil leaks. One famous case is that of the Chernobyl nuclear power plant in 1986 which caused much damage."
},
{
"code": null,
"e": 81000,
"s": 80517,
"text": "Technological crises - This is where a system collapses due to failure in the functioning of different equipment and machinery used. As mentioned previously, a computer system failure is one example of such a crisis. These crises could occur either because of human error or a fault in the system used which has multiple consequences. This may also include chemical spills and oil leaks. One famous case is that of the Chernobyl nuclear power plant in 1986 which caused much damage."
},
{
"code": null,
"e": 81178,
"s": 81000,
"text": "Political & Social - With the current political climate the world over, you may also want to take into consideration any threats to security and any form of terrorist activity."
},
{
"code": null,
"e": 81356,
"s": 81178,
"text": "Political & Social - With the current political climate the world over, you may also want to take into consideration any threats to security and any form of terrorist activity."
},
{
"code": null,
"e": 81465,
"s": 81356,
"text": "No organization is free from internal politics and disagreement between the various levels of the workforce."
},
{
"code": null,
"e": 81738,
"s": 81465,
"text": "It is therefore essential that you always keep in mind that high-ranking workers could always resign in the middle of an important project or the workers may plan a strike or protest to express their disgruntlement with the way certain aspects of the organization are run."
},
{
"code": null,
"e": 81917,
"s": 81738,
"text": "Knowing how to manage employee disgruntlement is therefore key to preventing any future fights from erupting, impeding the progress of work being carried out by the organization."
},
{
"code": null,
"e": 82069,
"s": 81917,
"text": "Without a clear plan as to how to deal with the crises that could occur at the very outset, you would only drag the organization into greater problems."
},
{
"code": null,
"e": 82204,
"s": 82069,
"text": "It is very important that someone plays the role of a leader and chooses a dynamic team in order to carry out all aspects of planning."
},
{
"code": null,
"e": 82441,
"s": 82204,
"text": "It is this management team that would have to not only ascertain what types of crises may occur, but then carry on to study various strategies that could be applied to minimize or even prevent altogether any damage that could be caused."
},
{
"code": null,
"e": 82523,
"s": 82441,
"text": "The next step would then be to try out these strategies and see if it would work."
},
{
"code": null,
"e": 82737,
"s": 82523,
"text": "At times such as these, your organization would benefit greatly from other organizations that would be able to provide you with invaluable resources to help you mitigate the crises to the greatest extent possible."
},
{
"code": null,
"e": 82893,
"s": 82737,
"text": "It is essential to keep in mind that when a crisis occurs you would need to have a response team ready to deal with the media and the various stakeholders."
},
{
"code": null,
"e": 83096,
"s": 82893,
"text": "All these parties would need information on the given situation and what is being done to deal with it. This also requires you to have a clear crisis communication plan with the target audience in mind."
},
{
"code": null,
"e": 83260,
"s": 83096,
"text": "Remember that each group needs to be handled in a different manner; customers may not require the same information as the employees of the organization, and so on."
},
{
"code": null,
"e": 83437,
"s": 83260,
"text": "The only way to successfully control a crisis from going out of your hands is to always have a good plan and a good team ready to deal with various situations that may crop up."
},
{
"code": null,
"e": 83561,
"s": 83437,
"text": "With these strategies in place, you would always be able to reduce the damage caused to the organization to a great extent."
},
{
"code": null,
"e": 83697,
"s": 83561,
"text": "When it comes to a project, it has a lower limit of possible lead time. This basically determines the cost associated with the project."
},
{
"code": null,
"e": 84011,
"s": 83697,
"text": "The critical chain of a project is the dependent tasks that define the lower limit of possible lead time. Therefore, it is safe to assume that the critical chain is made of sequenced dependent tasks. In critical chain scheduling (CCS), these dependent tasks are scheduled in the most effective and beneficial way."
},
{
"code": null,
"e": 84210,
"s": 84011,
"text": "When it comes to critical chain scheduling, dependencies are used to determine the critical chain. In this case, two types of dependencies are used; hands-off dependencies and resource dependencies."
},
{
"code": null,
"e": 84358,
"s": 84210,
"text": "This simply means that output of one task is the input for another. Therefore, the latter task cannot be started until the first task is completed."
},
{
"code": null,
"e": 84503,
"s": 84358,
"text": "In this case, one task is utilizing a resource, so the other task cannot be started until the first task is completed and the resource is freed."
},
{
"code": null,
"e": 84645,
"s": 84503,
"text": "In simple, using traditional project management terminology, the critical chain can be explained as the \"resource constrained critical path\"."
},
{
"code": null,
"e": 84951,
"s": 84645,
"text": "Critical chain scheduling appreciates the \"impact of variation\" of a project. Usually, in project management, the impact of variation is found using statistical models such as PERT or Mote Carlo analysis. Critical chain scheduling does complement the impact of variance with a concept called the \"buffer\"."
},
{
"code": null,
"e": 85138,
"s": 84951,
"text": "We will discuss more about the buffer later. The buffer basically protects the critical chain from variations in other non-critical chains making sure critical chain the indeed critical."
},
{
"code": null,
"e": 85400,
"s": 85138,
"text": "Buffer is one of the most interesting concepts in critical chain scheduling. The buffers are constructed and applied to a project in order to make sure the success of the project. The buffer protects the due delivery dates from variations to the critical chain."
},
{
"code": null,
"e": 85808,
"s": 85400,
"text": "With a \"feeding buffer\" of a proper size, the dependent tasks in the critical chain that is dependent on the output of the non-critical chain tasks have a great opportunity to start the task as soon as its predecessor dependent task in the critical chain is finished. Therefore, with the feeding buffer, the dependent tasks in the critical chain do not have to wait for non-critical chain tasks to complete."
},
{
"code": null,
"e": 85893,
"s": 85808,
"text": "This makes sure that the critical chain moves faster towards the project completion."
},
{
"code": null,
"e": 86136,
"s": 85893,
"text": "When there are multiple projects running in an organization, critical chain scheduling employs something called \"capacity buffers.\" These buffers are used to isolate key resource performance variances in one project impacting another project."
},
{
"code": null,
"e": 86276,
"s": 86136,
"text": "Resource buffers are the other type of buffer employed for projects in order to manage the impact by the resources to the project progress."
},
{
"code": null,
"e": 86702,
"s": 86276,
"text": "Usually, the critical path goes from start of the project to the end of the project. Instead, the critical chain ends at the start of the buffer assigned to the project. This buffer is called \"project buffer.\" This is the fundamental difference between the critical path and the critical chain. When it comes to critical path, activity sequencing is performed. But with critical chain, critical chain scheduling is performed."
},
{
"code": null,
"e": 87104,
"s": 86702,
"text": "When it comes to the project schedule, the critical path is more subjective towards the milestones and deadlines. In critical path, not much of emphasis is given to resource utilization. Therefore, many experts believe that the critical path is what you get before you level the resources of the project. One other reason for this is, in critical path, hands-off dependencies are given the precedence."
},
{
"code": null,
"e": 87201,
"s": 87104,
"text": "When it comes to critical chain, it is more defined as a resource-levelled set of project tasks."
},
{
"code": null,
"e": 87546,
"s": 87201,
"text": "Same as for critical path methodology, there is software for critical chain scheduling. This software can be categorized into \"standalone\" and \"client-server\" categories. This software supports multi-project environments by default. Therefore, this software is useful when it comes to managing a large project portfolio of a large organization."
},
{
"code": null,
"e": 87878,
"s": 87546,
"text": "Critical chain scheduling is a methodology focused on resource-levelling. Although dependent tasks mostly define the project timelines, the resource utilization plays a key role. A methodology such as critical path may be highly successful in environments, where there is no resource shortage. But in reality, this is not the case."
},
{
"code": null,
"e": 88112,
"s": 87878,
"text": "Projects run with limited resources and resource-levelling is a critical factor when it comes to the practicality. Therefore, critical chain scheduling gives a better answer for resource intensive projects to manage their deliveries."
},
{
"code": null,
"e": 88219,
"s": 88112,
"text": "If you have been into project management, I'm sure you have already heard the term 'critical path method.'"
},
{
"code": null,
"e": 88357,
"s": 88219,
"text": "If you are new to the subject, it is best to start with understanding the 'critical path' and then move on to the 'critical path method.'"
},
{
"code": null,
"e": 88589,
"s": 88357,
"text": "Critical path is the sequential activities from start to the end of a project. Although many projects have only one critical path, some projects may have more than one critical paths depending on the flow logic used in the project."
},
{
"code": null,
"e": 88710,
"s": 88589,
"text": "If there is a delay in any of the activities under the critical path, there will be a delay of the project deliverables."
},
{
"code": null,
"e": 88837,
"s": 88710,
"text": "Most of the times, if such delay is occurred, project acceleration or re-sequencing is done in order to achieve the deadlines."
},
{
"code": null,
"e": 89066,
"s": 88837,
"text": "Critical path method is based on mathematical calculations and it is used for scheduling project activities. This method was first introduced in 1950s as a joint venture between Remington Rand Corporation and DuPont Corporation."
},
{
"code": null,
"e": 89298,
"s": 89066,
"text": "The initial critical path method was used for managing plant maintenance projects. Although the original method was developed for construction work, this method can be used for any project where there are interdependent activities."
},
{
"code": null,
"e": 89483,
"s": 89298,
"text": "In the critical path method, the critical activities of a program or a project are identified. These are the activities that have a direct impact on the completion date of the project."
},
{
"code": null,
"e": 89633,
"s": 89483,
"text": "Let's have a look at how critical path method is used in practice. The process of using critical path method in project planning phase has six steps."
},
{
"code": null,
"e": 89785,
"s": 89633,
"text": "You can use the Work Breakdown Structure (WBS) to identify the activities involved in the project. This is the main input for the critical path method."
},
{
"code": null,
"e": 89884,
"s": 89785,
"text": "In activity specification, only the higher-level activities are selected for critical path method."
},
{
"code": null,
"e": 89991,
"s": 89884,
"text": "When detailed activities are used, the critical path method may become too complex to manage and maintain."
},
{
"code": null,
"e": 90121,
"s": 89991,
"text": "In this step, the correct activity sequence is established. For that, you need to ask three questions for each task of your list."
},
{
"code": null,
"e": 90177,
"s": 90121,
"text": "Which tasks should take place before this task happens."
},
{
"code": null,
"e": 90233,
"s": 90177,
"text": "Which tasks should take place before this task happens."
},
{
"code": null,
"e": 90296,
"s": 90233,
"text": "Which tasks should be completed at the same time as this task."
},
{
"code": null,
"e": 90359,
"s": 90296,
"text": "Which tasks should be completed at the same time as this task."
},
{
"code": null,
"e": 90414,
"s": 90359,
"text": "Which tasks should happen immediately after this task."
},
{
"code": null,
"e": 90469,
"s": 90414,
"text": "Which tasks should happen immediately after this task."
},
{
"code": null,
"e": 90591,
"s": 90469,
"text": "Once the activity sequence is correctly identified, the network diagram can be drawn (refer to the sample diagram above)."
},
{
"code": null,
"e": 90728,
"s": 90591,
"text": "Although the early diagrams were drawn on paper, there are a number of computer softwares, such as Primavera, for this purpose nowadays."
},
{
"code": null,
"e": 90927,
"s": 90728,
"text": "This could be a direct input from the WBS based estimation sheet. Most of the companies use 3-point estimation method or COCOMO based (function points based) estimation methods for tasks estimation."
},
{
"code": null,
"e": 90997,
"s": 90927,
"text": "You can use such estimation information for this step of the process."
},
{
"code": null,
"e": 91078,
"s": 90997,
"text": "For this, you need to determine four parameters of each activity of the network."
},
{
"code": null,
"e": 91194,
"s": 91078,
"text": "Earliest start time (ES) - The earliest time an activity can start once the previous dependent activities are over."
},
{
"code": null,
"e": 91310,
"s": 91194,
"text": "Earliest start time (ES) - The earliest time an activity can start once the previous dependent activities are over."
},
{
"code": null,
"e": 91362,
"s": 91310,
"text": "Earliest finish time (EF) - ES + activity duration."
},
{
"code": null,
"e": 91414,
"s": 91362,
"text": "Earliest finish time (EF) - ES + activity duration."
},
{
"code": null,
"e": 91509,
"s": 91414,
"text": "Latest finish time (LF) - The latest time an activity can finish without delaying the project."
},
{
"code": null,
"e": 91604,
"s": 91509,
"text": "Latest finish time (LF) - The latest time an activity can finish without delaying the project."
},
{
"code": null,
"e": 91653,
"s": 91604,
"text": "Latest start time (LS) - LF - activity duration."
},
{
"code": null,
"e": 91702,
"s": 91653,
"text": "Latest start time (LS) - LF - activity duration."
},
{
"code": null,
"e": 91861,
"s": 91702,
"text": "The float time for an activity is the time between the earliest (ES) and the latest (LS) start time or between the earliest (EF) and latest (LF) finish times."
},
{
"code": null,
"e": 91953,
"s": 91861,
"text": "During the float time, an activity can be delayed without delaying the project finish date."
},
{
"code": null,
"e": 92167,
"s": 91953,
"text": "The critical path is the longest path of the network diagram. The activities in the critical path have an effect on the deadline of the project. If an activity of this path is delayed, the project will be delayed."
},
{
"code": null,
"e": 92292,
"s": 92167,
"text": "In case if the project management needs to accelerate the project, the times for critical path activities should be reduced."
},
{
"code": null,
"e": 92423,
"s": 92292,
"text": "Critical path diagram is a live artefact. Therefore, this diagram should be updated with actual values once the task is completed."
},
{
"code": null,
"e": 92563,
"s": 92423,
"text": "This gives more realistic figure for the deadline and the project management can know whether they are on track regarding the deliverables."
},
{
"code": null,
"e": 92614,
"s": 92563,
"text": "Following are advantages of critical path methods:"
},
{
"code": null,
"e": 92672,
"s": 92614,
"text": "Offers a visual representation of the project activities."
},
{
"code": null,
"e": 92730,
"s": 92672,
"text": "Offers a visual representation of the project activities."
},
{
"code": null,
"e": 92795,
"s": 92730,
"text": "Presents the time to complete the tasks and the overall project."
},
{
"code": null,
"e": 92860,
"s": 92795,
"text": "Presents the time to complete the tasks and the overall project."
},
{
"code": null,
"e": 92893,
"s": 92860,
"text": "Tracking of critical activities."
},
{
"code": null,
"e": 92926,
"s": 92893,
"text": "Tracking of critical activities."
},
{
"code": null,
"e": 93125,
"s": 92926,
"text": "Critical path identification is required for any project-planning phase. This gives the project management the correct completion date of the overall project and the flexibility to float activities."
},
{
"code": null,
"e": 93299,
"s": 93125,
"text": "A critical path diagram should be constantly updated with actual information when the project progresses in order to refine the activity length/project duration predictions."
},
{
"code": null,
"e": 93481,
"s": 93299,
"text": "Decision making is a daily activity for any human being. There is no exception about that. When it comes to business organizations, decision making is a habit and a process as well."
},
{
"code": null,
"e": 93673,
"s": 93481,
"text": "Effective and successful decisions make profit to the company and unsuccessful ones make losses. Therefore, corporate decision making process is the most critical process in any organization."
},
{
"code": null,
"e": 93857,
"s": 93673,
"text": "In the decision making process, we choose one course of action from a few possible alternatives. In the process of decision making, we may use many tools, techniques and perceptions."
},
{
"code": null,
"e": 93945,
"s": 93857,
"text": "In addition, we may make our own private decisions or may prefer a collective decision."
},
{
"code": null,
"e": 94081,
"s": 93945,
"text": "Usually, decision making is hard. Majority of corporate decisions involve some level of dissatisfaction or conflict with another party."
},
{
"code": null,
"e": 94141,
"s": 94081,
"text": "Let's have a look at the decision making process in detail."
},
{
"code": null,
"e": 94269,
"s": 94141,
"text": "Following are the important steps of the decision making process. Each step may be supported by different tools and techniques."
},
{
"code": null,
"e": 94424,
"s": 94269,
"text": "In this step, the problem is thoroughly analysed. There are a couple of questions one should ask when it comes to identifying the purpose of the decision."
},
{
"code": null,
"e": 94453,
"s": 94424,
"text": "What exactly is the problem?"
},
{
"code": null,
"e": 94482,
"s": 94453,
"text": "What exactly is the problem?"
},
{
"code": null,
"e": 94516,
"s": 94482,
"text": "Why the problem should be solved?"
},
{
"code": null,
"e": 94550,
"s": 94516,
"text": "Why the problem should be solved?"
},
{
"code": null,
"e": 94595,
"s": 94550,
"text": "Who are the affected parties of the problem?"
},
{
"code": null,
"e": 94640,
"s": 94595,
"text": "Who are the affected parties of the problem?"
},
{
"code": null,
"e": 94698,
"s": 94640,
"text": "Does the problem have a deadline or a specific time-line?"
},
{
"code": null,
"e": 94756,
"s": 94698,
"text": "Does the problem have a deadline or a specific time-line?"
},
{
"code": null,
"e": 94896,
"s": 94756,
"text": "A problem of an organization will have many stakeholders. In addition, there can be dozens of factors involved and affected by the problem."
},
{
"code": null,
"e": 95143,
"s": 94896,
"text": "In the process of solving the problem, you will have to gather as much as information related to the factors and stakeholders involved in the problem. For the process of information gathering, tools such as 'Check Sheets' can be effectively used."
},
{
"code": null,
"e": 95356,
"s": 95143,
"text": "In this step, the baseline criteria for judging the alternatives should be set up. When it comes to defining the criteria, organizational goals as well as the corporate culture should be taken into consideration."
},
{
"code": null,
"e": 95618,
"s": 95356,
"text": "As an example, profit is one of the main concerns in every decision making process. Companies usually do not make decisions that reduce profits, unless it is an exceptional case. Likewise, baseline principles should be identified related to the problem in hand."
},
{
"code": null,
"e": 95809,
"s": 95618,
"text": "For this step, brainstorming to list down all the ideas is the best option. Before the idea generation step, it is vital to understand the causes of the problem and prioritization of causes."
},
{
"code": null,
"e": 96056,
"s": 95809,
"text": "For this, you can make use of Cause-and-Effect diagrams and Pareto Chart tool. Cause-and-Effect diagram helps you to identify all possible causes of the problem and Pareto chart helps you to prioritize and identify the causes with highest effect."
},
{
"code": null,
"e": 96152,
"s": 96056,
"text": "Then, you can move on generating all possible solutions (alternatives) for the problem in hand."
},
{
"code": null,
"e": 96400,
"s": 96152,
"text": "Use your judgement principles and decision-making criteria to evaluate each alternative. In this step, experience and effectiveness of the judgement principles come into play. You need to compare each alternative for their positives and negatives."
},
{
"code": null,
"e": 96626,
"s": 96400,
"text": "Once you go through from Step 1 to Step 5, this step is easy. In addition, the selection of the best alternative is an informed decision since you have already followed a methodology to derive and select the best alternative."
},
{
"code": null,
"e": 96753,
"s": 96626,
"text": "Convert your decision into a plan or a sequence of activities. Execute your plan by yourself or with the help of subordinates."
},
{
"code": null,
"e": 96964,
"s": 96753,
"text": "Evaluate the outcome of your decision. See whether there is anything you should learn and then correct in future decision making. This is one of the best practices that will improve your decision-making skills."
},
{
"code": null,
"e": 97112,
"s": 96964,
"text": "When it comes to making decisions, one should always weigh the positive and negative business consequences and should favour the positive outcomes."
},
{
"code": null,
"e": 97355,
"s": 97112,
"text": "This avoids the possible losses to the organization and keeps the company running with a sustained growth. Sometimes, avoiding decision making seems easier; especially, when you get into a lot of confrontation after making the tough decision."
},
{
"code": null,
"e": 97480,
"s": 97355,
"text": "But, making the decisions and accepting its consequences is the only way to stay in control of your corporate life and time."
},
{
"code": null,
"e": 97727,
"s": 97480,
"text": "Design of Experiments (DOEs) refers to a structured, planned method, which is used to find the relationship between different factors (let's say, X variables) that affect a project and the different outcomes of a project (let's say, Y variables)."
},
{
"code": null,
"e": 97797,
"s": 97727,
"text": "The method was coined by Sir Ronald A. Fisher in the 1920s and 1930s."
},
{
"code": null,
"e": 98119,
"s": 97797,
"text": "Ten to twenty experiments are designed where the applicable factors varied methodically. The results of the experiments are then analyzed to classify optimal conditions to find the factors that have the most influence on the results as well as those that do not and to identify interfaces and synergies among the factors."
},
{
"code": null,
"e": 98266,
"s": 98119,
"text": "DOEs are mainly used in the research and development department of an organization where majority of resources goes towards optimization problems."
},
{
"code": null,
"e": 98509,
"s": 98266,
"text": "In order to minimize optimization problems, it is important to keep costs low by conducting few experiments. Design of Experiments is useful in this case, as it only necessitates a small number of experiments, thereby helping to reduce costs."
},
{
"code": null,
"e": 98618,
"s": 98509,
"text": "In order to use Design of Experiments successfully, it is important to adhere to eight fundamental concepts."
},
{
"code": null,
"e": 98753,
"s": 98618,
"text": "Once the following eight steps are sequentially followed, you will be able to receive a successful outcome from Design of Experiments."
},
{
"code": null,
"e": 98999,
"s": 98753,
"text": "Set Good Objectives: Before one begins to design an experiment, it is important to set out its objective. With a defined objective, it is easy to screen out factors not relevant to the experiment. This way one optimizes the key critical factors."
},
{
"code": null,
"e": 99216,
"s": 98999,
"text": "In the initial stages of project development, it is recommended to use a design of experiment, choice of a fractional two-level factorial. This design of experiments screens a large number of factors in minimal runs."
},
{
"code": null,
"e": 99443,
"s": 99216,
"text": "However, when one sets a set of good objectives, many irrelevant factors are eliminated. With well-defined objectives, managers can use a response surface design of experiment which explores few factors, albeit at many levels."
},
{
"code": null,
"e": 99599,
"s": 99443,
"text": "Also drawing up good objectives at the beginning helps build a solid understanding of the project as well as create realistic expectations of it's outcome."
},
{
"code": null,
"e": 99735,
"s": 99599,
"text": "Measure Responses Quantitatively: Many Designs of Experiments end in failure because their responses cannot be measured quantitatively."
},
{
"code": null,
"e": 99940,
"s": 99735,
"text": "For example, product inspectors use a qualitative method of determining if a product passes quality assurance or not. This is not efficient in designs of experiments as a pass/fail is not accurate enough."
},
{
"code": null,
"e": 100101,
"s": 99940,
"text": "Replicate to Dampen Uncontrollable Variation: Replicating a given set of conditions many times gives more opportunities for one to precisely estimate responses."
},
{
"code": null,
"e": 100254,
"s": 100101,
"text": "Replicating also gives one the opportunity to detect significant effects such as signals amid the natural process uncontrollable variations, like noise."
},
{
"code": null,
"e": 100408,
"s": 100254,
"text": "For some projects, variations such as noise drown out the signal, so it is useful to find the signal to noise ratio before doing a design of experiment. "
},
{
"code": null,
"e": 100582,
"s": 100408,
"text": "Randomize the Run Order: In order to evade uncontrollable influences such as changes in raw material and tool wear, it is necessary to run experiments in a randomized order."
},
{
"code": null,
"e": 100813,
"s": 100582,
"text": "These variable influences can have a significant effect on the selected variable. If an experiment is not run in a random order, the design of experiment will specify factor effects that are in fact from these variable influences."
},
{
"code": null,
"e": 100965,
"s": 100813,
"text": "Block out Known Sources of Variation: Through blocking, one can screen out the effects of known variables such as shift changes or machine differences."
},
{
"code": null,
"e": 101204,
"s": 100965,
"text": "One can divide the experimental runs into homogenous blocks and then mathematically remove the differences. This increases the sensitivity of the design of experiment. However, it is important to not block out anything one wants to study."
},
{
"code": null,
"e": 101338,
"s": 101204,
"text": "Know Which Effects (if any) Will be Aliased: An alias means that one has changed one or more things in the same way at the same time."
},
{
"code": null,
"e": 101562,
"s": 101338,
"text": "Do a Sequential Series of Experiments: When conducting a design of experiment it is important to conduct it in a chronological manner, that is, information gleaned in one experiment should be able to be applied to the next."
},
{
"code": null,
"e": 101686,
"s": 101562,
"text": "Always Confirm Critical Findings: At the end of a design of experiment, it is easy to assume that the results are accurate."
},
{
"code": null,
"e": 101837,
"s": 101686,
"text": "However, it is important to confirm one's findings and to verify the results. This validation can be done using many other management tools available."
},
{
"code": null,
"e": 102090,
"s": 101837,
"text": "Design of Experiments is an important tool that can be utilized in most manufacturing industries. Managers, who use the method, will not only save on costs but also make improvements in the quality of their product as well as ensure process efficiency."
},
{
"code": null,
"e": 102244,
"s": 102090,
"text": "Once Design of Experiments is completed, the managers should make an extra effort to validate the outcome and carry out further analysis of the findings."
},
{
"code": null,
"e": 102470,
"s": 102244,
"text": "Communication is the only interaction that we make when we involve with another party. Regardless of whether it is personal relationship or a professional one, communication keeps us connected to one another in the community."
},
{
"code": null,
"e": 102576,
"s": 102470,
"text": "Therefore, communication is the main mechanism where the conflicts are arisen as well as they are solved."
},
{
"code": null,
"e": 102716,
"s": 102576,
"text": "Therefore, effective communication can make sure that you communicate appropriately and correctly in order to minimize such confrontations."
},
{
"code": null,
"e": 102830,
"s": 102716,
"text": "In case, there are disagreements or conflicts, effective communication can be again used for solving such issues."
},
{
"code": null,
"e": 102923,
"s": 102830,
"text": "Following are the main skills one should have to master to become an effective communicator."
},
{
"code": null,
"e": 103133,
"s": 102923,
"text": "Although acquiring all these skills and mastering them to the same level seems to be challenging, knowing all these skills and slowly working on them will take you to the level you want to be in communication."
},
{
"code": null,
"e": 103236,
"s": 103133,
"text": "When you deal with a current crisis or an argument, relating something from the past is quite natural."
},
{
"code": null,
"e": 103355,
"s": 103236,
"text": "When this happens, most of the times, the discussion goes out of topic and the situation can become quite complicated."
},
{
"code": null,
"e": 103527,
"s": 103355,
"text": "Staying focused is one of the best skills not only for communicating under pressure, but for all types of communications ranging from lunch chitchats to board discussions."
},
{
"code": null,
"e": 103637,
"s": 103527,
"text": "If you go out of focus, there is a high chance that the end result of the communication may not be effective."
},
{
"code": null,
"e": 103767,
"s": 103637,
"text": "Although people think that they are listing when another person talks, actually they are spending time planning what to say next."
},
{
"code": null,
"e": 103933,
"s": 103767,
"text": "This is what we actually do! Therefore, you need to make an extra effort in order to listen to what the other person says and then come up with what you want to say."
},
{
"code": null,
"e": 104014,
"s": 103933,
"text": "If you are not sure what you've heard, repeat it and ask for their confirmation."
},
{
"code": null,
"e": 104168,
"s": 104014,
"text": "In most of the communications, we want ourselves heard and understood. We talk a lot on our point of view and try to get the buying of who are listening."
},
{
"code": null,
"e": 104295,
"s": 104168,
"text": "Remember, others also do the same! If you want them to hear you, you need to hear them and understand their point of view too."
},
{
"code": null,
"e": 104408,
"s": 104295,
"text": "If you can really see through their point of view, you can actually explain yours in a clear and applicable way."
},
{
"code": null,
"e": 104546,
"s": 104408,
"text": "Sometimes, we become really defensive when someone criticizes us. Since criticism has close ties with emotions, we can be easily erupted."
},
{
"code": null,
"e": 104672,
"s": 104546,
"text": "But, in communication, it is really important to listen to the other person's pain and difficulties and respond with empathy."
},
{
"code": null,
"e": 104773,
"s": 104672,
"text": "At the same time, try to extract the facts and the truth in what they say, it can be useful for you."
},
{
"code": null,
"e": 104917,
"s": 104773,
"text": "Taking personal responsibility is a strength. When it comes to effective communication, admitting what you did wrong is respected and required."
},
{
"code": null,
"e": 105086,
"s": 104917,
"text": "Most of the times, there are many people, who share responsibility in a conflict. In such cases, admit what is yours. This behaviour shows maturity and sets an example."
},
{
"code": null,
"e": 105175,
"s": 105086,
"text": "Your behaviour most probably will inspire others to take responsibility for their share."
},
{
"code": null,
"e": 105334,
"s": 105175,
"text": "We love to win arguments all the time, but how often have you felt empty inside after winning an argument? Sometimes, winning an argument does not make sense."
},
{
"code": null,
"e": 105475,
"s": 105334,
"text": "You may win the argument but might lose the corporation of other people. Communication is not about winning, it's about getting things done."
},
{
"code": null,
"e": 105591,
"s": 105475,
"text": "For the objective of getting things done, you may have to compromise in the process. If it is necessary, please do!"
},
{
"code": null,
"e": 105752,
"s": 105591,
"text": "Sometimes, you need to take a break in the middle of the discussion. If the communication is intensive, there can be ineffective communication pattern surfaced."
},
{
"code": null,
"e": 105967,
"s": 105752,
"text": "Once you notice such patterns, you need to take a break and then continue. When you continue after the break, all the parties involved in the discussion will be able to constructively contribute for the discussion."
},
{
"code": null,
"e": 106063,
"s": 105967,
"text": "Although there can be a lot of obstacles on your way, do not give up what you are fighting for."
},
{
"code": null,
"e": 106237,
"s": 106063,
"text": "Surely you may have to compromise, but clearly stand for what you believe in. When it comes to communication, all the parties involved should satisfy with the outcome of it."
},
{
"code": null,
"e": 106394,
"s": 106237,
"text": "Sometimes, you might have difficulties to communicate certain things to certain parties. This could be due to an issue related to respect or something else."
},
{
"code": null,
"e": 106495,
"s": 106394,
"text": "In such cases, seek help from others. Your manager will be one of the best persons to help you with."
},
{
"code": null,
"e": 106586,
"s": 106495,
"text": "In a corporate environment, effective communication is the key to win your way to success."
},
{
"code": null,
"e": 106738,
"s": 106586,
"text": "Regardless of whether you are targeting your career growth or winning the next big project, effective communication can make your way to the objective."
},
{
"code": null,
"e": 106836,
"s": 106738,
"text": "In addition, effective communication can get you a lot of support from your subordinates as well."
},
{
"code": null,
"e": 107073,
"s": 106836,
"text": "Have you ever seen a keynote presentation done by Steve Jobs, the CEO of Apple Inc? If you have, you know what it means to have 'effective presentation skills.' Steve Jobs is not the only one who has this ability, there are plenty more."
},
{
"code": null,
"e": 107272,
"s": 107073,
"text": "Problems are meant to exist in organizations. That's why there should be a strong process and supporting tools for identifying the causes of the problems before the problems damage the organization."
},
{
"code": null,
"e": 107454,
"s": 107272,
"text": "If you are to communicate an idea, concept or a product, you need to have good presentation skills in order to grab the attention of the audience and become the center of attention."
},
{
"code": null,
"e": 107616,
"s": 107454,
"text": "This way, it is easy for you to get the audience's support. The audience can range from your college classmates to an executive board of a multinational company."
},
{
"code": null,
"e": 107958,
"s": 107616,
"text": "There are many software packages you can use for presentation purposes. Of course, it is not mandatory to use software for your presentation, but the effect is much greater when you use such tools for your purpose. Many of these software tools are equipped with features and facilities to make your presentation experience easy and pleasant."
},
{
"code": null,
"e": 108278,
"s": 107958,
"text": "Having just an idea or a product to communicate and a software package to create your presentations do not make you an effective presenter. For this, you should prepare yourself in advance and also should develop some skills. Let's take a look at some of the pointers that will help you to become a top-class presenter."
},
{
"code": null,
"e": 108459,
"s": 108278,
"text": "The design and the layout of the presentation have an impact on how the audience receives it. Therefore, you need to focus more on the clarity of your presentation and the content."
},
{
"code": null,
"e": 108539,
"s": 108459,
"text": "Following are some points you should consider when designing your presentation."
},
{
"code": null,
"e": 108805,
"s": 108539,
"text": "Derive the top three goals that you want to accomplish through your presentation. The entire presentation should focus on achieving these three goals. If you are not clear about what you want to achieve, your audience can easily miss the point of your presentation."
},
{
"code": null,
"e": 109071,
"s": 108805,
"text": "Derive the top three goals that you want to accomplish through your presentation. The entire presentation should focus on achieving these three goals. If you are not clear about what you want to achieve, your audience can easily miss the point of your presentation."
},
{
"code": null,
"e": 109357,
"s": 109071,
"text": "Understand what your audience is. Think why they are there to see your presentation and their expectations. Study the background of the audience in advance if possible. When you do the presentation, make sure that you communicate to them that they are 'selected' for this presentation."
},
{
"code": null,
"e": 109643,
"s": 109357,
"text": "Understand what your audience is. Think why they are there to see your presentation and their expectations. Study the background of the audience in advance if possible. When you do the presentation, make sure that you communicate to them that they are 'selected' for this presentation."
},
{
"code": null,
"e": 109867,
"s": 109643,
"text": "Have a list of points that you want to communicate to your audience, prioritize them accordingly. See whether there is any point that is difficult to understand by the audience. If there are such points, chunk them further."
},
{
"code": null,
"e": 110091,
"s": 109867,
"text": "Have a list of points that you want to communicate to your audience, prioritize them accordingly. See whether there is any point that is difficult to understand by the audience. If there are such points, chunk them further."
},
{
"code": null,
"e": 110206,
"s": 110091,
"text": "Decide on the tone you want to use in the presentation. It could be motivational, informational, celebration, etc."
},
{
"code": null,
"e": 110321,
"s": 110206,
"text": "Decide on the tone you want to use in the presentation. It could be motivational, informational, celebration, etc."
},
{
"code": null,
"e": 110406,
"s": 110321,
"text": "Prepare an opening speech for the presentation. Do not spend much time on it though."
},
{
"code": null,
"e": 110491,
"s": 110406,
"text": "Prepare an opening speech for the presentation. Do not spend much time on it though."
},
{
"code": null,
"e": 110559,
"s": 110491,
"text": "Point out all contents in brief and explain them as you've planned."
},
{
"code": null,
"e": 110627,
"s": 110559,
"text": "Point out all contents in brief and explain them as you've planned."
},
{
"code": null,
"e": 110702,
"s": 110627,
"text": "Have a Q&A (questions and answers) session at the end of the presentation."
},
{
"code": null,
"e": 110777,
"s": 110702,
"text": "Have a Q&A (questions and answers) session at the end of the presentation."
},
{
"code": null,
"e": 110933,
"s": 110777,
"text": "When your presentation is supported by additional material, you can make more impact on the audience. Reports, articles and flyers are just a few examples."
},
{
"code": null,
"e": 111070,
"s": 110933,
"text": "If your presentation is informative and a lot of data is presented, handing out a soft or hard copy of your presentation is a good idea."
},
{
"code": null,
"e": 111127,
"s": 111070,
"text": "Following are some guidelines on presentation materials:"
},
{
"code": null,
"e": 111343,
"s": 111127,
"text": "Make sure that you check the computer, projector and network connectivity in advance to the presentation. I'm sure you do not want to spend the first half of your presentation fixing those in front of your audience."
},
{
"code": null,
"e": 111559,
"s": 111343,
"text": "Make sure that you check the computer, projector and network connectivity in advance to the presentation. I'm sure you do not want to spend the first half of your presentation fixing those in front of your audience."
},
{
"code": null,
"e": 111657,
"s": 111559,
"text": "Use a simple, but consistent layout. Do not overload the presentation with images and animations."
},
{
"code": null,
"e": 111755,
"s": 111657,
"text": "Use a simple, but consistent layout. Do not overload the presentation with images and animations."
},
{
"code": null,
"e": 111940,
"s": 111755,
"text": "When it comes to time allocation, spend 3-5 minutes for each slide. Each slide should ideally have about 5-8 bullet lines. This way, the audience can stay focused and grab your points."
},
{
"code": null,
"e": 112125,
"s": 111940,
"text": "When it comes to time allocation, spend 3-5 minutes for each slide. Each slide should ideally have about 5-8 bullet lines. This way, the audience can stay focused and grab your points."
},
{
"code": null,
"e": 112329,
"s": 112125,
"text": "Do not distribute the supplementary material before the presentation. They may read the material during the presentation and miss what you say. Therefore, distribute the material after the presentation. "
},
{
"code": null,
"e": 112533,
"s": 112329,
"text": "Do not distribute the supplementary material before the presentation. They may read the material during the presentation and miss what you say. Therefore, distribute the material after the presentation. "
},
{
"code": null,
"e": 112744,
"s": 112533,
"text": "Delivering the presentation is the most important step of the process. This is where you make the primary contact with your audience. Consider the following points in order to deliver an effective presentation."
},
{
"code": null,
"e": 113061,
"s": 112744,
"text": "Be prepared for your presentation. Complete the designing phase of the presentation and practice it a few times before you actually do it. This is the most important part of your presentation. Know the content of your presentation in and out. When you know your presentation, you can recover if something goes wrong."
},
{
"code": null,
"e": 113378,
"s": 113061,
"text": "Be prepared for your presentation. Complete the designing phase of the presentation and practice it a few times before you actually do it. This is the most important part of your presentation. Know the content of your presentation in and out. When you know your presentation, you can recover if something goes wrong."
},
{
"code": null,
"e": 113575,
"s": 113378,
"text": "Use true examples to explain your points. If these examples are common to you and the audience, it will have a great impact. Use your personal experiences to show them the practical point of view."
},
{
"code": null,
"e": 113772,
"s": 113575,
"text": "Use true examples to explain your points. If these examples are common to you and the audience, it will have a great impact. Use your personal experiences to show them the practical point of view."
},
{
"code": null,
"e": 113966,
"s": 113772,
"text": "Relax! Stay relaxed and calm during the presentation. Your body language is quite important for the audience. If they see you tensed, they may not receive what you say. They may even judge you!"
},
{
"code": null,
"e": 114160,
"s": 113966,
"text": "Relax! Stay relaxed and calm during the presentation. Your body language is quite important for the audience. If they see you tensed, they may not receive what you say. They may even judge you!"
},
{
"code": null,
"e": 114291,
"s": 114160,
"text": "Use humour in the presentation. Use it naturally to make your point. Do not try to crack jokes when you are not supposed to do it."
},
{
"code": null,
"e": 114422,
"s": 114291,
"text": "Use humour in the presentation. Use it naturally to make your point. Do not try to crack jokes when you are not supposed to do it."
},
{
"code": null,
"e": 114541,
"s": 114422,
"text": "Pay attention to details. Remember the old saying; devil is in details. Choose the place, people and materials wisely."
},
{
"code": null,
"e": 114660,
"s": 114541,
"text": "Pay attention to details. Remember the old saying; devil is in details. Choose the place, people and materials wisely."
},
{
"code": null,
"e": 114728,
"s": 114660,
"text": "Presenting your idea to convince an audience is always a challenge."
},
{
"code": null,
"e": 114844,
"s": 114728,
"text": "Every presentation is a new experience for all of us. Therefore, you should plan your presentations way in advance."
},
{
"code": null,
"e": 114943,
"s": 114844,
"text": "Pay close attention to the points we discussed above and adhere to them in your next presentation."
},
{
"code": null,
"e": 114954,
"s": 114943,
"text": "Good luck!"
},
{
"code": null,
"e": 115314,
"s": 114954,
"text": "In any industry, some of the demands managers face is to be cost effective. In addition to that, they are also faced with challenges such as to analyze costs and profits on a product or consumer basis, to be flexible to face ever altering business requirements, and to be informed of management decision making processes and changes in ways of doing business."
},
{
"code": null,
"e": 115622,
"s": 115314,
"text": "However, some of the challenges holding managers back include the difficulty in attaining accurate information, lack of applications that mimic existing business practices and bad interfaces. When some challengers are holding a manager back, that is where Enterprise Resource Planning (ERP) comes into play."
},
{
"code": null,
"e": 116056,
"s": 115622,
"text": "Over the years business applications have evolved from Management Information Systems with no decision support to Corporate Information Systems, which offer some decision support to Enterprise Resource Planning. Enterprise Resource Planning is a software solution that tackles the needs of an organization, taking into account the process view to meet an organization's goals while incorporating all the functions of an organization."
},
{
"code": null,
"e": 116251,
"s": 116056,
"text": "Its purpose is to make easy the information flow between all business functions within the boundaries of the organization and manage the organization's connections with its outside stakeholders."
},
{
"code": null,
"e": 116469,
"s": 116251,
"text": "In a nutshell, the Enterprise Resource Planning software tries to integrate all the different departments and functions of an organization into a single computer system to serve the various needs of these departments."
},
{
"code": null,
"e": 116795,
"s": 116469,
"text": "The task at hand, of implementing one software program that looks after the needs of the Finance Department together with the needs of the Human Resource Department and the Warehouse, seems impossible. These different departments usually have an individual software program that is optimized in the way each department works."
},
{
"code": null,
"e": 117014,
"s": 116795,
"text": "However, if installed correctly this integrated approach can be very cost effective for an organization. With an integrated solution, different departments can easily share information and communicate with one another."
},
{
"code": null,
"e": 117157,
"s": 117014,
"text": "The following diagram illustrates the differences between non-integrated systems versus an integrated system for enterprise resource planning."
},
{
"code": null,
"e": 117256,
"s": 117157,
"text": "There are two main driving forces behind Enterprise Resource Planning for a business organization."
},
{
"code": null,
"e": 117604,
"s": 117256,
"text": "In a business sense, Enterprise Resource Planning ensures customer satisfaction, as it leads to business development that is development of new areas, new products and new services.\nAlso, it allows businesses to face competition for implementing Enterprise Resource Planning, and it ensures efficient processes that push the company into top gear."
},
{
"code": null,
"e": 117786,
"s": 117604,
"text": "In a business sense, Enterprise Resource Planning ensures customer satisfaction, as it leads to business development that is development of new areas, new products and new services."
},
{
"code": null,
"e": 117952,
"s": 117786,
"text": "Also, it allows businesses to face competition for implementing Enterprise Resource Planning, and it ensures efficient processes that push the company into top gear."
},
{
"code": null,
"e": 118135,
"s": 117952,
"text": "In an IT sense: Most softwares does not meet business needs wholly and the legacy systems today are hard to maintain. In addition, outdated hardware and software is hard to maintain."
},
{
"code": null,
"e": 118318,
"s": 118135,
"text": "In an IT sense: Most softwares does not meet business needs wholly and the legacy systems today are hard to maintain. In addition, outdated hardware and software is hard to maintain."
},
{
"code": null,
"e": 118648,
"s": 118318,
"text": "Hence, for the above reasons, Enterprise Resource Planning is necessary for management in today's business world. ERP is single software, which tackles problems such as material shortages, customer service, finances management, quality issues and inventory problems. An ERP system can be the dashboard of the modern era managers."
},
{
"code": null,
"e": 118988,
"s": 118648,
"text": "Producing Enterprise Resource Planning (ERP) software is complex and also has many significant implications for staff work practice. Implementing the software is a difficult task too and one that 'in-house' IT specialists cannot handle. Hence to implement ERP software, organizations hire third party consulting companies or an ERP vendor."
},
{
"code": null,
"e": 119255,
"s": 118988,
"text": "This is the most cost effective way. The time taken to implement an ERP system depends on the size of the business, the number of departments involved, the degree of customization involved, the magnitude of the change and the cooperation of customers to the project."
},
{
"code": null,
"e": 119465,
"s": 119255,
"text": "With Enterprise Resource Planning (ERP) software, accurate forecasting can be done. When accurate forecasting inventory levels are kept at maximum efficiency, this allows for the organization to be profitable."
},
{
"code": null,
"e": 119675,
"s": 119465,
"text": "With Enterprise Resource Planning (ERP) software, accurate forecasting can be done. When accurate forecasting inventory levels are kept at maximum efficiency, this allows for the organization to be profitable."
},
{
"code": null,
"e": 119766,
"s": 119675,
"text": "Integration of the various departments ensures communication, productivity and efficiency."
},
{
"code": null,
"e": 119857,
"s": 119766,
"text": "Integration of the various departments ensures communication, productivity and efficiency."
},
{
"code": null,
"e": 119948,
"s": 119857,
"text": "Adopting ERP software eradicates the problem of coordinating changes between many systems."
},
{
"code": null,
"e": 120039,
"s": 119948,
"text": "Adopting ERP software eradicates the problem of coordinating changes between many systems."
},
{
"code": null,
"e": 120165,
"s": 120039,
"text": "ERP software provides a top-down view of an organization, so information is available to make decisions at anytime, anywhere."
},
{
"code": null,
"e": 120291,
"s": 120165,
"text": "ERP software provides a top-down view of an organization, so information is available to make decisions at anytime, anywhere."
},
{
"code": null,
"e": 120330,
"s": 120291,
"text": "Adopting ERP systems can be expensive."
},
{
"code": null,
"e": 120369,
"s": 120330,
"text": "Adopting ERP systems can be expensive."
},
{
"code": null,
"e": 120517,
"s": 120369,
"text": "The lack of boundaries created by ERP software in a company can cause problems of who takes the blame, lines of responsibility and employee morale."
},
{
"code": null,
"e": 120665,
"s": 120517,
"text": "The lack of boundaries created by ERP software in a company can cause problems of who takes the blame, lines of responsibility and employee morale."
},
{
"code": null,
"e": 120778,
"s": 120665,
"text": "While employing an ERP system may be expensive, it offers organizations a cost efficient system in the long run."
},
{
"code": null,
"e": 120982,
"s": 120778,
"text": "ERP software works by integrating all the different departments in on organization into one computer system allowing for efficient communication between these departments and hence enhances productivity."
},
{
"code": null,
"e": 121235,
"s": 120982,
"text": "The organizations should take extra precautions when it comes to choosing the correct ERP system for them. There have been many cases that organizations have lost a lot of money due to selecting the 'wrong' ERP solution and a service provider for them."
},
{
"code": null,
"e": 121425,
"s": 121235,
"text": "In the initial stages of a project, complex processes and the many risks involved make it impossible to accurately model. A model of a project is necessary for efficient project management."
},
{
"code": null,
"e": 121637,
"s": 121425,
"text": "Event Chain Methodology, an improbable modelling and schedule network analysis technique, is a solution to this problem. This technique is used to manage events and event chains that influence project schedules."
},
{
"code": null,
"e": 121957,
"s": 121637,
"text": "It is neither a simulation nor a risky analysis method but rather works using existing methodologies such as Monte Carlo Analysis and Bayesian Believe Network. Also, event chain methodology is used for modelling probabilities for different businesses and many technological processes of which one is project management."
},
{
"code": null,
"e": 122013,
"s": 121957,
"text": "Event Chain Methodology is based on six main principles"
},
{
"code": null,
"e": 122298,
"s": 122013,
"text": "Moment of Risk and State of Activity - In a real life project process, a task or an activity is not always a continuous procedure. Neither is it a uniform one. A factor that influences tasks is external events, which in turn transform tasks or activities from one position to another."
},
{
"code": null,
"e": 122604,
"s": 122298,
"text": "During the course of a project, the time or moment when an event occurs is a very important component of the event. This time or moment is predominantly probabilistic and can be characterized using statistical distribution. More often than not, these external events have a negative impact on the project."
},
{
"code": null,
"e": 122771,
"s": 122604,
"text": "Event Chains - An external event can lead to another event and so forth. This creates event chains. Event chains have a significant impact of the course of a project."
},
{
"code": null,
"e": 123038,
"s": 122771,
"text": "For example, any changed requirements to the materials needed for the project can cause the activity to be delayed. The project manager then allocates resources from another activity. This leads to missed deadlines and eventually leads to the failure of the project."
},
{
"code": null,
"e": 123213,
"s": 123038,
"text": "Monte Carlo Simulations - On the clear definition of events and event chains, Monte Carlo Analysis is utilized in order to quantify the collective consequences of the events."
},
{
"code": null,
"e": 123400,
"s": 123213,
"text": "The probability of the risks occurring and the effects they may have are used as input data for the Monte Carlo Analysis. This analysis gives a probability curve of the project schedule."
},
{
"code": null,
"e": 123650,
"s": 123400,
"text": "Critical Event Chains - Critical events or critical chains of events are those with the potential to impinge on a project the most. By identifying such events at the very beginning, it is possible to lessen the negative effect they have on projects."
},
{
"code": null,
"e": 123757,
"s": 123650,
"text": "These types of events can be detected by examining the connections between the primary project parameters."
},
{
"code": null,
"e": 123947,
"s": 123757,
"text": "Performance Tracking With Event Chains - It is important for a manager to track the progress of an activity live. This ensures that updated information is used for the Monte Carlo Analysis."
},
{
"code": null,
"e": 124068,
"s": 123947,
"text": "Hence during the duration of the project, the probability of events can be calculated more accurately using actual data."
},
{
"code": null,
"e": 124327,
"s": 124068,
"text": "Event Chain Diagrams - Event Chain Diagrams depict the relationships between external events and tasks and how the two affect each other. These chains are represented by arrows that are associated with a particular activity or time interval on a Gantt chart."
},
{
"code": null,
"e": 124580,
"s": 124327,
"text": "Each event and event chain is represented by a different color. Global events affect all the tasks in a project while local events affect just one task or activity in a project. Event Chain Diagrams allow for the simple modelling and analysis of risks."
},
{
"code": null,
"e": 124675,
"s": 124580,
"text": "The use of Event Chain Methodology in project management produces some interesting phenomenon:"
},
{
"code": null,
"e": 124790,
"s": 124675,
"text": "Repeated Activity - Certain external events cause the repetition of activities that have already been completed.\n\n"
},
{
"code": null,
"e": 124903,
"s": 124790,
"text": "Repeated Activity - Certain external events cause the repetition of activities that have already been completed."
},
{
"code": null,
"e": 125136,
"s": 124903,
"text": "Event Chains and Risk Mitigation - When an event occurs during the course of a project, a mitigation plan, that is an activity that expands the project schedule, is drawn up. The same mitigation plans may be used for several events."
},
{
"code": null,
"e": 125369,
"s": 125136,
"text": "Event Chains and Risk Mitigation - When an event occurs during the course of a project, a mitigation plan, that is an activity that expands the project schedule, is drawn up. The same mitigation plans may be used for several events."
},
{
"code": null,
"e": 125530,
"s": 125369,
"text": "Resource Allocation Based on Events - Another phenomenon that occurs with Event Chain Methodology is the reallocation of resources from one activity to another."
},
{
"code": null,
"e": 125691,
"s": 125530,
"text": "Resource Allocation Based on Events - Another phenomenon that occurs with Event Chain Methodology is the reallocation of resources from one activity to another."
},
{
"code": null,
"e": 125841,
"s": 125691,
"text": "Using existing techniques such as the Monte Carlo Analysis, Event Chain Methodology manages events and subsequent event chains in project management."
},
{
"code": null,
"e": 126124,
"s": 125841,
"text": "Working by six principles, this methodology simplifies the risks and reservations associated with project schedules. Therefore, the project managers and other senior managers, who are responsible for project accounts should have a clear understanding on the Event Chain Methodology."
},
{
"code": null,
"e": 126385,
"s": 126124,
"text": "Since Event Chain Methodology is closely related to many other techniques used in project management, such as Gantt Charts and Monte Carlo Analysis, the project management should be thorough with all supporting techniques and tools for Event Chain Methodology."
},
{
"code": null,
"e": 126571,
"s": 126385,
"text": "There are many methodologies and techniques used when it comes to project management. Some of these methodologies have been there in practice for decades and some of them are brand new."
},
{
"code": null,
"e": 126814,
"s": 126571,
"text": "The latter methodologies have been introduced to the world of project management in order to address some of the difficulties faced by the old methodologies when it comes to addressing modern requirements and challenges of project management."
},
{
"code": null,
"e": 126999,
"s": 126814,
"text": "Extreme project management is one of the modern approaches to project management in software industry. As we all know, the software industry is a fast growing and fast changing domain."
},
{
"code": null,
"e": 127301,
"s": 126999,
"text": "Therefore, most of the software development projects do have changing requirements from the inception to the end of the project. Adding new requirements or changing the requirements during the project execution period is one of the main challenges faced by the traditional project management approach."
},
{
"code": null,
"e": 127401,
"s": 127301,
"text": "The new approach, Extreme Project Management, mainly addresses the aspect of changing requirements."
},
{
"code": null,
"e": 127602,
"s": 127401,
"text": "Let's do some visual comparison between the traditional project management approach and the extreme project management approach in order to understand the nature of extreme project management clearly."
},
{
"code": null,
"e": 127666,
"s": 127602,
"text": "In the traditional approach, the project phases look like below"
},
{
"code": null,
"e": 127730,
"s": 127666,
"text": "In the extreme approach, a project will take the following form"
},
{
"code": null,
"e": 127984,
"s": 127730,
"text": "By comparing the two visual representations, you will now understand the dynamics of the extreme approach. In extreme project management methodology, there are no fixed project phases and fixed set of guidelines on how to execute the project activities."
},
{
"code": null,
"e": 128093,
"s": 127984,
"text": "Rather, extreme methodology adapts to the situation and executes the project activity the best way possible."
},
{
"code": null,
"e": 128256,
"s": 128093,
"text": "By nature, extreme project management methodology does not have lengthy deadlines or delivery dates. The delivery cycles are shorter and usually they are 2 weeks."
},
{
"code": null,
"e": 128451,
"s": 128256,
"text": "Therefore, the entire project team is focused on delivering the scope of the delivery in short term. This allows the team to welcome any scope or requirement changes for the next delivery cycle."
},
{
"code": null,
"e": 128642,
"s": 128451,
"text": "The best way to compare traditional project management and extreme project management is through a comparison between classical music and jazz. Extreme project management is like jazz music."
},
{
"code": null,
"e": 128860,
"s": 128642,
"text": "The team members are given a lot of freedom to add their variety to the project team. Whenever a team member feels making a decision that will add value to the overall project, it is allowed by the project management."
},
{
"code": null,
"e": 128996,
"s": 128860,
"text": "In addition, each individual of the project team is responsible for the management of their own assignment and the quality of the same."
},
{
"code": null,
"e": 129154,
"s": 128996,
"text": "In contrast, the traditional approach is much more streamlined, well-defined approach where the project manager guides the entire team towards project goals."
},
{
"code": null,
"e": 129267,
"s": 129154,
"text": "In extreme project management approach, team members collectively share the project management responsibilities."
},
{
"code": null,
"e": 129502,
"s": 129267,
"text": "Mindset is the most critical factor when it comes to extreme project management. First of all, the team should undergo a comprehensive training on extreme approach in order to understand the basics and core principles of the approach."
},
{
"code": null,
"e": 129604,
"s": 129502,
"text": "In this training, the individuals also get to gauge themselves and see whether they are a fit or not."
},
{
"code": null,
"e": 129834,
"s": 129604,
"text": "In extreme approach, things are done totally a different way, when compared to tradition approaches. Therefore, changing the mindset of the project team is one of the main requirements and responsibilities of the management team."
},
{
"code": null,
"e": 129967,
"s": 129834,
"text": "When it comes to changing the mindset, consider the following rules as the ground rules for extreme approach for project management."
},
{
"code": null,
"e": 130027,
"s": 129967,
"text": "Requirements and project activities being chaotic is normal"
},
{
"code": null,
"e": 130087,
"s": 130027,
"text": "Requirements and project activities being chaotic is normal"
},
{
"code": null,
"e": 130156,
"s": 130087,
"text": "Uncertainty is the most certain characteristic of an extreme project"
},
{
"code": null,
"e": 130225,
"s": 130156,
"text": "Uncertainty is the most certain characteristic of an extreme project"
},
{
"code": null,
"e": 130274,
"s": 130225,
"text": "This type of projects are not fully controllable"
},
{
"code": null,
"e": 130323,
"s": 130274,
"text": "This type of projects are not fully controllable"
},
{
"code": null,
"e": 130388,
"s": 130323,
"text": "Change is the king and you need to welcome it every possible way"
},
{
"code": null,
"e": 130453,
"s": 130388,
"text": "Change is the king and you need to welcome it every possible way"
},
{
"code": null,
"e": 130523,
"s": 130453,
"text": "The feeling of security is increased by relaxing the project controls"
},
{
"code": null,
"e": 130593,
"s": 130523,
"text": "The feeling of security is increased by relaxing the project controls"
},
{
"code": null,
"e": 130820,
"s": 130593,
"text": "Self-management is one of the key aspects of extreme project management. As we have already elaborated, there is no central project management authority in such projects. The project manager is just a facilitator and a mentor."
},
{
"code": null,
"e": 131064,
"s": 130820,
"text": "Therefore, the project management responsibilities are distributed among the project team members. Each member of the project should execute their management responsibilities and indirectly contribute to the management function of the project."
},
{
"code": null,
"e": 131216,
"s": 131064,
"text": "Extreme project management is like living in a different planet. You cannot compare extreme approach to the traditional approach and try to find truce."
},
{
"code": null,
"e": 131332,
"s": 131216,
"text": "Therefore, moving from traditional approach to extreme approach is not quite as easy as moving from Windows to Mac."
},
{
"code": null,
"e": 131552,
"s": 131332,
"text": "If you are having the responsibility of managing a team through extreme approach, first see whether you are ready for the challenge. Go through a good training on extreme project management and learn as much as you can."
},
{
"code": null,
"e": 131655,
"s": 131552,
"text": "Never try to define or approach extreme project tasks through conventional definitions and approaches."
},
{
"code": null,
"e": 131841,
"s": 131655,
"text": "Gantt chart is a type of a bar chart that is used for illustrating project schedules. Gantt charts can be used in any projects that involve effort, resources, milestones and deliveries."
},
{
"code": null,
"e": 131933,
"s": 131841,
"text": "At present, Gantt charts have become the popular choice of project managers in every field."
},
{
"code": null,
"e": 132144,
"s": 131933,
"text": "Gantt charts allow project managers to track the progress of the entire project. Through Gantt charts, the project manager can keep a track of the individual tasks as well as of the overall project progression."
},
{
"code": null,
"e": 132356,
"s": 132144,
"text": "In addition to tracking the progression of the tasks, Gantt charts can also be used for tracking the utilization of the resources in the project. These resources can be human resources as well as materials used."
},
{
"code": null,
"e": 132589,
"s": 132356,
"text": "Gantt chart was invented by a mechanical engineer named Henry Gantt in 1910. Since the invention, Gantt chart has come a long way. By today, it takes different forms from simple paper based charts to sophisticated software packages."
},
{
"code": null,
"e": 132780,
"s": 132589,
"text": "As we have already discussed, Gantt charts are used for project management purposes. In order to use Gantt charts in a project, there are a few initial requirements fulfilled by the project."
},
{
"code": null,
"e": 132874,
"s": 132780,
"text": "First of all, the project should have a sufficiently detailed Work Breakdown Structure (WBS)."
},
{
"code": null,
"e": 132950,
"s": 132874,
"text": "Secondly, the project should have identified its milestones and deliveries."
},
{
"code": null,
"e": 133233,
"s": 132950,
"text": "In some instances, project managers try to define the work break down structure while creating Gantt chart. This is one of the frequently practised errors in using Gantt charts. Gantt charts are not designed to assist WBS process; rather Gantt charts are for task progress tracking."
},
{
"code": null,
"e": 133403,
"s": 133233,
"text": "Gantt charts can be successfully used in projects of any scale. When using Gantt charts for large projects, there can be an increased complexity when tracking the tasks."
},
{
"code": null,
"e": 133546,
"s": 133403,
"text": "This problem of complexity can be successfully overcome by using computer software packages designed for offering Gantt chart functionalities."
},
{
"code": null,
"e": 133683,
"s": 133546,
"text": "There are dozens of Gantt chart tools that can be used for successful project tracking. These tools usually vary by the feature offered."
},
{
"code": null,
"e": 133862,
"s": 133683,
"text": "The simplest kind of Gantt chart can be created using a software tool such as Microsoft Excel. For that matter, any spreadsheet tool can be used to design a Gantt chart template."
},
{
"code": null,
"e": 133998,
"s": 133862,
"text": "If the project is small scale and does not involve many parallel tasks, a spreadsheet based Gantt chart can be the most effective type."
},
{
"code": null,
"e": 134243,
"s": 133998,
"text": "Microsoft Project is one of the key Gantt chart tools used today. Especially for software development projects, MS Project based Gantt charts are essential to track the hundreds of parallel tasks involved in the software development life cycle."
},
{
"code": null,
"e": 134581,
"s": 134243,
"text": "There are many other Gantt chart tools available for free and for price. The features offered by these tools range from the same features offered by Excel based Gantt charts to MS Project Gantt charts. These tools come with different price tags and feature levels, so one can select the suitable Gantt chart tool for the purpose in hand."
},
{
"code": null,
"e": 134774,
"s": 134581,
"text": "Sometimes, one may decide to create their own Gantt chart tool without buying an existing one. If this is the case, first of all, one should search the Internet for free Gantt chart templates."
},
{
"code": null,
"e": 134955,
"s": 134774,
"text": "This way, one may actually find the exact Gantt chart template (probably in Excel) required for the purpose. In case, if no match is found, then it is sensible to create one's own."
},
{
"code": null,
"e": 135178,
"s": 134955,
"text": "Excel is the most popular tool for creating custom Gantt charts. Of course, one can create a Gantt chart from scratch in Excel, but it is always advisable to use a Project Management add-on in Excel to create Gantt charts."
},
{
"code": null,
"e": 135271,
"s": 135178,
"text": "These project management add-ons are published by Microsoft and other third-party companies."
},
{
"code": null,
"e": 135524,
"s": 135271,
"text": "The ability to grasp the overall status of a project and its tasks at once is the key advantage in using a Gantt chart tool. Therefore, upper management or the sponsors of the project can make informed decisions just by looking at the Gantt chart tool."
},
{
"code": null,
"e": 135695,
"s": 135524,
"text": "The software-based Gantt charts are able to show the task dependencies in a project schedule. This helps to identify and maintain the critical path of a project schedule."
},
{
"code": null,
"e": 135933,
"s": 135695,
"text": "Gantt chart tools can be used as the single entity for managing small projects. For small projects, no other documentation may be required; but for large projects, the Gantt chart tool should be supported by other means of documentation."
},
{
"code": null,
"e": 136038,
"s": 135933,
"text": "For large projects, the information displayed in Gantt charts may not be sufficient for decision making."
},
{
"code": null,
"e": 136280,
"s": 136038,
"text": "Although Gantt charts accurately represent the cost, time and scope aspects of a project, it does not elaborate on the project size or size of the work elements. Therefore, the magnitude of constraints and issues can be easily misunderstood."
},
{
"code": null,
"e": 136409,
"s": 136280,
"text": "Gantt chart tools make project manager's life easy. Therefore, Gantt chart tools are important for successful project execution."
},
{
"code": null,
"e": 136545,
"s": 136409,
"text": "Identifying the level of detail required in the project schedule is the key when selecting a suitable Gantt chart tool for the project."
},
{
"code": null,
"e": 136652,
"s": 136545,
"text": "One should not overly complicate the project schedules by using Gantt charts to manage the simplest tasks."
},
{
"code": null,
"e": 136864,
"s": 136652,
"text": "Just-in-time manufacturing was a concept introduced to the United States by the Ford motor company. It works on a demand-pull basis, contrary to hitherto used techniques, which worked on a production-push basis."
},
{
"code": null,
"e": 137099,
"s": 136864,
"text": "To elaborate further, under just-in-time manufacturing (colloquially referred to as JIT production systems), actual orders dictate what should be manufactured, so that the exact quantity is produced at the exact time that is required."
},
{
"code": null,
"e": 137233,
"s": 137099,
"text": "Just-in-time manufacturing goes hand in hand with concepts such as Kanban, continuous improvement and total quality management (TQM)."
},
{
"code": null,
"e": 137390,
"s": 137233,
"text": "Just-in-time production requires intricate planning in terms of procurement policies and the manufacturing process if its implementation is to be a success."
},
{
"code": null,
"e": 137603,
"s": 137390,
"text": "Highly advanced technological support systems provide the necessary back-up that Just-in-time manufacturing demands with production scheduling software and electronic data interchange being the most sought after."
},
{
"code": null,
"e": 137679,
"s": 137603,
"text": "Following are the advantages of Adopting Just-In-Time Manufacturing Systems"
},
{
"code": null,
"e": 137941,
"s": 137679,
"text": "Just-in-time manufacturing keeps stock holding costs to a bare minimum. The release of storage space results in better utilization of space and thereby bears a favorable impact on the rent paid and on any insurance premiums that would otherwise need to be made."
},
{
"code": null,
"e": 138203,
"s": 137941,
"text": "Just-in-time manufacturing keeps stock holding costs to a bare minimum. The release of storage space results in better utilization of space and thereby bears a favorable impact on the rent paid and on any insurance premiums that would otherwise need to be made."
},
{
"code": null,
"e": 138324,
"s": 138203,
"text": "Just-in-time manufacturing eliminates waste, as out-of-date or expired products; do not enter into this equation at all."
},
{
"code": null,
"e": 138445,
"s": 138324,
"text": "Just-in-time manufacturing eliminates waste, as out-of-date or expired products; do not enter into this equation at all."
},
{
"code": null,
"e": 138711,
"s": 138445,
"text": "As under this technique, only essential stocks are obtained, less working capital is required to finance procurement. Here, a minimum re-order level is set, and only once that mark is reached, fresh stocks are ordered making this a boon to inventory management too."
},
{
"code": null,
"e": 138977,
"s": 138711,
"text": "As under this technique, only essential stocks are obtained, less working capital is required to finance procurement. Here, a minimum re-order level is set, and only once that mark is reached, fresh stocks are ordered making this a boon to inventory management too."
},
{
"code": null,
"e": 139138,
"s": 138977,
"text": "Due to the aforementioned low level of stocks held, the organizations return on investment (referred to as ROI, in management parlance) would generally be high."
},
{
"code": null,
"e": 139299,
"s": 139138,
"text": "Due to the aforementioned low level of stocks held, the organizations return on investment (referred to as ROI, in management parlance) would generally be high."
},
{
"code": null,
"e": 139557,
"s": 139299,
"text": "As just-in-time production works on a demand-pull basis, all goods made would be sold, and thus it incorporates changes in demand with surprising ease. This makes it especially appealing today, where the market demand is volatile and somewhat unpredictable."
},
{
"code": null,
"e": 139815,
"s": 139557,
"text": "As just-in-time production works on a demand-pull basis, all goods made would be sold, and thus it incorporates changes in demand with surprising ease. This makes it especially appealing today, where the market demand is volatile and somewhat unpredictable."
},
{
"code": null,
"e": 139943,
"s": 139815,
"text": "Just-in-time manufacturing encourages the 'right first time' concept, so that inspection costs and cost of rework is minimized."
},
{
"code": null,
"e": 140071,
"s": 139943,
"text": "Just-in-time manufacturing encourages the 'right first time' concept, so that inspection costs and cost of rework is minimized."
},
{
"code": null,
"e": 140180,
"s": 140071,
"text": "High quality products and greater efficiency can be derived from following a just-in-time production system."
},
{
"code": null,
"e": 140289,
"s": 140180,
"text": "High quality products and greater efficiency can be derived from following a just-in-time production system."
},
{
"code": null,
"e": 140392,
"s": 140289,
"text": "Close relationships are fostered along the production chain under a just-in-time manufacturing system."
},
{
"code": null,
"e": 140495,
"s": 140392,
"text": "Close relationships are fostered along the production chain under a just-in-time manufacturing system."
},
{
"code": null,
"e": 140575,
"s": 140495,
"text": "Constant communication with the customer results in high customer satisfaction."
},
{
"code": null,
"e": 140655,
"s": 140575,
"text": "Constant communication with the customer results in high customer satisfaction."
},
{
"code": null,
"e": 140728,
"s": 140655,
"text": "Overproduction is eliminated when just-in-time manufacturing is adopted."
},
{
"code": null,
"e": 140801,
"s": 140728,
"text": "Overproduction is eliminated when just-in-time manufacturing is adopted."
},
{
"code": null,
"e": 140880,
"s": 140801,
"text": "Following are the disadvantages of Adopting Just-In-Time Manufacturing Systems"
},
{
"code": null,
"e": 141036,
"s": 140880,
"text": "Just-in-time manufacturing provides zero tolerance for mistakes, as it makes re-working very difficult in practice, as inventory is kept to a bare minimum."
},
{
"code": null,
"e": 141192,
"s": 141036,
"text": "Just-in-time manufacturing provides zero tolerance for mistakes, as it makes re-working very difficult in practice, as inventory is kept to a bare minimum."
},
{
"code": null,
"e": 141304,
"s": 141192,
"text": "There is a high reliance on suppliers, whose performance is generally outside the purview of the manufacturer. "
},
{
"code": null,
"e": 141416,
"s": 141304,
"text": "There is a high reliance on suppliers, whose performance is generally outside the purview of the manufacturer. "
},
{
"code": null,
"e": 141604,
"s": 141416,
"text": "Due to there being no buffers for delays, production downtime and line idling can occur which would bear a detrimental effect on finances and on the equilibrium of the production process."
},
{
"code": null,
"e": 141792,
"s": 141604,
"text": "Due to there being no buffers for delays, production downtime and line idling can occur which would bear a detrimental effect on finances and on the equilibrium of the production process."
},
{
"code": null,
"e": 141923,
"s": 141792,
"text": "The organization would not be able to meet an unexpected increase in orders due to the fact that there are no excess finish goods."
},
{
"code": null,
"e": 142054,
"s": 141923,
"text": "The organization would not be able to meet an unexpected increase in orders due to the fact that there are no excess finish goods."
},
{
"code": null,
"e": 142137,
"s": 142054,
"text": "Transaction costs would be relatively high as frequent transactions would be made."
},
{
"code": null,
"e": 142220,
"s": 142137,
"text": "Transaction costs would be relatively high as frequent transactions would be made."
},
{
"code": null,
"e": 142435,
"s": 142220,
"text": "Just-in-time manufacturing may have certain detrimental effects on the environment due to the frequent deliveries that would result in increased use of transportation, which in turn would consume more fossil fuels."
},
{
"code": null,
"e": 142650,
"s": 142435,
"text": "Just-in-time manufacturing may have certain detrimental effects on the environment due to the frequent deliveries that would result in increased use of transportation, which in turn would consume more fossil fuels."
},
{
"code": null,
"e": 142741,
"s": 142650,
"text": "Following are the things to Remember When Implementing a Just-In-Time Manufacturing System"
},
{
"code": null,
"e": 142889,
"s": 142741,
"text": "Management buy-in and support at all levels of the organization are required; if a just-in-time manufacturing system is to be successfully adopted."
},
{
"code": null,
"e": 143037,
"s": 142889,
"text": "Management buy-in and support at all levels of the organization are required; if a just-in-time manufacturing system is to be successfully adopted."
},
{
"code": null,
"e": 143199,
"s": 143037,
"text": "Adequate resources should be allocated, so as to obtain technologically advanced software that is generally required if a just-in-time system is to be a success."
},
{
"code": null,
"e": 143361,
"s": 143199,
"text": "Adequate resources should be allocated, so as to obtain technologically advanced software that is generally required if a just-in-time system is to be a success."
},
{
"code": null,
"e": 143501,
"s": 143361,
"text": "Building a close, trusting relationship with reputed and time-tested suppliers will minimize unexpected delays in the receipt of inventory."
},
{
"code": null,
"e": 143641,
"s": 143501,
"text": "Building a close, trusting relationship with reputed and time-tested suppliers will minimize unexpected delays in the receipt of inventory."
},
{
"code": null,
"e": 143857,
"s": 143641,
"text": "Just-in-time manufacturing cannot be adopted overnight. It requires commitment in terms of time and adjustments to corporate culture would be required, as it is starkly different to traditional production processes."
},
{
"code": null,
"e": 144073,
"s": 143857,
"text": "Just-in-time manufacturing cannot be adopted overnight. It requires commitment in terms of time and adjustments to corporate culture would be required, as it is starkly different to traditional production processes."
},
{
"code": null,
"e": 144206,
"s": 144073,
"text": "The design flow process needs to be redesigned and layouts need to be re-formatted, so as to incorporate just-in-time manufacturing."
},
{
"code": null,
"e": 144339,
"s": 144206,
"text": "The design flow process needs to be redesigned and layouts need to be re-formatted, so as to incorporate just-in-time manufacturing."
},
{
"code": null,
"e": 144371,
"s": 144339,
"text": "Lot sizes need to be minimized."
},
{
"code": null,
"e": 144403,
"s": 144371,
"text": "Lot sizes need to be minimized."
},
{
"code": null,
"e": 144462,
"s": 144403,
"text": "Workstation capacity should be balanced whenever possible."
},
{
"code": null,
"e": 144521,
"s": 144462,
"text": "Workstation capacity should be balanced whenever possible."
},
{
"code": null,
"e": 144605,
"s": 144521,
"text": "Preventive maintenance should be carried out, so as to minimize machine breakdowns."
},
{
"code": null,
"e": 144689,
"s": 144605,
"text": "Preventive maintenance should be carried out, so as to minimize machine breakdowns."
},
{
"code": null,
"e": 144739,
"s": 144689,
"text": "Set-up times should be reduced wherever possible."
},
{
"code": null,
"e": 144789,
"s": 144739,
"text": "Set-up times should be reduced wherever possible."
},
{
"code": null,
"e": 144893,
"s": 144789,
"text": "Quality enhancement programs should be adopted, so that total quality control practices can be adopted."
},
{
"code": null,
"e": 144997,
"s": 144893,
"text": "Quality enhancement programs should be adopted, so that total quality control practices can be adopted."
},
{
"code": null,
"e": 145069,
"s": 144997,
"text": "Reduction in lead times and frequent deliveries should be incorporated."
},
{
"code": null,
"e": 145141,
"s": 145069,
"text": "Reduction in lead times and frequent deliveries should be incorporated."
},
{
"code": null,
"e": 145299,
"s": 145141,
"text": "Motion waste should be minimized, so the incorporation of conveyor belts might prove to be a good idea when implementing a just-in-time manufacturing system."
},
{
"code": null,
"e": 145457,
"s": 145299,
"text": "Motion waste should be minimized, so the incorporation of conveyor belts might prove to be a good idea when implementing a just-in-time manufacturing system."
},
{
"code": null,
"e": 145576,
"s": 145457,
"text": "Just-in-time manufacturing is a philosophy that has been successfully implemented in many manufacturing organizations."
},
{
"code": null,
"e": 145735,
"s": 145576,
"text": "It is an optimal system that reduces inventory whilst being increasingly responsive to customer needs, this is not to say that it is not without its pitfalls."
},
{
"code": null,
"e": 145865,
"s": 145735,
"text": "However, these disadvantages can be overcome with a little forethought and a lot of commitment at all levels of the organization."
},
{
"code": null,
"e": 146069,
"s": 145865,
"text": "Knowledge management is an activity practised by enterprises all over the world. In the process of knowledge management, these enterprises comprehensively gather information using many methods and tools."
},
{
"code": null,
"e": 146165,
"s": 146069,
"text": "Then, gathered information is organized, stored, shared, and analyzed using defined techniques."
},
{
"code": null,
"e": 146262,
"s": 146165,
"text": "The analysis of such information will be based on resources, documents, people and their skills."
},
{
"code": null,
"e": 146461,
"s": 146262,
"text": "Properly analyzed information will then be stored as 'knowledge' of the enterprise. This knowledge is later used for activities such as organizational decision making and training new staff members."
},
{
"code": null,
"e": 146725,
"s": 146461,
"text": "There have been many approaches to knowledge management from early days. Most of early approaches have been manual storing and analysis of information. With the introduction of computers, most organizational knowledge and management processes have been automated."
},
{
"code": null,
"e": 146886,
"s": 146725,
"text": "Therefore, information storing, retrieval and sharing have become convenient. Nowadays, most enterprises have their own knowledge management framework in place."
},
{
"code": null,
"e": 147033,
"s": 146886,
"text": "The framework defines the knowledge gathering points, gathering techniques, tools used, data storing tools and techniques and analyzing mechanism."
},
{
"code": null,
"e": 147212,
"s": 147033,
"text": "The process of knowledge management is universal for any enterprise. Sometimes, the resources used, such as tools and techniques, can be unique to the organizational environment."
},
{
"code": null,
"e": 147389,
"s": 147212,
"text": "The Knowledge Management process has six basic steps assisted by different tools and techniques. When these steps are followed sequentially, the data transforms into knowledge."
},
{
"code": null,
"e": 147644,
"s": 147389,
"text": "This is the most important step of the knowledge management process. If you collect the incorrect or irrelevant data, the resulting knowledge may not be the most accurate. Therefore, the decisions made based on such knowledge could be inaccurate as well."
},
{
"code": null,
"e": 147895,
"s": 147644,
"text": "There are many methods and tools used for data collection. First of all, data collection should be a procedure in knowledge management process. These procedures should be properly documented and followed by people involved in data collection process."
},
{
"code": null,
"e": 148136,
"s": 147895,
"text": "The data collection procedure defines certain data collection points. Some points may be the summary of certain routine reports. As an example, monthly sales report and daily attendance reports may be two good resources for data collection."
},
{
"code": null,
"e": 148464,
"s": 148136,
"text": "With data collection points, the data extraction techniques and tools are also defined. As an example, the sales report may be a paper-based report where a data entry operator needs to feed the data manually to a database whereas, the daily attendance report may be an online report where it is directly stored in the database."
},
{
"code": null,
"e": 148655,
"s": 148464,
"text": "In addition to data collecting points and extraction mechanism, data storage is also defined in this step. Most of the organizations now use a software database application for this purpose."
},
{
"code": null,
"e": 148799,
"s": 148655,
"text": "The data collected need to be organized. This organization usually happens based on certain rules. These rules are defined by the organization."
},
{
"code": null,
"e": 149009,
"s": 148799,
"text": "As an example, all sales-related data can be filed together and all staff-related data could be stored in the same database table. This type of organization helps to maintain data accurately within a database."
},
{
"code": null,
"e": 149140,
"s": 149009,
"text": "If there is much data in the database, techniques such as 'normalization' can be used for organizing and reducing the duplication."
},
{
"code": null,
"e": 149273,
"s": 149140,
"text": "This way, data is logically arranged and related to one another for easy retrieval. When data passes step 2, it becomes information."
},
{
"code": null,
"e": 149447,
"s": 149273,
"text": "In this step, the information is summarized in order to take the essence of it. The lengthy information is presented in tabular or graphical format and stored appropriately."
},
{
"code": null,
"e": 149590,
"s": 149447,
"text": "For summarizing, there are many tools that can be used such as software packages, charts (Pareto, cause-and-effect), and different techniques."
},
{
"code": null,
"e": 149696,
"s": 149590,
"text": "At this stage, the information is analyzed in order to find the relationships, redundancies and patterns."
},
{
"code": null,
"e": 149883,
"s": 149696,
"text": "An expert or an expert team should be assigned for this purpose as the experience of the person/team plays a vital role. Usually, there are reports created after analysis of information."
},
{
"code": null,
"e": 150039,
"s": 149883,
"text": "At this point, information becomes knowledge. The results of analysis (usually the reports) are combined together to derive various concepts and artefacts."
},
{
"code": null,
"e": 150225,
"s": 150039,
"text": "A pattern or behavior of one entity can be applied to explain another, and collectively, the organization will have a set of knowledge elements that can be used across the organization."
},
{
"code": null,
"e": 150309,
"s": 150225,
"text": "This knowledge is then stored in the organizational knowledge base for further use."
},
{
"code": null,
"e": 150423,
"s": 150309,
"text": "Usually, the knowledge base is a software implementation that can be accessed from anywhere through the Internet."
},
{
"code": null,
"e": 150533,
"s": 150423,
"text": "You can also buy such knowledge base software or download an open-source implementation of the same for free."
},
{
"code": null,
"e": 150719,
"s": 150533,
"text": "At this stage, the knowledge is used for decision making. As an example, when estimating a specific type of a project or a task, the knowledge related to previous estimates can be used."
},
{
"code": null,
"e": 150879,
"s": 150719,
"text": "This accelerates the estimation process and adds high accuracy. This is how the organizational knowledge management adds value and saves money in the long run."
},
{
"code": null,
"e": 151066,
"s": 150879,
"text": "Knowledge management is an essential practice for enterprise organizations. Organizational knowledge adds long-term benefits to the organization in terms of finances, culture and people."
},
{
"code": null,
"e": 151238,
"s": 151066,
"text": "Therefore, all mature organizations should take necessary steps for knowledge management in order to enhance the business operations and organization's overall capability."
},
{
"code": null,
"e": 151420,
"s": 151238,
"text": "When it comes to project activity management, activity sequencing is one of the main tasks. Among many other parameters, float is one of the key concepts used in project scheduling."
},
{
"code": null,
"e": 151529,
"s": 151420,
"text": "Float can be used to facilitate the freedom for a particular task. Let's have a look at the float in detail."
},
{
"code": null,
"e": 151659,
"s": 151529,
"text": "When it comes to each activity in the project, there are four parameters for each related to the timelines. Those are defined as:"
},
{
"code": null,
"e": 151776,
"s": 151659,
"text": "Earliest start time (ES) - The earliest time, an activity can start once the previous dependent activities are over."
},
{
"code": null,
"e": 151893,
"s": 151776,
"text": "Earliest start time (ES) - The earliest time, an activity can start once the previous dependent activities are over."
},
{
"code": null,
"e": 151959,
"s": 151893,
"text": "Earliest finish time (EF) - This would be ES + activity duration."
},
{
"code": null,
"e": 152025,
"s": 151959,
"text": "Earliest finish time (EF) - This would be ES + activity duration."
},
{
"code": null,
"e": 152120,
"s": 152025,
"text": "Latest finish time (LF) - The latest time an activity can finish without delaying the project."
},
{
"code": null,
"e": 152215,
"s": 152120,
"text": "Latest finish time (LF) - The latest time an activity can finish without delaying the project."
},
{
"code": null,
"e": 152278,
"s": 152215,
"text": "Latest start time (LS) - This would be LF - activity duration."
},
{
"code": null,
"e": 152341,
"s": 152278,
"text": "Latest start time (LS) - This would be LF - activity duration."
},
{
"code": null,
"e": 152634,
"s": 152341,
"text": "The float time for an activity is the time between the earliest (ES) and the latest (LS) start time or between the earliest (EF) and latest (LF) finish times. During the float time, an activity can be delayed without delaying the project finish date.\nIn an illustration, this is how it looks:"
},
{
"code": null,
"e": 152711,
"s": 152634,
"text": "Leads and Lags are types of float. Let's take an example to understand this."
},
{
"code": null,
"e": 152772,
"s": 152711,
"text": "In project management, there are four types of dependencies:"
},
{
"code": null,
"e": 152857,
"s": 152772,
"text": "Finish to Start (FS) - Later task does not start until the previous task is finished"
},
{
"code": null,
"e": 152942,
"s": 152857,
"text": "Finish to Start (FS) - Later task does not start until the previous task is finished"
},
{
"code": null,
"e": 153029,
"s": 152942,
"text": "Finish to Finish (FF) - Later task does not finish until the previous task is finished"
},
{
"code": null,
"e": 153116,
"s": 153029,
"text": "Finish to Finish (FF) - Later task does not finish until the previous task is finished"
},
{
"code": null,
"e": 153195,
"s": 153116,
"text": "Start to Start (SS) - Later task does not start until the previous task starts"
},
{
"code": null,
"e": 153274,
"s": 153195,
"text": "Start to Start (SS) - Later task does not start until the previous task starts"
},
{
"code": null,
"e": 153352,
"s": 153274,
"text": "Start to Finish (SF) - Later task does not finish before previous task starts"
},
{
"code": null,
"e": 153430,
"s": 153352,
"text": "Start to Finish (SF) - Later task does not finish before previous task starts"
},
{
"code": null,
"e": 153873,
"s": 153430,
"text": "Take the scenario of building two identical walls of the same house using the same material. Let's say, building the first wall is task A and building the second one is task B. The engineer wants to delay task B for two days. This is due to the fact that the material used for both A and B are a new type, so the engineer wants to learn from A and then apply if there is anything to B. Therefore, the two tasks A and B have a SS relationship."
},
{
"code": null,
"e": 153970,
"s": 153873,
"text": "The time between the start dates of the two tasks can be defined as a lag (2 days in this case)."
},
{
"code": null,
"e": 154076,
"s": 153970,
"text": "If the relationship between task A and B was Finish to Start (FS), then the 'lead' can be illustrated as:"
},
{
"code": null,
"e": 154122,
"s": 154076,
"text": "Task B started prior to Task A with a 'lead.'"
},
{
"code": null,
"e": 154345,
"s": 154122,
"text": "For a project manager, the concepts of float, lead and lag make a lot of meaning and sense. These aspects of tasks are important in order to calculate project timeline variations and eventually the project completion time."
},
{
"code": null,
"e": 154512,
"s": 154345,
"text": "Management is the core function of any organization. Management is responsible for wellbeing of the company and its stakeholders, such as the investors and employees."
},
{
"code": null,
"e": 154692,
"s": 154512,
"text": "Therefore, the management should be a skilled, experienced, and motivated set of individuals, who will do whatever necessary for the best interest of the company and stakeholders."
},
{
"code": null,
"e": 154866,
"s": 154692,
"text": "Best practices are usually outcomes of knowledge management. Best practices are the reusable practices of the organization that have been successful in respective functions."
},
{
"code": null,
"e": 154924,
"s": 154866,
"text": "There are two types of best practices in an organization:"
},
{
"code": null,
"e": 155035,
"s": 154924,
"text": "Internal best practices - Internal best practices are originated by the internal knowledge management efforts."
},
{
"code": null,
"e": 155146,
"s": 155035,
"text": "Internal best practices - Internal best practices are originated by the internal knowledge management efforts."
},
{
"code": null,
"e": 155321,
"s": 155146,
"text": "External (industry) best practices - External best practices are acquired to the company by hiring the skilled, educated and experienced staff and through external trainings."
},
{
"code": null,
"e": 155496,
"s": 155321,
"text": "External (industry) best practices - External best practices are acquired to the company by hiring the skilled, educated and experienced staff and through external trainings."
},
{
"code": null,
"e": 155676,
"s": 155496,
"text": "When it comes to management best practices, there are plenty. They can be further subdivided into different sub-domains within management, such as human resources, technical, etc."
},
{
"code": null,
"e": 155793,
"s": 155676,
"text": "But in this brief article, we take management as a general practice and will not elaborate on different sub-domains."
},
{
"code": null,
"e": 155914,
"s": 155793,
"text": "When it comes to management best practices, we can identify five distinct areas where the best practices can be applied."
},
{
"code": null,
"e": 156056,
"s": 155914,
"text": "Management is all about communicating to the staff and the clients. Effective communication is a must when it comes to successful management."
},
{
"code": null,
"e": 156188,
"s": 156056,
"text": "The management should have a set of best practices defined for clear and effective communication from/to the staff and the clients."
},
{
"code": null,
"e": 156412,
"s": 156188,
"text": "Respect is something you should earn in a corporate environment. Leading by examples is the best way of doing this. Define and adhere to leadership by example best practices and also make sure your subordinates do the same."
},
{
"code": null,
"e": 156553,
"s": 156412,
"text": "Realistic goals can boost the corporate morale. Most of the times, organizations fail due to unrealistic, unachievable goals and objectives."
},
{
"code": null,
"e": 156778,
"s": 156553,
"text": "There are many best practices on how to set goals and objectives, such as SWAT analysis. Since the goals are the driving factor behind your organization, you need to make use of every possible best practice for goal setting."
},
{
"code": null,
"e": 156926,
"s": 156778,
"text": "When your management style is open and transparent, others respect you more. In addition, information directly flows from the problem areas to you."
},
{
"code": null,
"e": 157033,
"s": 156926,
"text": "Always try to follow the open door policies that do not restrict your subordinates coming to you directly."
},
{
"code": null,
"e": 157271,
"s": 157033,
"text": "This is the most important best practice area when it comes to long-term benefits for the company. Usually, experienced people in management, such as Jack Welch, have their own, successful best practices for strategic corporate planning."
},
{
"code": null,
"e": 157376,
"s": 157271,
"text": "It is always a good idea to learn such ideas from exceptional people and apply them in your own context."
},
{
"code": null,
"e": 157512,
"s": 157376,
"text": "There are many tools a manager can use for practising management best practices. Following are some areas where you can use such tools."
},
{
"code": null,
"e": 157642,
"s": 157512,
"text": "Benchmarking is a domain itself. Accurate benchmarking helps you to understand the capability of your company or the departments."
},
{
"code": null,
"e": 157732,
"s": 157642,
"text": "Benchmarks can then be used for evaluating and assessing the performance of your company."
},
{
"code": null,
"e": 157912,
"s": 157732,
"text": "Forecasting, especially, financial forecasting is a key function for a business organization. There are many tools such as price sheets, effort estimates for accurate forecasting."
},
{
"code": null,
"e": 158127,
"s": 157912,
"text": "Matrix is one of the best practices in performance monitoring. In addition, you can define certain KPIs (Key Performance Indicators) for measuring and assessing the performance of departments, functions and people."
},
{
"code": null,
"e": 158187,
"s": 158127,
"text": "We will have a detailed look into KPIs in the next section."
},
{
"code": null,
"e": 158279,
"s": 158187,
"text": "This is the most effective way of monitoring all the aspects of your business organization."
},
{
"code": null,
"e": 158391,
"s": 158279,
"text": "You can set up KPIs for any aspect of the business and start monitoring the progress of the respective aspects."
},
{
"code": null,
"e": 158574,
"s": 158391,
"text": "As an example, you can define KPIs for sales targets and monitor their progress over time. When the sales figures do not meet the KPIs, you can look into the issues and rectify them."
},
{
"code": null,
"e": 158700,
"s": 158574,
"text": "The KPIs used depend on your business domain. When KPIs are defined, they should align with your overall business objectives."
},
{
"code": null,
"e": 158782,
"s": 158700,
"text": "Organizations can achieve a great success by employing management best practices."
},
{
"code": null,
"e": 159002,
"s": 158782,
"text": "This is one way to make sure that the same mistake is not repeated. Once a best practice is derived through knowledge management, it should be properly documented and integrated to the relevant functions of the company."
},
{
"code": null,
"e": 159076,
"s": 159002,
"text": "Best practices should be included into the corporate trainings regularly."
},
{
"code": null,
"e": 159261,
"s": 159076,
"text": "In an organization, managers perform many functions and play many roles. They are responsible for handling many situations and these situations are usually different from one another."
},
{
"code": null,
"e": 159346,
"s": 159261,
"text": "When it comes to handling such situations, managers use their own management styles."
},
{
"code": null,
"e": 159552,
"s": 159346,
"text": "Some management styles may be best for the situation and some may not be. Therefore, awareness on different types of management styles will help the managers to handle different situations the optimal way."
},
{
"code": null,
"e": 159714,
"s": 159552,
"text": "In short, a management style is a leadership method used by a manager. Let's have a look at four main management styles practised by managers all over the world."
},
{
"code": null,
"e": 159785,
"s": 159714,
"text": "In this management style, the manager becomes the sole decision maker."
},
{
"code": null,
"e": 159957,
"s": 159785,
"text": "The manager does not care about the subordinates and their involvement in decision making. Therefore, the decisions reflect the personality and the opinion of the manager."
},
{
"code": null,
"e": 160146,
"s": 159957,
"text": "The decision does not reflect the team's collective opinion. In some cases, this style of management can move a business towards its goals rapidly and can fight through a challenging time."
},
{
"code": null,
"e": 160413,
"s": 160146,
"text": "If the manager has a great personality, experience and exposure, the decisions made by him or her could be better than collective decision making. On the other hand, subordinates may become dependent upon the manager's decisions and may require thorough supervision."
},
{
"code": null,
"e": 160457,
"s": 160413,
"text": "There are two types of autocratic managers:"
},
{
"code": null,
"e": 160566,
"s": 160457,
"text": "Directive autocrat. This type of managers make their decisions alone and supervise the subordinates closely."
},
{
"code": null,
"e": 160675,
"s": 160566,
"text": "Directive autocrat. This type of managers make their decisions alone and supervise the subordinates closely."
},
{
"code": null,
"e": 160803,
"s": 160675,
"text": "Permissive autocrat. This type of managers make their decisions alone, but allows subordinates to freely execute the decisions."
},
{
"code": null,
"e": 160931,
"s": 160803,
"text": "Permissive autocrat. This type of managers make their decisions alone, but allows subordinates to freely execute the decisions."
},
{
"code": null,
"e": 161116,
"s": 160931,
"text": "In this style, the manager is open to other's opinions and welcome their contribution into the decision making process. Therefore, every decision is made with the majority's agreement."
},
{
"code": null,
"e": 161285,
"s": 161116,
"text": "The decisions made reflect the team's opinion. For this management style to work successfully, robust communication between the managers and the subordinates is a must."
},
{
"code": null,
"e": 161437,
"s": 161285,
"text": "This type of management is most successful when it comes to decision making on a complex matter where a range of expert advice and opinion is required."
},
{
"code": null,
"e": 161612,
"s": 161437,
"text": "Before making a business decision, usually a series of meetings or brainstorming sessions take place in the organizations. These meetings are properly planned and documented."
},
{
"code": null,
"e": 161821,
"s": 161612,
"text": "Therefore, organization can always go back to the decision making process and see the reasons behind certain decisions. Due to the collective nature, this style of management gives more employee satisfaction."
},
{
"code": null,
"e": 161985,
"s": 161821,
"text": "If decision making through the democratic style takes too long for a critical situation, then it is time to employ autocrat management style before it is too late."
},
{
"code": null,
"e": 162131,
"s": 161985,
"text": "This is one of the dictatorial types of management. The decisions made are usually for the best interest of the company as well as the employees."
},
{
"code": null,
"e": 162237,
"s": 162131,
"text": "When the management makes a decision, it is explained to the employees and obtains their support as well."
},
{
"code": null,
"e": 162425,
"s": 162237,
"text": "In this management style, work-life balance is emphasized and it eventually maintains a high morale within the organization. In the long run, this guarantees the loyalty of the employees."
},
{
"code": null,
"e": 162572,
"s": 162425,
"text": "One disadvantage of this style is that the employees may become dependent on the managers. This will limit the creativity within the organization."
},
{
"code": null,
"e": 162941,
"s": 162572,
"text": "In this type of management, the manager is a facilitator for the staff. The employees take the responsibility of different areas of their work. Whenever the employees face an obstacle, the manager intervenes and removes it. In this style, the employee is more independent and owns his or her responsibilities. The manager has only a little managerial tasks to perform."
},
{
"code": null,
"e": 163075,
"s": 162941,
"text": "When compared with other styles, a minimum communication takes place in this management style between the employees and the managers."
},
{
"code": null,
"e": 163222,
"s": 163075,
"text": "This style of management is the best suited for companies such as technology companies where there are highly professional and creative employees."
},
{
"code": null,
"e": 163327,
"s": 163222,
"text": "Different management styles are capable of handling different situations and solving different problems."
},
{
"code": null,
"e": 163430,
"s": 163327,
"text": "Therefore, a manager should be a dynamic person, who has insight into many types of management styles."
},
{
"code": null,
"e": 163564,
"s": 163430,
"text": "There are various management philosophies and types used in the world of business. These types of management differ from one another."
},
{
"code": null,
"e": 163699,
"s": 163564,
"text": "In some cases, a few of these management types can be mixed together in order to create something customed for a specific requirement."
},
{
"code": null,
"e": 163901,
"s": 163699,
"text": "Management by Objectives (MBO) is one of the frequently used management types. The popularity and the proven results are the main reasons behind everyone adopting this technique for their organization."
},
{
"code": null,
"e": 164144,
"s": 163901,
"text": "As valid as it is for many management types, MBO is a systematic and organized approach that emphasizes the achievement of goals. In the long run, this allows the management to change the organization's mindset to become more result oriented."
},
{
"code": null,
"e": 164480,
"s": 164144,
"text": "The core aim of management by objectives is the alignment of company goals and subordinate objectives properly, so everyone in the organization works towards achieving the same organizational goal. In order to identify the organizational goals, the upper management usually follows techniques such as GQM (Goal, Questions and Metrics)."
},
{
"code": null,
"e": 164564,
"s": 164480,
"text": "In order to set the objectives for the employees, the following steps are followed:"
},
{
"code": null,
"e": 164654,
"s": 164564,
"text": "The management chunks down the organizational goals and assign chunks to senior managers."
},
{
"code": null,
"e": 164744,
"s": 164654,
"text": "The management chunks down the organizational goals and assign chunks to senior managers."
},
{
"code": null,
"e": 164921,
"s": 164744,
"text": "Senior managers then derive objectives for them to achieve the assigned organizational goals. This is where senior managers assign the objectives to the operational management."
},
{
"code": null,
"e": 165098,
"s": 164921,
"text": "Senior managers then derive objectives for them to achieve the assigned organizational goals. This is where senior managers assign the objectives to the operational management."
},
{
"code": null,
"e": 165298,
"s": 165098,
"text": "Operational management then chunks down their objectives and identify the activities required for achieving the objectives. These sub-objectives and activities are then assigned to rest of the staff."
},
{
"code": null,
"e": 165498,
"s": 165298,
"text": "Operational management then chunks down their objectives and identify the activities required for achieving the objectives. These sub-objectives and activities are then assigned to rest of the staff."
},
{
"code": null,
"e": 165663,
"s": 165498,
"text": "When objectives and activities are assigned, the management gives strong inputs to clearly identify the objectives, time frame for completion, and tracking options."
},
{
"code": null,
"e": 165828,
"s": 165663,
"text": "When objectives and activities are assigned, the management gives strong inputs to clearly identify the objectives, time frame for completion, and tracking options."
},
{
"code": null,
"e": 165930,
"s": 165828,
"text": "Each objective is properly tracked and the management gives periodic feedback to the objective owner."
},
{
"code": null,
"e": 166032,
"s": 165930,
"text": "Each objective is properly tracked and the management gives periodic feedback to the objective owner."
},
{
"code": null,
"e": 166148,
"s": 166032,
"text": "In most occasions, the organization defines processes and procedures in order to track the objectives and feedback."
},
{
"code": null,
"e": 166264,
"s": 166148,
"text": "In most occasions, the organization defines processes and procedures in order to track the objectives and feedback."
},
{
"code": null,
"e": 166519,
"s": 166264,
"text": "At the end of the agreed period (usually an year), the objective achievement is reviewed and an appraisal is performed. Usually, the outcomes of this assessment are used to determine the salary increments for year ahead and relevant bonuses to employees."
},
{
"code": null,
"e": 166774,
"s": 166519,
"text": "At the end of the agreed period (usually an year), the objective achievement is reviewed and an appraisal is performed. Usually, the outcomes of this assessment are used to determine the salary increments for year ahead and relevant bonuses to employees."
},
{
"code": null,
"e": 167064,
"s": 166774,
"text": "Activity trap is one of the issues that prevent the success of MBO process. This happens when employees are more focused on daily activities rather than the long-term objectives. Overloaded activities are a result of vicious cycles and this cycle should be broken through proper planning. "
},
{
"code": null,
"e": 167294,
"s": 167064,
"text": "In MBO, the management focus is on the result, not the activity. The tasks are delegated through negotiations and there is no fixed roadmap for the implementation. The implementation is done dynamically and to suit the situation."
},
{
"code": null,
"e": 167504,
"s": 167294,
"text": "Although MBO is extremely result oriented, not all enterprises can benefit from MBO implementations. The MBO is most suitable for knowledge-based enterprises where the staff is quite competent of what they do."
},
{
"code": null,
"e": 167651,
"s": 167504,
"text": "Specially, if the management is planning to implement a self-leadership culture among the employees, MBO is the best way to initiate that process."
},
{
"code": null,
"e": 167814,
"s": 167651,
"text": "Since individuals are empowered to carry out stretched tasks and responsibilities under MBO, individual responsibilities play a vital role for the success of MBO."
},
{
"code": null,
"e": 167967,
"s": 167814,
"text": "In MBO, there is a link built between the strategic thinking of the upper management and the operational execution of the lower levels of the hierarchy."
},
{
"code": null,
"e": 168087,
"s": 167967,
"text": "The responsibility of achieving the objectives is passed from the organization to each individual of the organization. "
},
{
"code": null,
"e": 168374,
"s": 168087,
"text": "Management by objectives is mainly achieved through self-control. Nowadays, especially in knowledge-based organizations, the employees are self-managers, who are able to make their own decisions. In such organizations, the management should ask three basic questions from its employees."
},
{
"code": null,
"e": 168412,
"s": 168374,
"text": "What should be your responsibilities?"
},
{
"code": null,
"e": 168450,
"s": 168412,
"text": "What should be your responsibilities?"
},
{
"code": null,
"e": 168521,
"s": 168450,
"text": "What information is required by you from the management and the peers?"
},
{
"code": null,
"e": 168592,
"s": 168521,
"text": "What information is required by you from the management and the peers?"
},
{
"code": null,
"e": 168664,
"s": 168592,
"text": "What information should you provide the management and peers in return?"
},
{
"code": null,
"e": 168736,
"s": 168664,
"text": "What information should you provide the management and peers in return?"
},
{
"code": null,
"e": 168982,
"s": 168736,
"text": "Management by objectives has become de facto practice for management in knowledge-based organizations such as software development companies. The employees are given sufficient responsibility and authority to achieve their individual objectives."
},
{
"code": null,
"e": 169195,
"s": 168982,
"text": "Accomplishment of individual objectives eventually contributes to achieving organizational goals. Therefore, there should be a strong and robust process of assessing the objective achievements of each individual."
},
{
"code": null,
"e": 169358,
"s": 169195,
"text": "This review process should take place periodically and sufficient feedback will make sure that the individual objectives are in par with the organizational goals."
},
{
"code": null,
"e": 169548,
"s": 169358,
"text": "Having been named after the principality famous for its casinos, the term Monte Carlo Analysis conjures images of an intricate strategy aimed at maximizing one's earnings in a casino game. "
},
{
"code": null,
"e": 169722,
"s": 169548,
"text": "However, Monte Carlo Analysis refers to a technique in project management where a manager computes and calculates the total project cost and the project schedule many times."
},
{
"code": null,
"e": 169886,
"s": 169722,
"text": "This is done using a set of input values that have been selected after careful deliberation of probability distributions or potential costs or potential durations."
},
{
"code": null,
"e": 170103,
"s": 169886,
"text": "The Monte Carlo Analysis is important in project management as it allows a project manager to calculate a probable total cost of a project as well as to find a range or a potential date of completion for the project."
},
{
"code": null,
"e": 170339,
"s": 170103,
"text": " Since a Monte Carlo Analysis uses quantified data, this allows project managers to better communicate with senior management, especially when the latter is pushing for impractical project completion dates or unrealistic project costs."
},
{
"code": null,
"e": 170456,
"s": 170339,
"text": " Also, this type of an analysis allows the project managers to quantify perils and ambiguities in project schedules."
},
{
"code": null,
"e": 170718,
"s": 170456,
"text": "A project manager creates three estimates for the duration of the project: one being the most likely duration, one the worst case scenario and the other being the best case scenario. For each estimate, the project manager consigns the probability of occurrence."
},
{
"code": null,
"e": 170764,
"s": 170718,
"text": "The project is one that involves three tasks:"
},
{
"code": null,
"e": 171005,
"s": 170764,
"text": "The first task is likely to take three days (70% probability), but it can also be completed in two days or even four days. The probability of it taking two days to complete is 10% and the probability of it taking four days to finish is 20%."
},
{
"code": null,
"e": 171246,
"s": 171005,
"text": "The first task is likely to take three days (70% probability), but it can also be completed in two days or even four days. The probability of it taking two days to complete is 10% and the probability of it taking four days to finish is 20%."
},
{
"code": null,
"e": 171384,
"s": 171246,
"text": "The second task has a 60% probability of taking six days to finish, a 20% probability each of being completed in five days or eight days."
},
{
"code": null,
"e": 171522,
"s": 171384,
"text": "The second task has a 60% probability of taking six days to finish, a 20% probability each of being completed in five days or eight days."
},
{
"code": null,
"e": 171696,
"s": 171522,
"text": "The final task has an 80% probability of being completed in four days, 5% probability of being completed in three days and a 15% probability of being completed in five days."
},
{
"code": null,
"e": 171870,
"s": 171696,
"text": "The final task has an 80% probability of being completed in four days, 5% probability of being completed in three days and a 15% probability of being completed in five days."
},
{
"code": null,
"e": 172064,
"s": 171870,
"text": "Using the Monte Carlo Analysis, a series of simulations are done on the project probabilities. The simulation is to run for a thousand odd times, and for each simulation, an end date is noted. "
},
{
"code": null,
"e": 172290,
"s": 172064,
"text": "Once the Monte Carlo Analysis is completed, there would be no single project completion date. Instead the project manager has a probability curve depicting the likely dates of completion and the probability of attaining each."
},
{
"code": null,
"e": 172483,
"s": 172290,
"text": "Using this probability curve, the project manager informs the senior management of the expected date of completion. The project manager would choose the date with a 90% chance of attaining it."
},
{
"code": null,
"e": 172618,
"s": 172483,
"text": " Therefore, it could be said that using the Monte Carlo Analysis, the project has a 90% chance of being completed in X number of days."
},
{
"code": null,
"e": 172801,
"s": 172618,
"text": "Similarly, a project manager can adjudge the estimated budget for a project using probabilities to simulate different end results and in turn use the findings in a probability curve."
},
{
"code": null,
"e": 172932,
"s": 172801,
"text": "The above example was one that contained a mere three tasks. In reality, such projects contain hundreds if not thousands of tasks."
},
{
"code": null,
"e": 173131,
"s": 172932,
"text": "Using the Monte Carlo Analysis, a project manager is able to derive a probability curve to show the ambiguity surrounding the duration and the costs surrounding these hundreds or thousands of tasks."
},
{
"code": null,
"e": 173233,
"s": 173131,
"text": "Conducting simulations involving hundreds or thousands of tasks is a tedious job to be done manually."
},
{
"code": null,
"e": 173405,
"s": 173233,
"text": "Today there is project management scheduling software that can conduct thousands of simulations and offer the project manager different end results in a probability curve."
},
{
"code": null,
"e": 173545,
"s": 173405,
"text": "A Monte Carlo Analysis shows the risk analysis involved in a project through a probability distribution that is a model of possible values."
},
{
"code": null,
"e": 173641,
"s": 173545,
"text": "Some of the commonly used probability distributions or curves for Monte Carlo Analysis include:"
},
{
"code": null,
"e": 173756,
"s": 173641,
"text": "The Normal or Bell Curve - In this type of probability curve, the values in the middle are the likeliest to occur."
},
{
"code": null,
"e": 173871,
"s": 173756,
"text": "The Normal or Bell Curve - In this type of probability curve, the values in the middle are the likeliest to occur."
},
{
"code": null,
"e": 174052,
"s": 173871,
"text": "The Lognormal Curve - Here values are skewed. A Monte Carlo Analysis gives this type of probability distribution for project management in the real estate industry or oil industry."
},
{
"code": null,
"e": 174233,
"s": 174052,
"text": "The Lognormal Curve - Here values are skewed. A Monte Carlo Analysis gives this type of probability distribution for project management in the real estate industry or oil industry."
},
{
"code": null,
"e": 174420,
"s": 174233,
"text": "The Uniform Curve - All instances have an equal chance of occurring. This type of probability distribution is common with manufacturing costs and future sales revenues for a new product."
},
{
"code": null,
"e": 174607,
"s": 174420,
"text": "The Uniform Curve - All instances have an equal chance of occurring. This type of probability distribution is common with manufacturing costs and future sales revenues for a new product."
},
{
"code": null,
"e": 174793,
"s": 174607,
"text": "The Triangular Curve - The project manager enters the minimum, maximum or most likely values. The probability curve, a triangular one, will display values around the most likely option."
},
{
"code": null,
"e": 174979,
"s": 174793,
"text": "The Triangular Curve - The project manager enters the minimum, maximum or most likely values. The probability curve, a triangular one, will display values around the most likely option."
},
{
"code": null,
"e": 175156,
"s": 174979,
"text": "The Monte Carlo Analysis is an important method adopted by managers to calculate the many possible project completion dates and the most likely budget required for the project."
},
{
"code": null,
"e": 175380,
"s": 175156,
"text": "Using the information gathered through the Monte Carlo Analysis, project managers are able to give senior management the statistical evidence for the time required to complete a project as well as propose a suitable budget."
},
{
"code": null,
"e": 175683,
"s": 175380,
"text": "Motivation is one of the key factors driving us towards achieving something. Without motivation, we will do nothing. Therefore, motivation is one of the key aspects when it comes to corporate management. In order to achieve the best business results, the organization needs to keep employees motivated."
},
{
"code": null,
"e": 175857,
"s": 175683,
"text": "In order to motivate the employees, organizations do various activities. The activities the companies do basically the results and findings of certain motivational theories."
},
{
"code": null,
"e": 175933,
"s": 175857,
"text": "Following are the main motivational theories practised in the modern world:"
},
{
"code": null,
"e": 176137,
"s": 175933,
"text": "According to this theory, people are motivated by the greed for power, achievement and affiliation. By offering empowerment, titles and other related tokens, people can be motivated for doing their work."
},
{
"code": null,
"e": 176359,
"s": 176137,
"text": "Humans can be aroused easily by their nature. In this motivation theory, the arousal is used for keeping the people motivated. Take an army as an example. The arousal for eliminating the enemy is a good motivation factor."
},
{
"code": null,
"e": 176614,
"s": 176359,
"text": "Let's take an example. An employee is attracted to a company due to its reputation. Once the employee starts working, he/she develops loyalty towards the company. Later, due to some issue, the company loses its reputation, but employee's loyalty remains."
},
{
"code": null,
"e": 176712,
"s": 176614,
"text": "In this motivation theory, the alignment of attitude and behaviour is used for motivating people."
},
{
"code": null,
"e": 176911,
"s": 176712,
"text": "The urge people have to attribute is used as a motivational factor. Usually, people like to attribute oneself as well as others in different context. This need is used for motivation in this theory."
},
{
"code": null,
"e": 177040,
"s": 176911,
"text": "As an example, getting one's name published in a magazine is a good motivation for the same person to engage further in writing."
},
{
"code": null,
"e": 177192,
"s": 177040,
"text": "This theory emphasizes the fact that the non-alignment to something could make people uncomfortable and eventually motivate them to do the right thing."
},
{
"code": null,
"e": 177420,
"s": 177192,
"text": "This could be considered as the most widely used motivation theory across many domains. When we select tasks to complete, we chunk them down to be doable tasks. The person is motivated to do the tasks as they are simply doable."
},
{
"code": null,
"e": 177566,
"s": 177420,
"text": "This theory uses our internal values for keeping us motivated. As an example, if we promise to do something, we will feel bad about not doing it."
},
{
"code": null,
"e": 177687,
"s": 177566,
"text": "Giving the control to someone is one of the best ways to motivate them. People are thrilled to have control over things."
},
{
"code": null,
"e": 177792,
"s": 177687,
"text": "People can be motivated by keeping them in an environment, which is in alignment with what they believe."
},
{
"code": null,
"e": 178072,
"s": 177792,
"text": "People's need to satisfy their needs is used in this theory. As an example, imagine a case where a person is hungry in an unknown house and find some food under the staircase. When the same person feels hungry at some other unknown house, the person may look under the staircase."
},
{
"code": null,
"e": 178139,
"s": 178072,
"text": "This motivation theory uses the progress as the motivation factor."
},
{
"code": null,
"e": 178326,
"s": 178139,
"text": "Keeping the person in the wrong place may motivate that person to escape from that place. This is sometimes used in corporate environments for employees to find where they really belong."
},
{
"code": null,
"e": 178436,
"s": 178326,
"text": "This is also one of the most used theories in the corporate world. The employee is motivated through rewards."
},
{
"code": null,
"e": 178512,
"s": 178436,
"text": "Desire to achieve goals is the driving force behind this motivation theory."
},
{
"code": null,
"e": 178661,
"s": 178512,
"text": "The organization gets the employees to invest on certain things. If you have invested on something, you will be motivated to enhance and improve it."
},
{
"code": null,
"e": 178776,
"s": 178661,
"text": "This way, employees are motivated by making them happy when it comes to environment, rewards, personal space, etc."
},
{
"code": null,
"e": 178914,
"s": 178776,
"text": "Reducing the salary of a low performer and later setting goals to get the salary back is one of the examples for this type of motivation."
},
{
"code": null,
"e": 179161,
"s": 178914,
"text": "Motivation theories suggest many ways of keeping the employees motivated on what they do. Although a manager is not required to learn all these motivation theories, having an idea of certain theories may be an advantage for day-to-day activities."
},
{
"code": null,
"e": 179371,
"s": 179161,
"text": "These theories give the managers a set of techniques that they can try out in the corporate environments. Some of these theories have been used in business for decades, although we do not know them explicitly."
},
{
"code": null,
"e": 179515,
"s": 179371,
"text": "Management function techniques will never be complete without the manager and even various other employees being able to negotiate effectively."
},
{
"code": null,
"e": 179759,
"s": 179515,
"text": "Any organization runs well based on the skills of their employees. From communication skills to negotiation skills, every organization would need to hone these skills in their workers to ensure the efficient running of a business organization."
},
{
"code": null,
"e": 180013,
"s": 179759,
"text": "You need to understand that these negotiation skills are not very difficult to grasp and will only take time and some careful moves with the other party for you to be able to close a good deal, thereby increasing employee productivity to a great extent."
},
{
"code": null,
"e": 180275,
"s": 180013,
"text": "The most precise definition of a 'negotiation' was given by Richard Shell in his book 'Bargaining for Advantage' as an interactive communication process that may takes place whenever we want something from someone else or another person wants something from us."
},
{
"code": null,
"e": 180365,
"s": 180275,
"text": "Richard Shell then further went on to describe the process of negotiation in four stages:"
},
{
"code": null,
"e": 180609,
"s": 180365,
"text": "When it comes to preparation, you would basically need to have a clear idea of how you are to go about with your points. One of the keys to effective negotiation is to be able to express your needs and your thoughts clearly to the other party."
},
{
"code": null,
"e": 180734,
"s": 180609,
"text": "It is important that you carry out some research on your own about the other party before you begin the negotiation process."
},
{
"code": null,
"e": 180877,
"s": 180734,
"text": "This way you will be able to find out the reputation of the other party and any famous tactics used by him/her to try and get people to agree."
},
{
"code": null,
"e": 181023,
"s": 180877,
"text": "You will then be well prepared to face the negotiator with confidence. Reading up on how to negotiate effectively will aid you to a great extent."
},
{
"code": null,
"e": 181165,
"s": 181023,
"text": "The information you provide must always be well researched and must be communicated effectively. Do not be afraid to ask questions in plenty."
},
{
"code": null,
"e": 181309,
"s": 181165,
"text": "That is the best way to understand the negotiator and look at the deal from his/her point of view. If you have any doubts, always clarify them."
},
{
"code": null,
"e": 181537,
"s": 181309,
"text": "The bargaining stage could be said to be the most important of the four stages. This is where most of the work is done by both parties. This is where the actual deal will begin to take shape. Terms and conditions are laid down."
},
{
"code": null,
"e": 181659,
"s": 181537,
"text": "Bargaining is never easy. Both parties would have to learn to compromise on several aspects to come to a final agreement."
},
{
"code": null,
"e": 181888,
"s": 181659,
"text": "This would mean that each party would therefore have to give up something to gain another. It is essential for you to always have an open mind and be tactful while at the same time not giving away too much and settling for less."
},
{
"code": null,
"e": 182084,
"s": 181888,
"text": "The final stage would be where the last few adjustments to the deal are made by the parties involved, before closing the deal and placing their trust in each other for each to fulfill their role."
},
{
"code": null,
"e": 182258,
"s": 182084,
"text": "These four stages have proven to provide great results if studied carefully and applied. Many organizations use this strategy to help their employees negotiate successfully."
},
{
"code": null,
"e": 182401,
"s": 182258,
"text": "In the long run, you'll find that you will have mastered the art of negotiation and will be able to close a good deal without too much effort."
},
{
"code": null,
"e": 182523,
"s": 182401,
"text": "For the task of negotiation to be effective, you would have to ensure at all times that you are not being too aggressive."
},
{
"code": null,
"e": 182725,
"s": 182523,
"text": "Sometimes it is easy to get carried away during the process and take an aggressive approach to asserting your needs. This will not work. It is vital that you are positive about the negotiation process."
},
{
"code": null,
"e": 182874,
"s": 182725,
"text": "You need to keep in mind that the other party too has needs, listen to the negotiators views and opinions, and consider the deal from his/her angle."
},
{
"code": null,
"e": 182983,
"s": 182874,
"text": "You must always ensure that you gain the negotiators trust and that he/she would know that you are reliable."
},
{
"code": null,
"e": 183183,
"s": 182983,
"text": "You would also have to work on your communication skills if you are to be a good negotiator. Although the words coming out of your mouth may mean one thing, your body language could be quite hostile."
},
{
"code": null,
"e": 183406,
"s": 183183,
"text": "This will not bode well if a negotiation process is to be successful. You would need to always check on your body language to ensure that you are not sending out negative vibes, which may put off the negotiator completely."
},
{
"code": null,
"e": 183568,
"s": 183406,
"text": "It is essential to always be pleasant and calm no matter how stressful the process might be. Both these skills therefore will go hand in hand to quite an extent."
},
{
"code": null,
"e": 183744,
"s": 183568,
"text": "It is apt to end with a line from Freund in 'Anatomy of a Merger' 1975: In the last analysis, you cannot learn negotiating techniques from a book. You must actually negotiate."
},
{
"code": null,
"e": 183892,
"s": 183744,
"text": "That in itself sums up the fact that negotiation takes practice. Learning the techniques and applying them will then make you a pro at negotiating."
},
{
"code": null,
"e": 184076,
"s": 183892,
"text": "Any operating organization should have its own structure in order to operate efficiently. For an organization, the organizational structure is a hierarchy of people and its functions."
},
{
"code": null,
"e": 184385,
"s": 184076,
"text": "The organizational structure of an organization tells you the character of an organization and the values it believes in. Therefore, when you do business with an organization or getting into a new job in an organization, it is always a great idea to get to know and understand their organizational structure."
},
{
"code": null,
"e": 184542,
"s": 184385,
"text": "Depending on the organizational values and the nature of the business, organizations tend to adopt one of the following structures for management purposes. "
},
{
"code": null,
"e": 184703,
"s": 184542,
"text": "Although the organization follows a particular structure, there can be departments and teams following some other organizational structure in exceptional cases."
},
{
"code": null,
"e": 184810,
"s": 184703,
"text": "Sometimes, some organizations may follow a combination of the following organizational structures as well."
},
{
"code": null,
"e": 184922,
"s": 184810,
"text": "Following are the types of organizational structures that can be observed in the modern business organizations."
},
{
"code": null,
"e": 185060,
"s": 184922,
"text": "Bureaucratic structures maintain strict hierarchies when it comes to people management. There are three types of bureaucratic structures:"
},
{
"code": null,
"e": 185270,
"s": 185060,
"text": "This type of organizations lacks the standards. Usually this type of structure can be observed in small scale, start-up companies. Usually the structure is centralized and there is only one key decision maker."
},
{
"code": null,
"e": 185483,
"s": 185270,
"text": "The communication is done in one-on-one conversations. This type of structures is quite helpful for small organizations due to the fact that the founder has the full control over all the decisions and operations."
},
{
"code": null,
"e": 185702,
"s": 185483,
"text": "These structures have a certain degree of standardization. When the organizations grow complex and large, bureaucratic structures are required for management. These structures are quite suitable for tall organizations."
},
{
"code": null,
"e": 185936,
"s": 185702,
"text": "The organizations that follow post-bureaucratic structures still inherit the strict hierarchies, but open to more modern ideas and methodologies. They follow techniques such as total quality management (TQM), culture management, etc."
},
{
"code": null,
"e": 186141,
"s": 185936,
"text": "The organization is divided into segments based on the functions when managing. This allows the organization to enhance the efficiencies of these functional groups. As an example, take a software company."
},
{
"code": null,
"e": 186294,
"s": 186141,
"text": "Software engineers will only staff the entire software development department. This way, management of this functional group becomes easy and effective."
},
{
"code": null,
"e": 186512,
"s": 186294,
"text": "Functional structures appear to be successful in large organization that produces high volumes of products at low costs. The low cost can be achieved by such companies due to the efficiencies within functional groups."
},
{
"code": null,
"e": 186777,
"s": 186512,
"text": "In addition to such advantages, there can be disadvantage from an organizational perspective if the communication between the functional groups is not effective. In this case, organization may find it difficult to achieve some organizational objectives at the end."
},
{
"code": null,
"e": 186998,
"s": 186777,
"text": "These types of organizations divide the functional areas of the organization to divisions. Each division is equipped with its own resources in order to function independently. There can be many bases to define divisions."
},
{
"code": null,
"e": 187107,
"s": 186998,
"text": "Divisions can be defined based on the geographical basis, products/services basis, or any other measurement."
},
{
"code": null,
"e": 187386,
"s": 187107,
"text": "As an example, take a company such as General Electrics. It can have microwave division, turbine division, etc., and these divisions have their own marketing teams, finance teams, etc. In that sense, each division can be considered as a micro-company with the main organization."
},
{
"code": null,
"e": 187498,
"s": 187386,
"text": "When it comes to matrix structure, the organization places the employees based on the function and the product."
},
{
"code": null,
"e": 187595,
"s": 187498,
"text": " The matrix structure gives the best of the both worlds of functional and divisional structures."
},
{
"code": null,
"e": 187804,
"s": 187595,
"text": "In this type of an organization, the company uses teams to complete tasks. The teams are formed based on the functions they belong to (ex: software engineers) and product they are involved in (ex: Project A)."
},
{
"code": null,
"e": 187962,
"s": 187804,
"text": "This way, there are many teams in this organization such as software engineers of project A, software engineers of project B, QA engineers of project A, etc."
},
{
"code": null,
"e": 188173,
"s": 187962,
"text": "Every organization needs a structure in order to operate systematically. The organizational structures can be used by any organization if the structure fits into the nature and the maturity of the organization."
},
{
"code": null,
"e": 188393,
"s": 188173,
"text": "In most cases, organizations evolve through structures when they progress through and enhance their processes and manpower. One company may start as a pre-bureaucratic company and may evolve up to a matrix organization."
},
{
"code": null,
"e": 188622,
"s": 188393,
"text": "Before any activity begins related to the work of a project, every project requires an advanced, accurate time estimate. Without an accurate estimate, no project can be completed within the budget and the target completion date."
},
{
"code": null,
"e": 188743,
"s": 188622,
"text": "Developing an estimate is a complex task. If the project is large and has many stakeholders, things can be more complex."
},
{
"code": null,
"e": 188907,
"s": 188743,
"text": "Therefore, there have been many initiatives to come up with different techniques for estimation phase of the project in order to make the estimation more accurate."
},
{
"code": null,
"e": 189102,
"s": 188907,
"text": "PERT (Program Evaluation and Review Technique) is one of the successful and proven methods among the many other techniques, such as, CPM, Function Point Counting, Top-Down Estimating, WAVE, etc."
},
{
"code": null,
"e": 189274,
"s": 189102,
"text": "PERT was initially created by the US Navy in the late 1950s. The pilot project was for developing Ballistic Missiles and there have been thousands of contractors involved."
},
{
"code": null,
"e": 189387,
"s": 189274,
"text": "After PERT methodology was employed for this project, it actually ended two years ahead of its initial schedule."
},
{
"code": null,
"e": 189513,
"s": 189387,
"text": "At the core, PERT is all about management probabilities. Therefore, PERT involves in many simple statistical methods as well."
},
{
"code": null,
"e": 189676,
"s": 189513,
"text": "Sometimes, people categorize and put PERT and CPM together. Although CPM (Critical Path Method) shares some characteristics with PERT, PERT has a different focus."
},
{
"code": null,
"e": 189779,
"s": 189676,
"text": "Same as most of other estimation techniques, PERT also breaks down the tasks into detailed activities."
},
{
"code": null,
"e": 189968,
"s": 189779,
"text": "Then, a Gantt chart will be prepared illustrating the interdependencies among the activities. Then, a network of activities and their interdependencies are drawn in an illustrative manner."
},
{
"code": null,
"e": 190121,
"s": 189968,
"text": "In this map, a node represents each event. The activities are represented as arrows and they are drawn from one event to another, based on the sequence."
},
{
"code": null,
"e": 190252,
"s": 190121,
"text": "Next, the Earliest Time (TE) and the Latest Time (TL) are figured for each activity and identify the slack time for each activity."
},
{
"code": null,
"e": 190399,
"s": 190252,
"text": "When it comes to deriving the estimates, the PERT model takes a statistical route to do that. We will cover more on this in the next two sections."
},
{
"code": null,
"e": 190435,
"s": 190399,
"text": "Following is an example PERT chart:"
},
{
"code": null,
"e": 190595,
"s": 190435,
"text": "There are three estimation times involved in PERT; Optimistic Time Estimate (TOPT), Most Likely Time Estimate (TLIKELY), and Pessimistic Time Estimate (TPESS)."
},
{
"code": null,
"e": 190754,
"s": 190595,
"text": "In PERT, these three estimate times are derived for each activity. This way, a range of time is given for each activity with the most probable value, TLIKELY."
},
{
"code": null,
"e": 190802,
"s": 190754,
"text": "Following are further details on each estimate:"
},
{
"code": null,
"e": 190994,
"s": 190802,
"text": "This is the fastest time an activity can be completed. For this, the assumption is made that all the necessary resources are available and all predecessor activities are completed as planned."
},
{
"code": null,
"e": 191139,
"s": 190994,
"text": "Most of the times, project managers are asked only to submit one estimate. In that case, this is the estimate that goes to the upper management."
},
{
"code": null,
"e": 191366,
"s": 191139,
"text": "This is the maximum time required to complete an activity. In this case, it is assumed that many things go wrong related to the activity. A lot of rework and resource unavailability are assumed when this estimation is derived."
},
{
"code": null,
"e": 191480,
"s": 191366,
"text": "BETA probability distribution is what works behind PERT. The expected completion time (E) is calculated as below:"
},
{
"code": null,
"e": 191517,
"s": 191480,
"text": "E = (TOPT + 4 x TLIEKLY + TPESS) / 6"
},
{
"code": null,
"e": 191601,
"s": 191517,
"text": "At the same time, the possible variance (V) of the estimate is calculated as below:"
},
{
"code": null,
"e": 191628,
"s": 191601,
"text": "V = (TPESS - TOPT)^2 / 6^2"
},
{
"code": null,
"e": 191689,
"s": 191628,
"text": "Now, following is the process we follow with the two values:"
},
{
"code": null,
"e": 191754,
"s": 191689,
"text": "For every activity in the critical path, E and V are calculated."
},
{
"code": null,
"e": 191819,
"s": 191754,
"text": "For every activity in the critical path, E and V are calculated."
},
{
"code": null,
"e": 191918,
"s": 191819,
"text": "Then, the total of all Es are taken. This is the overall expected completion time for the project."
},
{
"code": null,
"e": 192017,
"s": 191918,
"text": "Then, the total of all Es are taken. This is the overall expected completion time for the project."
},
{
"code": null,
"e": 192276,
"s": 192017,
"text": "Now, the corresponding V is added to each activity of the critical path. This is the variance for the entire project. This is done only for the activities in the critical path as only the critical path activities can accelerate or delay the project duration."
},
{
"code": null,
"e": 192535,
"s": 192276,
"text": "Now, the corresponding V is added to each activity of the critical path. This is the variance for the entire project. This is done only for the activities in the critical path as only the critical path activities can accelerate or delay the project duration."
},
{
"code": null,
"e": 192642,
"s": 192535,
"text": "Then, standard deviation of the project is calculated. This equals to the square root of the variance (V)."
},
{
"code": null,
"e": 192749,
"s": 192642,
"text": "Then, standard deviation of the project is calculated. This equals to the square root of the variance (V)."
},
{
"code": null,
"e": 192872,
"s": 192749,
"text": "Now, the normal probability distribution is used for calculating the project completion time with the desired probability."
},
{
"code": null,
"e": 192995,
"s": 192872,
"text": "Now, the normal probability distribution is used for calculating the project completion time with the desired probability."
},
{
"code": null,
"e": 193116,
"s": 192995,
"text": "The best thing about PERT is its ability to integrate the uncertainty in project times estimations into its methodology."
},
{
"code": null,
"e": 193358,
"s": 193116,
"text": "It also makes use of many assumption that can accelerate or delay the project progress. Using PERT, project managers can have an idea of the possible time variation for the deliveries and offer delivery dates to the client in a safer manner."
},
{
"code": null,
"e": 193508,
"s": 193358,
"text": "Effective project management is essential in absolutely any organization, regardless of the nature of the business and the scale of the organization."
},
{
"code": null,
"e": 193711,
"s": 193508,
"text": "From choosing a project to right through to the end, it is important that the project is carefully and closely managed. This is essentially the role of the project manager and his/her team of employees."
},
{
"code": null,
"e": 194048,
"s": 193711,
"text": "Managing and tracking the progress of a project is no easy task. Every project manager must know (and communicate to his/her team) all the project goals, specifications and deadlines that need to be met in order to be cost-effective, save time, and also to ensure that quality is maintained so that the customer is completely satisfied."
},
{
"code": null,
"e": 194292,
"s": 194048,
"text": "The project plan and other documents are therefore very important right through out the project. Effective project management, however, cannot simply be achieved without employing certain techniques and methods. One such method is the PRINCE2."
},
{
"code": null,
"e": 194528,
"s": 194292,
"text": "PRINCE stands for Projects in Controlled Environments. Dealing with a bit of history, this method was first established by the Central Computer and Telecommunications Agency (It is now referred to as the Office of Government Commerce)."
},
{
"code": null,
"e": 194690,
"s": 194528,
"text": "It has since become a very commonly used project management method in all parts of the world and has therefore proven to be highly effective in various respects."
},
{
"code": null,
"e": 194946,
"s": 194690,
"text": "The method also helps you to identify and thereafter assign roles to the different members of the team based on expertise. Over the years, there have been a number of positive case studies of projects that have used PRINCE2 project management methodology."
},
{
"code": null,
"e": 195035,
"s": 194946,
"text": "This method deals with the various aspects that need to be managed in any given project."
},
{
"code": null,
"e": 195075,
"s": 195035,
"text": "The diagram below illustrates the idea."
},
{
"code": null,
"e": 195097,
"s": 195075,
"text": "In the above diagram:"
},
{
"code": null,
"e": 195345,
"s": 195097,
"text": "The seven principles shown in the above diagram must be applied if the project is to be called a PRINCE2 project. These principles will show you whether and how well the project is being carried out using this particular project management method."
},
{
"code": null,
"e": 195593,
"s": 195345,
"text": "The seven principles shown in the above diagram must be applied if the project is to be called a PRINCE2 project. These principles will show you whether and how well the project is being carried out using this particular project management method."
},
{
"code": null,
"e": 195931,
"s": 195593,
"text": "Similarly, the themes of PRINCE2 refer to the seven principles that need to be referred to at all times during the project, if the project is to indeed be effective. If adherence to these principles is not carefully tracked from the inception of the project through to the end, there is a high chance that the project will fail entirely."
},
{
"code": null,
"e": 196269,
"s": 195931,
"text": "Similarly, the themes of PRINCE2 refer to the seven principles that need to be referred to at all times during the project, if the project is to indeed be effective. If adherence to these principles is not carefully tracked from the inception of the project through to the end, there is a high chance that the project will fail entirely."
},
{
"code": null,
"e": 196390,
"s": 196269,
"text": "The processes refer to the steps that need to be followed. This is why this method is known as a 'process-based' method."
},
{
"code": null,
"e": 196511,
"s": 196390,
"text": "The processes refer to the steps that need to be followed. This is why this method is known as a 'process-based' method."
},
{
"code": null,
"e": 196879,
"s": 196511,
"text": "Finally, with regard to the project environment, it's important to know that this project management method is not rigid. Changes can be made based on how big the project is, and the requirements and objectives of each organization. PRINCE2 offer this flexibility for the project and this is one of the reasons why PRINCE2 is quite popular among the project managers."
},
{
"code": null,
"e": 197247,
"s": 196879,
"text": "Finally, with regard to the project environment, it's important to know that this project management method is not rigid. Changes can be made based on how big the project is, and the requirements and objectives of each organization. PRINCE2 offer this flexibility for the project and this is one of the reasons why PRINCE2 is quite popular among the project managers."
},
{
"code": null,
"e": 197535,
"s": 197247,
"text": "One benefit of using this method over others could be said to be the fact that it is product-based and it also divides the project into different stages making it easy to manage. This is sure to help the project team to remain focused and deliver a quality outcome at the end of the day."
},
{
"code": null,
"e": 197748,
"s": 197535,
"text": "The most important of all benefits is that it improves communication between all members of the team and also between the team and other external stakeholders, thereby giving the team more control of the project."
},
{
"code": null,
"e": 197916,
"s": 197748,
"text": "It also gives the stakeholder a chance to have a say when it comes to decision making as they are always kept informed by the issuance of reports at regular intervals."
},
{
"code": null,
"e": 198149,
"s": 197916,
"text": "PRINCE2 also ensures that improvements can be made in the organization. This is because you would be able to identify any flaws that you make in projects and correct, which of course would help you to a great extent in the long run."
},
{
"code": null,
"e": 198399,
"s": 198149,
"text": "The flexibility of PRINCE2 allows these changes to be made run-time. Although there can be some implications and issues to the project schedule when certain changes are done run-time, PRINCE2 offers some of the best practices to minimize the impact."
},
{
"code": null,
"e": 198609,
"s": 198399,
"text": "Your team will also learn to save a lot of time and be more economical when it comes to the use of assets and various other resources, thereby ensuring that you are also able to cut down on costs a great deal."
},
{
"code": null,
"e": 198930,
"s": 198609,
"text": "When it comes to disadvantages, PRNCE2 does not offer the level of flexibility offered by some of the modern project management methodologies. Since project management, especially in software industry, has grown to a different level, PRINCE2 may find difficulties in catering some of the modern project management needs."
},
{
"code": null,
"e": 199173,
"s": 198930,
"text": "It should be kept in mind that PRINCE2 is a very complex method and cannot be carried out without special training. Failure to understand precisely how it works could lead to a lot of problems and difficulties whilst carrying out the project."
},
{
"code": null,
"e": 199369,
"s": 199173,
"text": "PRINCE2 guidelines can be selectively applied to certain projects that do not last long. This makes the method even more flexible and thereby more appealing to dynamic organizations and projects."
},
{
"code": null,
"e": 199605,
"s": 199369,
"text": "Setting priorities is one of the main management functions of an organization. If the managers do not prioritize their tasks and organizational objectives, the organization will head towards the wrong direction and eventually collapse."
},
{
"code": null,
"e": 199747,
"s": 199605,
"text": "Therefore, management is required to prioritize their tasks and focus on the priority items that will have a high impact on the organization."
},
{
"code": null,
"e": 199984,
"s": 199747,
"text": "Pareto Chart tool is one of the most effective tools that the management can use when it comes to identifying the facts needed for setting priorities. Pareto charts clearly illustrate the information in an organized and relative manner."
},
{
"code": null,
"e": 200211,
"s": 199984,
"text": "This way, the management can find out the relative importance of problems or causes of the problems. When it comes to prioritizing the causes of the problem, a Pareto chart can be used together with a cause-and-effect diagram."
},
{
"code": null,
"e": 200422,
"s": 200211,
"text": "Once the Pareto chart is created, it shows you a vertical bar chart with the highest importance to the lowest. The importance of each parameter is measured by several factors such as frequency, time, cost, etc."
},
{
"code": null,
"e": 200614,
"s": 200422,
"text": "Pareto charts are created based on the Pareto principle. The principle suggests that when a number of factors affect a situation, fewer factors will be accountable for the most of the affect."
},
{
"code": null,
"e": 200739,
"s": 200614,
"text": "This is almost the same as 80/20 theory that you may have heard of. It says that 80% of the impact is made by 20% of causes."
},
{
"code": null,
"e": 200953,
"s": 200739,
"text": "When a team works together in a large and complex project, it can be quite tricky to understand the importance of certain issues. Pareto charts can show the team a few important things that really matter the most."
},
{
"code": null,
"e": 201189,
"s": 200953,
"text": "Most teams use Pareto charts over time in order to identify whether the suggested solution really answers the problem. If the solution is effective, the relative importance of the identified factor should take a lesser value over time."
},
{
"code": null,
"e": 201311,
"s": 201189,
"text": "First of all, list down everything you need to compare. This can be a list of issues, items, or a list of problem causes."
},
{
"code": null,
"e": 201491,
"s": 201311,
"text": "Decide on the standard measures to compare the list items. You need to consider organizational objectives and current trends in order to determine the measures. Some measures are:"
},
{
"code": null,
"e": 201565,
"s": 201491,
"text": "Frequency - How often it occurs (Errors, complaints, complications, etc.)"
},
{
"code": null,
"e": 201639,
"s": 201565,
"text": "Frequency - How often it occurs (Errors, complaints, complications, etc.)"
},
{
"code": null,
"e": 201696,
"s": 201639,
"text": "Cost - How many resources are being utilized or affected"
},
{
"code": null,
"e": 201753,
"s": 201696,
"text": "Cost - How many resources are being utilized or affected"
},
{
"code": null,
"e": 201778,
"s": 201753,
"text": "Time - How long it takes"
},
{
"code": null,
"e": 201803,
"s": 201778,
"text": "Time - How long it takes"
},
{
"code": null,
"e": 201855,
"s": 201803,
"text": "Select a timeframe for the data collection process."
},
{
"code": null,
"e": 202062,
"s": 201855,
"text": "Now, we do some simple math with the data we collected. Take each list item (or cause) and record it against the measurement selected. Then, determine its percentage in the context and all item occurrences."
},
{
"code": null,
"e": 202184,
"s": 202062,
"text": "As an example, if the list of item contains causes behind late comers to office, the tallying table will look like below."
},
{
"code": null,
"e": 202439,
"s": 202184,
"text": "Now, rearrange the list and list the item in decreasing order. In our example, list it from the highest number of occurrences to the least number of occurrences. Then, record the cumulative percentage when you travel from the top item to the bottom item."
},
{
"code": null,
"e": 202468,
"s": 202439,
"text": "Refer the following example:"
},
{
"code": null,
"e": 202630,
"s": 202468,
"text": "Create a bar chart. The list items should be displayed along the 'Y' axis from highest to the lowest. Left vertical axis should be the measure that you selected."
},
{
"code": null,
"e": 202776,
"s": 202630,
"text": "In our example, it should be the number of occurrences. Select the right vertical axis as the cumulative percentage. Each item should have a bar."
},
{
"code": null,
"e": 202966,
"s": 202776,
"text": "Now, draw a line graph for cumulative percentages. The first point of the line should be on the top of the first bar. You can use spreadsheet software such as Microsoft Excel for this step."
},
{
"code": null,
"e": 203064,
"s": 202966,
"text": "It offers many tools for creating and analyzing graphs. Now, you should have something like this."
},
{
"code": null,
"e": 203234,
"s": 203064,
"text": "Analyze your chart. You now need to identify the items that appear to have the most impact. Identify the breakpoint (a rapid change) in the graph (refer the red circle)."
},
{
"code": null,
"e": 203363,
"s": 203234,
"text": "If there is no breakpoint, account the causes/items that have 50% or more impact. In our example, there is a visible breakpoint."
},
{
"code": null,
"e": 203556,
"s": 203363,
"text": "There are two causes before the breakpoint, Road traffic and Work till Late Night. Therefore, the two causes that have the most affect to our problem are Road Traffic and Work till Late Night."
},
{
"code": null,
"e": 203701,
"s": 203556,
"text": "Pareto charts can be really useful when used in the proper context. This helps the management to prioritize tasks, risks, activities and causes."
},
{
"code": null,
"e": 203805,
"s": 203701,
"text": "Therefore, Pareto charts should be used as much as possible when it comes to day-to-day prioritization."
},
{
"code": null,
"e": 204209,
"s": 203805,
"text": "Only the leaders with great leadership qualities have introduced good to the world. These leaders have developed powerful leadership skills over the time and eventually become visionaries. They inspire their subordinates and drive them towards achieving their dreams in life. Therefore, developing powerful leadership skills help you to become an effective leader and make a difference in other's lives."
},
{
"code": null,
"e": 204364,
"s": 204209,
"text": "Good leaders are good in getting the desired outcome at the end. They are good at inspiring people and getting their contribution with their full support."
},
{
"code": null,
"e": 204557,
"s": 204364,
"text": "The good leaders constantly raise the standards and expectations from the employees, so the employees continuously enhance themselves. Employees and others follow such great leaders willingly."
},
{
"code": null,
"e": 204661,
"s": 204557,
"text": "Let's have a brief look at the most powerful leadership skills that matter the most in corporate world."
},
{
"code": null,
"e": 204808,
"s": 204661,
"text": "This is the number one skill you should develop. When there is a huge team working under you, setting the examples is the best way to manage them."
},
{
"code": null,
"e": 205028,
"s": 204808,
"text": "If you do not adhere to your own rules, you may not be able to get those working for you to adhere to the rules. When it comes to leading by examples, it includes fairness, honesty, showing respect and professionalism. "
},
{
"code": null,
"e": 205185,
"s": 205028,
"text": "The workplace should never be run by politics and the good old boys. This could be the main reason for demotivating the talented and enthusiastic employees."
},
{
"code": null,
"e": 205439,
"s": 205185,
"text": "In case, if you reward the people you prefer, this will demotivate the talent in the organization and they would leave at the end of the day. The remaining employees will be utterly frustrated and company culture and productivity will never be the same."
},
{
"code": null,
"e": 205704,
"s": 205439,
"text": "Rewarding is a great way to enhance the employee satisfaction. A good leader identifies the talent in the employee and rewards appropriately. A good leader will use facts for assessing the employees for their performance rather than using perceptions for the same."
},
{
"code": null,
"e": 205932,
"s": 205704,
"text": "Depending on the consequences of an event, there can be either negative or positive results. In a corporate environment, most of the time, people are reluctant to take the responsibility and be accountable when things go wrong."
},
{
"code": null,
"e": 206087,
"s": 205932,
"text": "If you are accountable for something, so be it. Show the employees that you are being responsible and send the message that you expect the same from them."
},
{
"code": null,
"e": 206314,
"s": 206087,
"text": "As a good leader, you should not tolerate poor performance and poor behaviour of your employees. Your tolerance may kill employee motivation. No employee will go an extra mile if they are to cover someone's work by doing that."
},
{
"code": null,
"e": 206591,
"s": 206314,
"text": "Setting expectations and defining reasonable performance standards for the employees is one of the key leadership skills. The performance assessment and evaluation criteria for the employees should be transparent and it should allow the employees to find their way to success."
},
{
"code": null,
"e": 206947,
"s": 206591,
"text": "Standards are not only applicable for employee performance. You can set standards for many other aspects of the corporate environment. As an example, it could be how to behave in the office or how to write a quality document. Setting and practicing such high standards will enhance the careers of the employees as well as the organization in the long run."
},
{
"code": null,
"e": 207098,
"s": 206947,
"text": "Good leaders are visionaries. They have a vision for what they do. A powerful leadership skill is to share your vision with the rest of the employees."
},
{
"code": null,
"e": 207316,
"s": 207098,
"text": "This way, you make them aware of what you fundamentally believe in and there will be a lot of people, who are willing to help you. Eventually, you will be able to enhance their lives and make them visionaries as well."
},
{
"code": null,
"e": 207525,
"s": 207316,
"text": "Keeping an open door policy is a real skill for a great leader. Although many companies claim that they practice the open door policy, no one would really bother to escalate information through the open door."
},
{
"code": null,
"e": 207689,
"s": 207525,
"text": "In order to have a real open door policy running, the leader should first practice the policy and show the rest of the staff that information flow has no barriers."
},
{
"code": null,
"e": 207886,
"s": 207689,
"text": "Powerful leadership skills are the best way for you to achieve your professional and personal objectives. The power of leadership skills are noted and required when you climb the corporate ladder."
},
{
"code": null,
"e": 208124,
"s": 207886,
"text": "Without proper leadership skills, you may not be able to manage a large team and drive them to achieve the objectives. Therefore, start strengthening your leadership skills from now onwards and go through necessary trainings if required."
},
{
"code": null,
"e": 208281,
"s": 208124,
"text": "Process-based management is a management technique that aligns the vision, mission and core value systems of a business when formulating corporate strategy."
},
{
"code": null,
"e": 208489,
"s": 208281,
"text": "It helps define the policies that govern the operations of the company, in question; whilst ensuring that the company is not just functioning on a platform of efficiency alone, but one of effectiveness, too."
},
{
"code": null,
"e": 208819,
"s": 208489,
"text": "As process-based management commences from the strategic sphere, the direction of the projects undertaken remain unfaltering, unlike in the event of goals formulated at a tactical level, where some projects tend to veer off course. Working towards a common goal helps achieve harmony across different work groups and departments."
},
{
"code": null,
"e": 209097,
"s": 208819,
"text": "However, it must be re-iterated that strategic support alone is inadequate to make the philosophy of process based management, a success; and that the middle management and employees too, need to recognize their part in the process and take ownership of it for optimal results."
},
{
"code": null,
"e": 209179,
"s": 209097,
"text": "Process needs to be clearly identified and documented if it to yield any clarity."
},
{
"code": null,
"e": 209335,
"s": 209179,
"text": "Departmental documentation, customer-based agreements, purchasing manuals and process flow charts would all help in documenting the aforementioned process."
},
{
"code": null,
"e": 209594,
"s": 209335,
"text": "The input that is required for the process to be operational, the expected output of the process and the people or departments responsible for each constituent part of the process should be identified so that ownership and accountability are not compromised."
},
{
"code": null,
"e": 209714,
"s": 209594,
"text": "Process performance needs to be measured, if the efficacy, quality and timelines are to be monitored and improved upon."
},
{
"code": null,
"e": 209941,
"s": 209714,
"text": "Ideally, the metrics selected should be quantifiable, so that clarity is retained throughout. However, this may not always be possible, but comparative data and relevant benchmarks can always be obtained for relevant analysis."
},
{
"code": null,
"e": 210016,
"s": 209941,
"text": "A variety of tools are available to analyze process performance with ease."
},
{
"code": null,
"e": 210161,
"s": 210016,
"text": "Graphical representations, bar charts, pie charts, variance analysis, gap analysis and cause-and-effect analysis being some of the most popular."
},
{
"code": null,
"e": 210268,
"s": 210161,
"text": "Under this phase of process-based management, compliance audits would help in analyzing process stability."
},
{
"code": null,
"e": 210389,
"s": 210268,
"text": "If it is found to be wanting, new goals need to be set and these should be aligned to the company's strategic direction."
},
{
"code": null,
"e": 210519,
"s": 210389,
"text": "Process improvements should be planned in concurrence with the vision of the organization, its mission statement and its culture."
},
{
"code": null,
"e": 210647,
"s": 210519,
"text": "Sufficient resources should be allocated and an effective team should be in place if the proposed changes are to be successful."
},
{
"code": null,
"e": 210852,
"s": 210647,
"text": "This is where each of the planned improvements come to life from its former paper-based draft. Training can be conducted if and when required and the support of staff should be garnered wherever possible."
},
{
"code": null,
"e": 210992,
"s": 210852,
"text": "Thereafter, regular monitoring and continuous improvements need to be facilitated if the organization is to be one of world class standing."
},
{
"code": null,
"e": 211100,
"s": 210992,
"text": "A process-based organization would have a few inherent characteristics that make it instantly recognizable."
},
{
"code": null,
"e": 211376,
"s": 211100,
"text": "For instance, such a company would view the business as a collection of processes, have strategic plans that drive the processes with commitment from the top management downwards, and such processes would be aligned to the goals and key business outcomes of the organization."
},
{
"code": null,
"e": 211548,
"s": 211376,
"text": "Standardization of processes, high dependence on data accuracy and the continuous quest for sustainable improvements are further hallmarks of a process-based organization."
},
{
"code": null,
"e": 211608,
"s": 211548,
"text": "The benefits of adopting process-based management are many."
},
{
"code": null,
"e": 211792,
"s": 211608,
"text": "Improvements in present processes increase in value-adding activities, reduction of costs and alignment to the strategic vision of the organization are its most sought after benefits."
},
{
"code": null,
"e": 212030,
"s": 211792,
"text": "It also facilitates modern cost allocation techniques such as activity based costing. Process-based management helps the system conform to certain national and international standards and to the requirements of reputed regulatory bodies."
},
{
"code": null,
"e": 212207,
"s": 212030,
"text": "Process-based management is an invaluable tool in customer satisfaction and retention, as it identifies key processes that have stakeholder interests and satisfaction at heart."
},
{
"code": null,
"e": 212400,
"s": 212207,
"text": "As many, a savvy manager at the higher echelons have come to realize the vision of a company is less likely to change over time, as opposed to goals and procedures used to achieve this vision."
},
{
"code": null,
"e": 212621,
"s": 212400,
"text": "Therefore process-based management necessitates managers to evaluate existing processes and take steps to adjust the structure and function of the organization in question, so that maximum efficiency can be thus derived."
},
{
"code": null,
"e": 212909,
"s": 212621,
"text": "Variable factors such as changes in customer expectations, fluctuations in the general economy and the necessity of developing better product lines will result in more innovative workforce who takes ownership of tasks and initiates better performance in their related field of expertise."
},
{
"code": null,
"e": 213018,
"s": 212909,
"text": "In order to understand procurement documents, it is important to understand the term Procurement Management."
},
{
"code": null,
"e": 213176,
"s": 213018,
"text": "Procurement is the purchase of goods and services at the best possible price to meet a purchaser's demand in terms of quantity, quality, dimensions and site."
},
{
"code": null,
"e": 213249,
"s": 213176,
"text": "The procurement cycle in businesses work, which follows the below steps:"
},
{
"code": null,
"e": 213371,
"s": 213249,
"text": "Information Gathering - A potential customer first researches suppliers, who satisfy requirements for the product needed."
},
{
"code": null,
"e": 213493,
"s": 213371,
"text": "Information Gathering - A potential customer first researches suppliers, who satisfy requirements for the product needed."
},
{
"code": null,
"e": 213719,
"s": 213493,
"text": "Supplier Contact - When a prospective supplier has been identified, the customer requests for quotations, proposals, information and tender. This may be done through advertisements or through direct contact with the supplier."
},
{
"code": null,
"e": 213945,
"s": 213719,
"text": "Supplier Contact - When a prospective supplier has been identified, the customer requests for quotations, proposals, information and tender. This may be done through advertisements or through direct contact with the supplier."
},
{
"code": null,
"e": 214108,
"s": 213945,
"text": "Background Review - The customer now examines references for the goods/services concerned and may also consider samples of the goods/services or undertake trials."
},
{
"code": null,
"e": 214271,
"s": 214108,
"text": "Background Review - The customer now examines references for the goods/services concerned and may also consider samples of the goods/services or undertake trials."
},
{
"code": null,
"e": 214454,
"s": 214271,
"text": "Negotiation - Next the negotiations regarding price, availability and customization options are undertaken. The contract regarding the purchase of the goods or services is completed."
},
{
"code": null,
"e": 214637,
"s": 214454,
"text": "Negotiation - Next the negotiations regarding price, availability and customization options are undertaken. The contract regarding the purchase of the goods or services is completed."
},
{
"code": null,
"e": 214853,
"s": 214637,
"text": "Fulfilment - Based on the contract signed, the purchased goods or services are shipped and delivered. Payment is also completed at this stage. Additional training or installation of the product may also be provided."
},
{
"code": null,
"e": 215069,
"s": 214853,
"text": "Fulfilment - Based on the contract signed, the purchased goods or services are shipped and delivered. Payment is also completed at this stage. Additional training or installation of the product may also be provided."
},
{
"code": null,
"e": 215302,
"s": 215069,
"text": "Renewal - Once the goods or services are consumed or disposed of and the contract has expired, the product or service needs to be re-ordered. The customer now decides whether to continue with the same supplier or look for a new one."
},
{
"code": null,
"e": 215535,
"s": 215302,
"text": "Renewal - Once the goods or services are consumed or disposed of and the contract has expired, the product or service needs to be re-ordered. The customer now decides whether to continue with the same supplier or look for a new one."
},
{
"code": null,
"e": 215699,
"s": 215535,
"text": "Documents involved in the procurement cycle are called procurement documents. Procurement documents are an integral part of the early stages of project initiation."
},
{
"code": null,
"e": 216004,
"s": 215699,
"text": "The purpose of procurement documents serves an important aspect of the organizational element in the project process. It refers to the input and output mechanisms and tools that are put in place during the process of bidding and submitting project proposals and the facets of work that make up a project."
},
{
"code": null,
"e": 216134,
"s": 216004,
"text": "In a nutshell, procurement documents are the contractual relationship between the customer and the supplier of goods or services."
},
{
"code": null,
"e": 216300,
"s": 216134,
"text": "Some examples of what constitutes procurement documents include the buyer's commencement to bid and the summons by the financially responsible party for concessions."
},
{
"code": null,
"e": 216464,
"s": 216300,
"text": "In addition, requests for information between two parties and requests for quotations, and proposals and seller's response are also parts of procurement documents."
},
{
"code": null,
"e": 216635,
"s": 216464,
"text": "Basically procurement documents comprise of all documents that serve as invitations to tender, solicit tender offers and establish the terms and conditions of a contract."
},
{
"code": null,
"e": 216677,
"s": 216635,
"text": "A few types of procurement documents are:"
},
{
"code": null,
"e": 216876,
"s": 216677,
"text": "RFP - A request for proposal is an early stage in a procurement process issuing an invitation for suppliers, often through a bidding process, to submit a proposal on a specific commodity or service."
},
{
"code": null,
"e": 217075,
"s": 216876,
"text": "RFP - A request for proposal is an early stage in a procurement process issuing an invitation for suppliers, often through a bidding process, to submit a proposal on a specific commodity or service."
},
{
"code": null,
"e": 217382,
"s": 217075,
"text": "RFI - A request for information (RFI) is a proposal requested from a potential seller or a service provider to determine what products and services are potentially available in the marketplace to meet a buyer's needs and to know the capability of a seller in terms of offerings and strengths of the seller."
},
{
"code": null,
"e": 217689,
"s": 217382,
"text": "RFI - A request for information (RFI) is a proposal requested from a potential seller or a service provider to determine what products and services are potentially available in the marketplace to meet a buyer's needs and to know the capability of a seller in terms of offerings and strengths of the seller."
},
{
"code": null,
"e": 217933,
"s": 217689,
"text": "RFQ - A request for quotation (RFQ) is used when discussions with bidders are not required (mainly when the specifications of a product or service are already known) and when price is the main or only factor in selecting the successful bidder."
},
{
"code": null,
"e": 218177,
"s": 217933,
"text": "RFQ - A request for quotation (RFQ) is used when discussions with bidders are not required (mainly when the specifications of a product or service are already known) and when price is the main or only factor in selecting the successful bidder."
},
{
"code": null,
"e": 218301,
"s": 218177,
"text": "Solicitations: These are invitations of bids, requests for quotations and proposals. These may serve as a binding contract."
},
{
"code": null,
"e": 218425,
"s": 218301,
"text": "Solicitations: These are invitations of bids, requests for quotations and proposals. These may serve as a binding contract."
},
{
"code": null,
"e": 218552,
"s": 218425,
"text": "Offers - This type of procurement documents are bids, proposals and quotes made by potential suppliers to prospective clients."
},
{
"code": null,
"e": 218679,
"s": 218552,
"text": "Offers - This type of procurement documents are bids, proposals and quotes made by potential suppliers to prospective clients."
},
{
"code": null,
"e": 218769,
"s": 218679,
"text": "Contracts - Contracts refer to the final signed agreements between clients and suppliers."
},
{
"code": null,
"e": 218859,
"s": 218769,
"text": "Contracts - Contracts refer to the final signed agreements between clients and suppliers."
},
{
"code": null,
"e": 219024,
"s": 218859,
"text": "Amendments/Modifications - This refers to any changes in solicitations, offers and contracts. Amendments/Modifications have to be in the form of a written document."
},
{
"code": null,
"e": 219189,
"s": 219024,
"text": "Amendments/Modifications - This refers to any changes in solicitations, offers and contracts. Amendments/Modifications have to be in the form of a written document."
},
{
"code": null,
"e": 219334,
"s": 219189,
"text": "Most procurement documents adopt a set structure. This is because it simplifies the documentation process and also allows it to be computerized."
},
{
"code": null,
"e": 219483,
"s": 219334,
"text": "Computerization allows for efficiency and effectiveness in the procurement process. In general, procurement documents have the following attributes:"
},
{
"code": null,
"e": 219577,
"s": 219483,
"text": "Requires potential bidders to submit all particulars for the employer to evaluate the bidder."
},
{
"code": null,
"e": 219671,
"s": 219577,
"text": "Requires potential bidders to submit all particulars for the employer to evaluate the bidder."
},
{
"code": null,
"e": 219786,
"s": 219671,
"text": "All submissions to be set out in a clear and honest manner to ensure that the short-list criterion is unambiguous."
},
{
"code": null,
"e": 219901,
"s": 219786,
"text": "All submissions to be set out in a clear and honest manner to ensure that the short-list criterion is unambiguous."
},
{
"code": null,
"e": 219999,
"s": 219901,
"text": "Clear definition of the responsibilities, rights and commitments of both parties in the contract."
},
{
"code": null,
"e": 220097,
"s": 219999,
"text": "Clear definition of the responsibilities, rights and commitments of both parties in the contract."
},
{
"code": null,
"e": 220181,
"s": 220097,
"text": "Clear definition of the nature and quality of the goods or services to be provided."
},
{
"code": null,
"e": 220265,
"s": 220181,
"text": "Clear definition of the nature and quality of the goods or services to be provided."
},
{
"code": null,
"e": 220332,
"s": 220265,
"text": "Provisions without any prejudice to the interests of either party."
},
{
"code": null,
"e": 220399,
"s": 220332,
"text": "Provisions without any prejudice to the interests of either party."
},
{
"code": null,
"e": 220438,
"s": 220399,
"text": "Clear and easy to understand language."
},
{
"code": null,
"e": 220477,
"s": 220438,
"text": "Clear and easy to understand language."
},
{
"code": null,
"e": 220906,
"s": 220477,
"text": "Engineering and Construction Work\n\nMinor/Low Risk Contracts: In this type of contract, services are required by an organization for a short period and the work is usually repetitive. Hence, this type of contract does not require high-end management techniques.\nMajor/High Risk Contracts: Here, the type of work required is of a more difficult nature and here the implication of sophisticated management techniques is required.\n\n"
},
{
"code": null,
"e": 221132,
"s": 220906,
"text": "Minor/Low Risk Contracts: In this type of contract, services are required by an organization for a short period and the work is usually repetitive. Hence, this type of contract does not require high-end management techniques."
},
{
"code": null,
"e": 221358,
"s": 221132,
"text": "Minor/Low Risk Contracts: In this type of contract, services are required by an organization for a short period and the work is usually repetitive. Hence, this type of contract does not require high-end management techniques."
},
{
"code": null,
"e": 221524,
"s": 221358,
"text": "Major/High Risk Contracts: Here, the type of work required is of a more difficult nature and here the implication of sophisticated management techniques is required."
},
{
"code": null,
"e": 221690,
"s": 221524,
"text": "Major/High Risk Contracts: Here, the type of work required is of a more difficult nature and here the implication of sophisticated management techniques is required."
},
{
"code": null,
"e": 222047,
"s": 221690,
"text": "Services\n\nProfessional - This requires more knowledge-based expertise and this requires managers, who are willing to put more time and effort into seeking research in order to satisfy the customer's criteria.\nFacilities - More often than not, in this type of service the work outsourced is the maintenance or operation of an existing structure or system.\n\n"
},
{
"code": null,
"e": 222246,
"s": 222047,
"text": "Professional - This requires more knowledge-based expertise and this requires managers, who are willing to put more time and effort into seeking research in order to satisfy the customer's criteria."
},
{
"code": null,
"e": 222445,
"s": 222246,
"text": "Professional - This requires more knowledge-based expertise and this requires managers, who are willing to put more time and effort into seeking research in order to satisfy the customer's criteria."
},
{
"code": null,
"e": 222591,
"s": 222445,
"text": "Facilities - More often than not, in this type of service the work outsourced is the maintenance or operation of an existing structure or system."
},
{
"code": null,
"e": 222737,
"s": 222591,
"text": "Facilities - More often than not, in this type of service the work outsourced is the maintenance or operation of an existing structure or system."
},
{
"code": null,
"e": 223143,
"s": 222737,
"text": "Supplies\n\nLocal/Simple Purchases - Goods are more readily available and hence does not require management of the buying and delivery process.\nInternational/Complex Purchases: In this case, goods need to be bought from other countries. A manager's task is more cumbersome and a management process is required to purchase and delivery. In addition, the manager needs to look into cross-border formalities.\n\n"
},
{
"code": null,
"e": 223275,
"s": 223143,
"text": "Local/Simple Purchases - Goods are more readily available and hence does not require management of the buying and delivery process."
},
{
"code": null,
"e": 223407,
"s": 223275,
"text": "Local/Simple Purchases - Goods are more readily available and hence does not require management of the buying and delivery process."
},
{
"code": null,
"e": 223669,
"s": 223407,
"text": "International/Complex Purchases: In this case, goods need to be bought from other countries. A manager's task is more cumbersome and a management process is required to purchase and delivery. In addition, the manager needs to look into cross-border formalities."
},
{
"code": null,
"e": 223931,
"s": 223669,
"text": "International/Complex Purchases: In this case, goods need to be bought from other countries. A manager's task is more cumbersome and a management process is required to purchase and delivery. In addition, the manager needs to look into cross-border formalities."
},
{
"code": null,
"e": 224103,
"s": 223931,
"text": "In most organizations, the procurement department is one of the busiest. Managers need to purchase goods or services required for the smooth running of their organization."
},
{
"code": null,
"e": 224326,
"s": 224103,
"text": "For example, in a hospital, a procurement manager needs to purchase medicines and surgical instruments among others. These goods and services need to be purchased at the lowest possible cost without any deficit in quality."
},
{
"code": null,
"e": 224453,
"s": 224326,
"text": "The documentation that passes between the procurement manager of an organization and a supplier are the procurement documents."
},
{
"code": null,
"e": 224714,
"s": 224453,
"text": "Today, different organizations employ various management techniques to carry out the efficient functioning of their departments. Procurement management is one such form of management, where goods and services are acquired from a different organization or firm."
},
{
"code": null,
"e": 224935,
"s": 224714,
"text": "All organizations deal with this form of management at some point in the life of their businesses. It is in the way the procurement is carried out and the planning of the process that will ensure the things run smoothly."
},
{
"code": null,
"e": 225170,
"s": 224935,
"text": "But with many other management techniques in use, is there any special reason to use this particular form of management to acquire goods and services? Yes, this is one of the frequent questions asked regarding procurement management."
},
{
"code": null,
"e": 225345,
"s": 225170,
"text": "Procurement management is known to help an organization to save much of the money spent when purchasing goods and services from outside. It also has several other advantages."
},
{
"code": null,
"e": 225524,
"s": 225345,
"text": "Following are the four main working areas of concerns when it comes to procurement management. The following points should be considered whenever procurement process is involved:"
},
{
"code": null,
"e": 225872,
"s": 225524,
"text": "Not all goods and services that a business requires need to be purchased from outside. It is for this reason that it is very essential to weigh the pros and cons of purchasing or renting these goods and services from outside.\nYou would need to ask yourself whether it would in the long run be cost-effective and whether it is absolutely necessary."
},
{
"code": null,
"e": 226098,
"s": 225872,
"text": "Not all goods and services that a business requires need to be purchased from outside. It is for this reason that it is very essential to weigh the pros and cons of purchasing or renting these goods and services from outside."
},
{
"code": null,
"e": 226220,
"s": 226098,
"text": "You would need to ask yourself whether it would in the long run be cost-effective and whether it is absolutely necessary."
},
{
"code": null,
"e": 226680,
"s": 226220,
"text": "You would need to have a good idea of what you exactly require and then go on to consider various options and alternatives. Although there may be several suppliers, who provide the same goods and services, careful research would show you whom of these suppliers will give you the best deal for your organization.\nYou can definitely call for some kind of bidding for your requirement by these vendors and use a selection criterion to select the best provider. "
},
{
"code": null,
"e": 226993,
"s": 226680,
"text": "You would need to have a good idea of what you exactly require and then go on to consider various options and alternatives. Although there may be several suppliers, who provide the same goods and services, careful research would show you whom of these suppliers will give you the best deal for your organization."
},
{
"code": null,
"e": 227140,
"s": 226993,
"text": "You can definitely call for some kind of bidding for your requirement by these vendors and use a selection criterion to select the best provider. "
},
{
"code": null,
"e": 227455,
"s": 227140,
"text": "The next step typically would be to call for bids. During this stage, the different suppliers will provide you with quotes.\nThis stage is similar to that of choosing projects, as you would need to consider different criteria, apart from just the cost, to finally decide on which supplier you would want to go with."
},
{
"code": null,
"e": 227579,
"s": 227455,
"text": "The next step typically would be to call for bids. During this stage, the different suppliers will provide you with quotes."
},
{
"code": null,
"e": 227770,
"s": 227579,
"text": "This stage is similar to that of choosing projects, as you would need to consider different criteria, apart from just the cost, to finally decide on which supplier you would want to go with."
},
{
"code": null,
"e": 228366,
"s": 227770,
"text": "After the evaluation process, you would be able to select the best supplier. You would then need to move on to the step of discussing what should go into the contract. Remember to mention all financing terms how you wish to make the payments, and so on, so as to prevent any confusion arising later on, as this contract will be binding.\nAlways remember that it is of utmost importance to maintain a good relationship with the supplier. This includes coming up with an agreement that both would find satisfactory. This helps the sustainability of your business as well as the supplier's business."
},
{
"code": null,
"e": 228703,
"s": 228366,
"text": "After the evaluation process, you would be able to select the best supplier. You would then need to move on to the step of discussing what should go into the contract. Remember to mention all financing terms how you wish to make the payments, and so on, so as to prevent any confusion arising later on, as this contract will be binding."
},
{
"code": null,
"e": 228962,
"s": 228703,
"text": "Always remember that it is of utmost importance to maintain a good relationship with the supplier. This includes coming up with an agreement that both would find satisfactory. This helps the sustainability of your business as well as the supplier's business."
},
{
"code": null,
"e": 229117,
"s": 228962,
"text": "These four simple steps would help you acquire your goods easily and quickly without much hassle, but always requires careful consideration at each stage."
},
{
"code": null,
"e": 229456,
"s": 229117,
"text": "In order to ensure that everything goes well through to the end, you would have to keep track of the progress of the procurement. This would mean that you should keep checking on the suppliers in order to ensure that they are abiding by the terms of the contract and will be able to supply you with the goods and services by the deadline."
},
{
"code": null,
"e": 229632,
"s": 229456,
"text": "Should there be any discrepancies or any issues, you should always let the supplier know by means of the method of communication decided on at the time of making the contract."
},
{
"code": null,
"e": 229906,
"s": 229632,
"text": "The organization must always be willing and open to change. This is in respect of all changes required in order to ensure the efficiency of the process. These changes could be in the form of technological advancements and even changes to the workforce, among other changes."
},
{
"code": null,
"e": 230019,
"s": 229906,
"text": "In terms of technology, any new equipment and machinery required to handle these goods may need to be purchased."
},
{
"code": null,
"e": 230179,
"s": 230019,
"text": "Similarly, with regard to the workforce, you would need to employ workers, who are highly skilled and trained when it comes to dealing directly with suppliers."
},
{
"code": null,
"e": 230600,
"s": 230179,
"text": "It is always best for an organization to have different teams within who are specialized in different fields. This would make procurement management even easier. Each team could then deal with the relevant areas of buying and will also have the expertise required. For example, those who have experience buying machinery may not have the same skill when it comes to getting particular services from another organization."
},
{
"code": null,
"e": 230842,
"s": 230600,
"text": "It should be kept in mind, however, that this procurement management system must run efficiently and smoothly for all benefits to be reaped. The key to this would therefore be an efficient system as well as the right supplier and resources."
},
{
"code": null,
"e": 230983,
"s": 230842,
"text": "For the purpose of procurement management, there should be a team of highly trained individuals, if procurement management plays a key role."
},
{
"code": null,
"e": 231120,
"s": 230983,
"text": "As an example, a hospital should have a dedicated procurement team and should employ strong procurement management techniques and tools."
},
{
"code": null,
"e": 231291,
"s": 231120,
"text": "When it comes to a project, the entire project is divided into many interdependent tasks. In this set of tasks, the sequence or the order of the tasks is quite important."
},
{
"code": null,
"e": 231390,
"s": 231291,
"text": "If the sequence is wrong, the end result of the project might not be what the management expected."
},
{
"code": null,
"e": 231546,
"s": 231390,
"text": "Some tasks in the projects can safely be performed parallel to other tasks. In a project activity diagram, the sequence of the tasks is simply illustrated."
},
{
"code": null,
"e": 231700,
"s": 231546,
"text": "There are many tools that can be used for drawing project activity diagrams. Microsoft Project is one of the most popular software for this type of work."
},
{
"code": null,
"e": 231818,
"s": 231700,
"text": "In addition to that, Microsoft Vision (for Windows) and Omni Graffle (for Mac) can be used to draw activity diagrams."
},
{
"code": null,
"e": 231982,
"s": 231818,
"text": "Have you seen process flow diagrams? If yes, then activity diagrams takes the same shape. Usually there are two main shapes in activity diagrams, boxes and arrows."
},
{
"code": null,
"e": 232150,
"s": 231982,
"text": "Boxes of the activity diagram indicate the tasks and the arrows show the relationships. Usually, the relationships are the sequences that take place in the activities."
},
{
"code": null,
"e": 232254,
"s": 232150,
"text": "Following is an example of activity diagram with tasks in boxes and relationship represented by arrows."
},
{
"code": null,
"e": 232411,
"s": 232254,
"text": "This type of activity diagram is also known as activity-on-node diagram. This is due to the fact that all activities (tasks) are shown on the nodes (boxes)."
},
{
"code": null,
"e": 232589,
"s": 232411,
"text": "Alternatively, there is another way of presenting an activity diagram. This is called activity-on-arrow diagram. In this diagram, activities (tasks) are presented by the arrows."
},
{
"code": null,
"e": 232803,
"s": 232589,
"text": "Compared to activity-on-node diagrams, activity-on-arrow diagrams introduce a little confusion. Therefore, in most instances, people often use activity-on-nodes diagrams. Following is an activity-on-arrow diagram:"
},
{
"code": null,
"e": 233023,
"s": 232803,
"text": "Creating an activity diagram is easy. You can use a paper-based material such as a post it note or software for this purpose. Regardless of the medium used, the process of creating the activity diagram remains the same."
},
{
"code": null,
"e": 233090,
"s": 233023,
"text": "Following are main steps involved in creating an activity diagram:"
},
{
"code": null,
"e": 233240,
"s": 233090,
"text": "First of all, identify the tasks in the project. You can use WBS (Work Breakdown Structure) for this purpose and there is no need to repeat the same."
},
{
"code": null,
"e": 233418,
"s": 233240,
"text": "Just use the same tasks breakdown for the activity diagram as well. If you use software for creating the activity diagram (which is recommended), create a box for each activity."
},
{
"code": null,
"e": 233541,
"s": 233418,
"text": "Illustrate all boxes in the same size in order to avoid any confusion. Make sure all your tasks have the same granularity."
},
{
"code": null,
"e": 233721,
"s": 233541,
"text": "You can add more information to the task boxes, such as who is doing the task and the timeframes. You can add this information inside the box or can add it somewhere near the box."
},
{
"code": null,
"e": 234056,
"s": 233721,
"text": "Now, arrange the boxes in the sequence that they are performed during the project execution. The early tasks will be at the left hand side and the tasks performed at the later part of the project execution will be at the right hand side. The tasks that can be performed in parallel should be kept parallel to each other (vertically). "
},
{
"code": null,
"e": 234204,
"s": 234056,
"text": "You may have to adjust the sequence a number of times until you get it right. This is why software is an easy tool for creating activity diagrams. "
},
{
"code": null,
"e": 234398,
"s": 234204,
"text": "Now, use arrows to join task boxes. These arrows will show the sequence of the tasks. Sometimes, a 'start' and an 'end' box can be added to clearly present the start and the end of the project."
},
{
"code": null,
"e": 234503,
"s": 234398,
"text": "To understand what we have done in the above four steps, please refer to the following activity diagram:"
},
{
"code": null,
"e": 234694,
"s": 234503,
"text": "Activity diagrams can be used for illustrating the sequence of project tasks. These diagrams can be created with a minimum effort and gives you a clear understanding of interdependent tasks."
},
{
"code": null,
"e": 234770,
"s": 234694,
"text": "In addition, the activity diagram is an input for the critical path method."
},
{
"code": null,
"e": 235000,
"s": 234770,
"text": "Project Charter refers to a statement of objectives in a project. This statement also sets out detailed project goals, roles and responsibilities, identifies the main stakeholders, and the level of authority of a project manager."
},
{
"code": null,
"e": 235127,
"s": 235000,
"text": "It acts as a guideline for future projects as well as an important material in the organization's knowledge management system."
},
{
"code": null,
"e": 235398,
"s": 235127,
"text": "The project charter is a short document that would consist of new offering request or a request for proposal. This document is a part of the project management process, which is required by Initiative for Policy Dialogue (IPD) and Customer Relationship Management (CRM)."
},
{
"code": null,
"e": 235444,
"s": 235398,
"text": "Following are the roles of a Project Charter:"
},
{
"code": null,
"e": 235498,
"s": 235444,
"text": "It documents the reasons for undertaking the project."
},
{
"code": null,
"e": 235552,
"s": 235498,
"text": "It documents the reasons for undertaking the project."
},
{
"code": null,
"e": 235618,
"s": 235552,
"text": "Outlines the objectives and the constraints faced by the project."
},
{
"code": null,
"e": 235684,
"s": 235618,
"text": "Outlines the objectives and the constraints faced by the project."
},
{
"code": null,
"e": 235727,
"s": 235684,
"text": "Provides solutions to the problem in hand."
},
{
"code": null,
"e": 235770,
"s": 235727,
"text": "Provides solutions to the problem in hand."
},
{
"code": null,
"e": 235819,
"s": 235770,
"text": "Identifies the main stakeholders of the project."
},
{
"code": null,
"e": 235868,
"s": 235819,
"text": "Identifies the main stakeholders of the project."
},
{
"code": null,
"e": 235939,
"s": 235868,
"text": "Following are the prominent benefits of Project Charter for a project:"
},
{
"code": null,
"e": 235998,
"s": 235939,
"text": "It improves and paves way for good customer relationships."
},
{
"code": null,
"e": 236057,
"s": 235998,
"text": "It improves and paves way for good customer relationships."
},
{
"code": null,
"e": 236138,
"s": 236057,
"text": "Project Charter also works as a tool that improves project management processes."
},
{
"code": null,
"e": 236219,
"s": 236138,
"text": "Project Charter also works as a tool that improves project management processes."
},
{
"code": null,
"e": 236301,
"s": 236219,
"text": "Regional and headquarter communications can also be improved to a greater extent."
},
{
"code": null,
"e": 236383,
"s": 236301,
"text": "Regional and headquarter communications can also be improved to a greater extent."
},
{
"code": null,
"e": 236452,
"s": 236383,
"text": "By having a project charter, project sponsorship can also be gained."
},
{
"code": null,
"e": 236521,
"s": 236452,
"text": "By having a project charter, project sponsorship can also be gained."
},
{
"code": null,
"e": 236573,
"s": 236521,
"text": "Project Charter recognizes senior management roles."
},
{
"code": null,
"e": 236625,
"s": 236573,
"text": "Project Charter recognizes senior management roles."
},
{
"code": null,
"e": 236698,
"s": 236625,
"text": "Allows progression, which is aimed at attaining industry best practices."
},
{
"code": null,
"e": 236771,
"s": 236698,
"text": "Allows progression, which is aimed at attaining industry best practices."
},
{
"code": null,
"e": 236938,
"s": 236771,
"text": "Since project charter is a project planning tool, which is aimed at resolving an issue or an opportunity, the below elements are essential for a good charter project."
},
{
"code": null,
"e": 237012,
"s": 236938,
"text": "For an effective charter project, it needs to address these key elements:"
},
{
"code": null,
"e": 237037,
"s": 237012,
"text": "Identity of the project."
},
{
"code": null,
"e": 237062,
"s": 237037,
"text": "Identity of the project."
},
{
"code": null,
"e": 237117,
"s": 237062,
"text": "Time: the start date and the deadline for the project."
},
{
"code": null,
"e": 237172,
"s": 237117,
"text": "Time: the start date and the deadline for the project."
},
{
"code": null,
"e": 237204,
"s": 237172,
"text": "People involved in the project."
},
{
"code": null,
"e": 237236,
"s": 237204,
"text": "People involved in the project."
},
{
"code": null,
"e": 237273,
"s": 237236,
"text": "Outlined objectives and set targets."
},
{
"code": null,
"e": 237310,
"s": 237273,
"text": "Outlined objectives and set targets."
},
{
"code": null,
"e": 237400,
"s": 237310,
"text": "The reason for a project charter to be carried out, often referred to as 'business case'."
},
{
"code": null,
"e": 237490,
"s": 237400,
"text": "The reason for a project charter to be carried out, often referred to as 'business case'."
},
{
"code": null,
"e": 237543,
"s": 237490,
"text": "Detailed description of a problem or an opportunity."
},
{
"code": null,
"e": 237596,
"s": 237543,
"text": "Detailed description of a problem or an opportunity."
},
{
"code": null,
"e": 237634,
"s": 237596,
"text": "The return expected from the project."
},
{
"code": null,
"e": 237672,
"s": 237634,
"text": "The return expected from the project."
},
{
"code": null,
"e": 237728,
"s": 237672,
"text": "Results that could be expected in terms of performance."
},
{
"code": null,
"e": 237784,
"s": 237728,
"text": "Results that could be expected in terms of performance."
},
{
"code": null,
"e": 237841,
"s": 237784,
"text": "The expected date that the objectives is to be achieved."
},
{
"code": null,
"e": 237898,
"s": 237841,
"text": "The expected date that the objectives is to be achieved."
},
{
"code": null,
"e": 237971,
"s": 237898,
"text": "Clearly defined roles and responsibilities of the participants involved."
},
{
"code": null,
"e": 238044,
"s": 237971,
"text": "Clearly defined roles and responsibilities of the participants involved."
},
{
"code": null,
"e": 238124,
"s": 238044,
"text": "Requirement of resources that will be needed for the objectives to be achieved."
},
{
"code": null,
"e": 238204,
"s": 238124,
"text": "Requirement of resources that will be needed for the objectives to be achieved."
},
{
"code": null,
"e": 238254,
"s": 238204,
"text": "Barriers and the risks involved with the project."
},
{
"code": null,
"e": 238304,
"s": 238254,
"text": "Barriers and the risks involved with the project."
},
{
"code": null,
"e": 238347,
"s": 238304,
"text": "Informed and effective communication plan."
},
{
"code": null,
"e": 238390,
"s": 238347,
"text": "Informed and effective communication plan."
},
{
"code": null,
"e": 238502,
"s": 238390,
"text": "Out of all above elements, there are three most important and essential elements that need further elaboration."
},
{
"code": null,
"e": 238784,
"s": 238502,
"text": "This outlines the need for a project charter to take place. A business case should set out the benefits gained from carrying out a project charter. Benefits need not only be in terms of finance such as revenue, cost reduction, etc., but also the benefit that the customer receives."
},
{
"code": null,
"e": 238843,
"s": 238784,
"text": "Following are the characteristics of a good business case:"
},
{
"code": null,
"e": 238883,
"s": 238843,
"text": "The reasons of undertaking the project."
},
{
"code": null,
"e": 238923,
"s": 238883,
"text": "The reasons of undertaking the project."
},
{
"code": null,
"e": 238977,
"s": 238923,
"text": "The benefits gained from undertaking the project now."
},
{
"code": null,
"e": 239031,
"s": 238977,
"text": "The benefits gained from undertaking the project now."
},
{
"code": null,
"e": 239074,
"s": 239031,
"text": "The consequences of not doing the project."
},
{
"code": null,
"e": 239117,
"s": 239074,
"text": "The consequences of not doing the project."
},
{
"code": null,
"e": 239182,
"s": 239117,
"text": "The factors that would conclude that it fits the business goals."
},
{
"code": null,
"e": 239247,
"s": 239182,
"text": "The factors that would conclude that it fits the business goals."
},
{
"code": null,
"e": 239362,
"s": 239247,
"text": "As the name denotes, it refers to the scope that the project will give the business if they undertake the project."
},
{
"code": null,
"e": 239431,
"s": 239362,
"text": "Before doing a project, the following concerns need to be addressed:"
},
{
"code": null,
"e": 239489,
"s": 239431,
"text": "The within scope and out of scope needs to be considered."
},
{
"code": null,
"e": 239547,
"s": 239489,
"text": "The within scope and out of scope needs to be considered."
},
{
"code": null,
"e": 239591,
"s": 239547,
"text": "The process that each team will focus upon."
},
{
"code": null,
"e": 239635,
"s": 239591,
"text": "The process that each team will focus upon."
},
{
"code": null,
"e": 239675,
"s": 239635,
"text": "The start and end points for a process."
},
{
"code": null,
"e": 239715,
"s": 239675,
"text": "The start and end points for a process."
},
{
"code": null,
"e": 239742,
"s": 239715,
"text": "Availability of resources."
},
{
"code": null,
"e": 239769,
"s": 239742,
"text": "Availability of resources."
},
{
"code": null,
"e": 239813,
"s": 239769,
"text": "Constraints under which the team will work."
},
{
"code": null,
"e": 239857,
"s": 239813,
"text": "Constraints under which the team will work."
},
{
"code": null,
"e": 239876,
"s": 239857,
"text": "Time limitations ."
},
{
"code": null,
"e": 239895,
"s": 239876,
"text": "Time limitations ."
},
{
"code": null,
"e": 239965,
"s": 239895,
"text": "The impact on the normal workload if the project is to be undertaken."
},
{
"code": null,
"e": 240035,
"s": 239965,
"text": "The impact on the normal workload if the project is to be undertaken."
},
{
"code": null,
"e": 240278,
"s": 240035,
"text": "The need for a good communication plan is at its utmost necessity when it comes to planning a project. Project managers need to work on building a good communication plan which will help in meeting the overall objectives of a Project Charter."
},
{
"code": null,
"e": 240382,
"s": 240278,
"text": "When creating a communication plan, the project manager needs to take the following into consideration:"
},
{
"code": null,
"e": 240453,
"s": 240382,
"text": "Who - responsibility of each individuals participating in the project."
},
{
"code": null,
"e": 240524,
"s": 240453,
"text": "Who - responsibility of each individuals participating in the project."
},
{
"code": null,
"e": 240581,
"s": 240524,
"text": "What - the motive and the reason for communication plan."
},
{
"code": null,
"e": 240638,
"s": 240581,
"text": "What - the motive and the reason for communication plan."
},
{
"code": null,
"e": 240698,
"s": 240638,
"text": "Where - location where the receiver could find information."
},
{
"code": null,
"e": 240758,
"s": 240698,
"text": "Where - location where the receiver could find information."
},
{
"code": null,
"e": 240823,
"s": 240758,
"text": "When - the duration and the frequency of the communication plan."
},
{
"code": null,
"e": 240888,
"s": 240823,
"text": "When - the duration and the frequency of the communication plan."
},
{
"code": null,
"e": 240955,
"s": 240888,
"text": "How - the mechanism which is used to facilitate the communication."
},
{
"code": null,
"e": 241022,
"s": 240955,
"text": "How - the mechanism which is used to facilitate the communication."
},
{
"code": null,
"e": 241065,
"s": 241022,
"text": "Whom - The receivers of the communication."
},
{
"code": null,
"e": 241108,
"s": 241065,
"text": "Whom - The receivers of the communication."
},
{
"code": null,
"e": 241372,
"s": 241108,
"text": "The project charter is not only a tool that is used for planning projects but also a communication mechanism that acts as a reference. A well-planned project with an effective communication plan will definitely bring in success for the project undertaken at hand."
},
{
"code": null,
"e": 241600,
"s": 241372,
"text": "Therefore, the Project Charter should be one of the frequently referred documents in a project and the entire project team needs to be aware of the content of the Project Charter. This is a key element for a successful project."
},
{
"code": null,
"e": 241776,
"s": 241600,
"text": "In the world of business, contracts are used for establishing business deals and partnerships. The parties involved in the business engagement decide the type of the contract."
},
{
"code": null,
"e": 241916,
"s": 241776,
"text": "Usually, the type of the contract used for the business engagement varies depending on the type of the work and the nature of the industry."
},
{
"code": null,
"e": 242104,
"s": 241916,
"text": "The contract is simply an elaborated agreement between two or more parties. One or more parties may provide products or services in return to something provided by other parties (client)."
},
{
"code": null,
"e": 242241,
"s": 242104,
"text": "The contract type is the key relationship between the parties engaged in the business and the contract type determines the project risk."
},
{
"code": null,
"e": 242294,
"s": 242241,
"text": "Let' have a look at most widely used contract types."
},
{
"code": null,
"e": 242398,
"s": 242294,
"text": "This is the simplest type of all contracts. The terms are quite straightforward and easy to understand."
},
{
"code": null,
"e": 242573,
"s": 242398,
"text": "To put in simple, the service provider agrees to provide a defined service for a specific period of time and the client agrees to pay a fixed amount of money for the service."
},
{
"code": null,
"e": 242798,
"s": 242573,
"text": "This contract type may define various milestones for the deliveries as well as KPIs (Key Performance Indicators). In addition, the contractor may have an acceptance criteria defined for the milestones and the final delivery."
},
{
"code": null,
"e": 242925,
"s": 242798,
"text": "The main advantages of this type of contract is that the contractor knows the total project cost before the project commences."
},
{
"code": null,
"e": 243122,
"s": 242925,
"text": "In this model, the project is divided into units and the charge for each unit is defined. This contract type can be introduced as one of the more flexible methods compared to fixed price contract."
},
{
"code": null,
"e": 243261,
"s": 243122,
"text": "Usually, the owner (contractor/client) of the project decides on the estimates and asks the bidders to bid of each element of the project."
},
{
"code": null,
"e": 243469,
"s": 243261,
"text": "After bidding, depending on the bid amounts and the qualifications of bidders, the entire project may be given to the same service provider or different units may be allocated to different service providers."
},
{
"code": null,
"e": 243563,
"s": 243469,
"text": "This is a good approach when different project units require different expertise to complete."
},
{
"code": null,
"e": 243740,
"s": 243563,
"text": "In this contract model, the services provider is reimbursed for their machinery, labour and other costs, in addition to contractor paying an agreed fee to the service provider."
},
{
"code": null,
"e": 243967,
"s": 243740,
"text": "In this method, the service provider should offer a detailed schedule and the resource allocation for the project. Apart from that, all the costs should be properly listed and should be reported to the contractor periodically."
},
{
"code": null,
"e": 244091,
"s": 243967,
"text": "The payments may be paid by the contractor at a certain frequency (such as monthly, quarterly) or by the end of milestones."
},
{
"code": null,
"e": 244325,
"s": 244091,
"text": "Incentive contracts are usually used when there is some level of uncertainty in the project cost. Although there are nearly-accurate estimations, the technological challenges may impact on the overall resources as well as the effort."
},
{
"code": null,
"e": 244445,
"s": 244325,
"text": "This type of contract is common for the projects involving pilot programs or the project that harness new technologies."
},
{
"code": null,
"e": 244550,
"s": 244445,
"text": "There are three cost factors in an Incentive contract; target price, target profit and the maximum cost."
},
{
"code": null,
"e": 244731,
"s": 244550,
"text": "The main mechanism of Incentive contract is to divide any target price overrun between the client and the service provider in order to minimize the business risks for both parties."
},
{
"code": null,
"e": 244928,
"s": 244731,
"text": "This is one of the most beautiful engagements that can get into by two or more parties. This engagement type is the most risk-free type where the time and material used for the project are priced."
},
{
"code": null,
"e": 245150,
"s": 244928,
"text": "The contractor only requires knowing the time and material for the project in order to make the payments. This type of contract has short delivery cycles, and for each cycle, separate estimates are sent of the contractor."
},
{
"code": null,
"e": 245259,
"s": 245150,
"text": "Once the contractor signs off the estimate and Statement of Work (SOW), the service provider can start work."
},
{
"code": null,
"e": 245371,
"s": 245259,
"text": "Unlike most of the other contract types, retainer contracts are mostly used for long-term business engagements."
},
{
"code": null,
"e": 245518,
"s": 245371,
"text": "This type of contracts is used for engineering projects. Based on the resources and material required, the cost for the construction is estimated."
},
{
"code": null,
"e": 245650,
"s": 245518,
"text": "Then, the client contracts a service provider and pays a percentage of the cost of the project as the fee for the service provider."
},
{
"code": null,
"e": 245755,
"s": 245650,
"text": "As an example, take the scenario of constructing a house. Assume that the estimate comes up to $230,000."
},
{
"code": null,
"e": 245911,
"s": 245755,
"text": "When this project is contracted to a service provider, the client may agree to pay 30% of the total cost as the construction fee which comes up to $69,000."
},
{
"code": null,
"e": 246073,
"s": 245911,
"text": "Selecting the contract type is the most crucial step of establishing a business agreement with another party. This step determines the possible engagement risks."
},
{
"code": null,
"e": 246288,
"s": 246073,
"text": "Therefore, companies should get into contracts where there is a minimum risk for their business. It is always a good idea to engage in fixed bids (fixed priced) whenever the project is short-termed and predictable."
},
{
"code": null,
"e": 246391,
"s": 246288,
"text": "If the project nature is exploratory, it is always best to adopt retainer or cost plus contract types."
},
{
"code": null,
"e": 246767,
"s": 246391,
"text": "Almost all the projects need to be guided right throughout in order to receive the required and expected output at the end of the project. It is the team that is responsible for the project and most importantly the project manager that needs to be able to carry out effective controlling of the costs. There are, however, several techniques that can be used for this purpose."
},
{
"code": null,
"e": 247106,
"s": 246767,
"text": "In addition to the project goals that the project manager has to oversee, the control of various costs is also a very important task for any project. Project management would not be effective at all if a project manager fails in this respect, as it would essentially determine whether or not your organization would make a profit or loss."
},
{
"code": null,
"e": 247207,
"s": 247106,
"text": "Following are some of the valuable and essential techniques used for efficient project cost control:"
},
{
"code": null,
"e": 247558,
"s": 247207,
"text": "You would need to ideally make a budget at the beginning of the planning session with regard to the project at hand. It is this budget that you would have to help you for all payments that need to be made and costs that you will incur during the project life cycle. The making of this budget therefore entails a lot of research and critical thinking."
},
{
"code": null,
"e": 247790,
"s": 247558,
"text": "Like any other budget, you would always have to leave room for adjustments as the costs may not remain the same right through the period of the project. Adhering to the project budget at all times is key to the profit from project."
},
{
"code": null,
"e": 248222,
"s": 247790,
"text": "Keeping track of all actual costs is also equally important as any other technique. Here, it is best to prepare a budget that is time-based. This will help you keep track of the budget of a project in each of its phases. The actual costs will have to be tracked against the periodic targets that have been set out in the budget. These targets could be on a monthly or weekly basis or even yearly if the project will go on for long."
},
{
"code": null,
"e": 248631,
"s": 248222,
"text": "This is much easier to work with rather than having one complete budget for the entire period of the project. If any new work is required to be carried out, you would need to make estimations for this and see if it can be accommodated with the final amount in the budget. If not, you may have to work on necessary arrangements for 'Change Requests', where the client will pay for the new work or the changes."
},
{
"code": null,
"e": 248817,
"s": 248631,
"text": "Another effective technique would be effective time management. Although this technique does apply to various management areas, it is very important with regard to project cost control."
},
{
"code": null,
"e": 249067,
"s": 248817,
"text": "The reason for this is that the cost of your project could keep rising if you are unable to meet the project deadlines; the longer the project is dragged on for, the higher the costs incurred which effectively means that the budget will be exceeded."
},
{
"code": null,
"e": 249225,
"s": 249067,
"text": "The project manager would need to constantly remind his/her team of the important deadlines of the project in order to ensure that work is completed on time."
},
{
"code": null,
"e": 249411,
"s": 249225,
"text": "Project change control is yet another vital technique. Change control systems are essential to take into account any potential changes that could occur during the course of the project."
},
{
"code": null,
"e": 249628,
"s": 249411,
"text": "This is due to the fact that each change to the scope of the project will have an impact on the deadlines of the deliverables, so the changes may increase project cost by increasing the effort needed for the project."
},
{
"code": null,
"e": 249803,
"s": 249628,
"text": "Similarly, in order to identify the value of the work that has been carried out thus far, it is very helpful to use the accounting technique commonly known as 'Earned Value'."
},
{
"code": null,
"e": 249955,
"s": 249803,
"text": "This is particularly helpful for large projects and will help you make any quick changes that are absolutely essential for the success of the project. "
},
{
"code": null,
"e": 250177,
"s": 249955,
"text": "It is advisable to constantly review the budget as well as the trends and other financial information. Providing reports on project financials at regular intervals will also help keep track of the progress of the project."
},
{
"code": null,
"e": 250372,
"s": 250177,
"text": "This will ensure that overspending does not take place, as you would not want to find out when it is too late. The earlier the problem is found, the more easily and quickly it could be remedied."
},
{
"code": null,
"e": 250513,
"s": 250372,
"text": "All documents should also be provided at regular intervals to auditors, who would also be able to point out to you any potential cost risks."
},
{
"code": null,
"e": 250731,
"s": 250513,
"text": "Simply coming up with a project budget is not adequate during your project planning sessions. You and your team would have to keep a watchful eye on whether the costs remain close to the figures in the initial budget."
},
{
"code": null,
"e": 250936,
"s": 250731,
"text": "You need to always keep in mind the risks that come with cost escalation and need to prevent this as best as you can. For this, use the above techniques explained and constantly monitor the project costs."
},
{
"code": null,
"e": 251160,
"s": 250936,
"text": "A project kick-off meeting is the best opportunity for a project manager to energize his or her team. During this meeting, the project management can establish a sense of common goal and start understanding each individual."
},
{
"code": null,
"e": 251333,
"s": 251160,
"text": "Although a project kick-off meeting appears to be a simple meeting with all the stakeholders of the project, a successful project kick-off meeting requires proper planning."
},
{
"code": null,
"e": 251580,
"s": 251333,
"text": "The following steps are some of the important preparation points for a successful project kick-off meeting. These steps help you to stay focused, establish and demonstrate leadership, and help integrating individual members into the project team."
},
{
"code": null,
"e": 251813,
"s": 251580,
"text": "A strong and clear agenda is a must for a project kick-off meeting. If you have no clue of what the agenda should be, ask your experienced subordinates or get hold of some of the agendas used for earlier kick-off meetings by others."
},
{
"code": null,
"e": 251967,
"s": 251813,
"text": "The agenda usually includes purpose of the project, deliverables and goals, key success factors of the project, communication plan, and the project plan."
},
{
"code": null,
"e": 252084,
"s": 251967,
"text": "In advance to the project kick-off meeting, make sure that you circulate the meeting agenda to all the participants."
},
{
"code": null,
"e": 252189,
"s": 252084,
"text": "This way, all the participants are aware of the structure and what to achieve at the end of the meeting."
},
{
"code": null,
"e": 252367,
"s": 252189,
"text": "When the meeting starts, the project manager should take charge of the meeting. Next, all the participants should be welcomed and a round of self-introduction should take place."
},
{
"code": null,
"e": 252541,
"s": 252367,
"text": "Although you have already shared the meeting agenda with the participants, briefly take them through the agenda while giving a brief introduction to each item in the agenda."
},
{
"code": null,
"e": 252680,
"s": 252541,
"text": "Pay more attention towards introducing the project roles and emphasize the reasons why the term members were assigned to respective roles."
},
{
"code": null,
"e": 252873,
"s": 252680,
"text": "If there are people playing stretched roles, acknowledge about it. When you do all these things, do not go into detail. The purpose of this meeting is to take everyone on to the same platform."
},
{
"code": null,
"e": 253027,
"s": 252873,
"text": "Once the tone is set, present the agenda in a structured manner. First of all, talk about the project assumptions and how you developed the project plan."
},
{
"code": null,
"e": 253220,
"s": 253027,
"text": "Present your reasoning behind the plan and convey the message that you are open to suggestions when the project progresses. Go through each task in the project plan and elaborate sufficiently."
},
{
"code": null,
"e": 253382,
"s": 253220,
"text": "Emphasize the fact that the project plan and the schedule are still at the initial stage and that you are expecting everyone's assistance for making it complete."
},
{
"code": null,
"e": 253479,
"s": 253382,
"text": "Identify and acknowledge the potential bottlenecks or challenging tasks in the project schedule."
},
{
"code": null,
"e": 253637,
"s": 253479,
"text": "Decide on a convenient time to hold regular meetings to talk about project progress. Emphasize the need of everyone's participation for the regular meetings."
},
{
"code": null,
"e": 253805,
"s": 253637,
"text": "Teamwork is one of the most important expectations to be set. You need to elaborate more on teamwork and plan some teamwork activities just after the project kick-off."
},
{
"code": null,
"e": 253915,
"s": 253805,
"text": "Talk about the time sensitive nature of the project and how the leaves are granted during the project period."
},
{
"code": null,
"e": 254081,
"s": 253915,
"text": "If the project requires working long hours, letting them know in advance and showing them how you can help them to maintain the work-life balance is a good strategy."
},
{
"code": null,
"e": 254181,
"s": 254081,
"text": "During the meeting, empower the team members to carry out certain tasks and make them responsible. "
},
{
"code": null,
"e": 254341,
"s": 254181,
"text": "Communication is one of the main aspects of a project. Therefore, the project kick-off meeting should emphasize more on the communication plan for the project."
},
{
"code": null,
"e": 254480,
"s": 254341,
"text": "This usually includes the meetings and escalation paths. Following are some of the meetings that take place during the project life cycle:"
},
{
"code": null,
"e": 254502,
"s": 254480,
"text": "Weekly status meeting"
},
{
"code": null,
"e": 254524,
"s": 254502,
"text": "Weekly status meeting"
},
{
"code": null,
"e": 254545,
"s": 254524,
"text": "Project plan updates"
},
{
"code": null,
"e": 254566,
"s": 254545,
"text": "Project plan updates"
},
{
"code": null,
"e": 254602,
"s": 254566,
"text": "Task and activity planning sessions"
},
{
"code": null,
"e": 254638,
"s": 254602,
"text": "Task and activity planning sessions"
},
{
"code": null,
"e": 254657,
"s": 254638,
"text": "Management updates"
},
{
"code": null,
"e": 254676,
"s": 254657,
"text": "Management updates"
},
{
"code": null,
"e": 254788,
"s": 254676,
"text": "In addition, you can emphasize on the other communications channels such as e-mail communications, forums, etc."
},
{
"code": null,
"e": 254905,
"s": 254788,
"text": "At the end of the kick-off meeting, open up a Q&A session that allows the team members to freely express themselves."
},
{
"code": null,
"e": 255114,
"s": 254905,
"text": "If the time is not enough to facilitate all the team members, ask them to send their queries and feedback via e-mail. Once you have a look at those e-mails, you can set up another discussion to address those."
},
{
"code": null,
"e": 255278,
"s": 255114,
"text": "Never drag a planned meeting too much, since it could be a bad example. Before everyone leaves, summarize the meeting and call out the action items and next steps."
},
{
"code": null,
"e": 255384,
"s": 255278,
"text": "To conclude, there are four main areas that should be emphasized about holding project kick-off meetings."
},
{
"code": null,
"e": 255469,
"s": 255384,
"text": "Be prepared for the kick-off meeting. Demonstrate your ability to organize and lead."
},
{
"code": null,
"e": 255554,
"s": 255469,
"text": "Be prepared for the kick-off meeting. Demonstrate your ability to organize and lead."
},
{
"code": null,
"e": 255611,
"s": 255554,
"text": "Empower your team members. Assign them responsibilities."
},
{
"code": null,
"e": 255668,
"s": 255611,
"text": "Empower your team members. Assign them responsibilities."
},
{
"code": null,
"e": 255698,
"s": 255668,
"text": "Develop and nurture teamwork."
},
{
"code": null,
"e": 255728,
"s": 255698,
"text": "Develop and nurture teamwork."
},
{
"code": null,
"e": 255767,
"s": 255728,
"text": "Demonstrate your leadership qualities."
},
{
"code": null,
"e": 255806,
"s": 255767,
"text": "Demonstrate your leadership qualities."
},
{
"code": null,
"e": 255885,
"s": 255806,
"text": "Projects vary in terms of purpose, cost, magnitude and the timelines involved."
},
{
"code": null,
"e": 256026,
"s": 255885,
"text": "Yet, they all have common features and the lessons learned from one project can easily be incorporated in another, circumstances permitting."
},
{
"code": null,
"e": 256208,
"s": 256026,
"text": "Some of the experience thus gleaned is revealed below. This is by no means an extensive list of all the project lessons learned, but a few of the most relevant, are stated herewith:"
},
{
"code": null,
"e": 256413,
"s": 256208,
"text": "The success of a project is largely dependent on the skills and strengths of the people involved. Therefore, a project needs to have a dedicated, talented set of individuals working towards a common goal."
},
{
"code": null,
"e": 256618,
"s": 256413,
"text": "The success of a project is largely dependent on the skills and strengths of the people involved. Therefore, a project needs to have a dedicated, talented set of individuals working towards a common goal."
},
{
"code": null,
"e": 256835,
"s": 256618,
"text": "Together with leadership skills, the project manager needs to be aware of the strengths and weaknesses of his/her staff, so that the talents are harnessed and the shortfalls downplayed for the benefit of the project."
},
{
"code": null,
"e": 257052,
"s": 256835,
"text": "Together with leadership skills, the project manager needs to be aware of the strengths and weaknesses of his/her staff, so that the talents are harnessed and the shortfalls downplayed for the benefit of the project."
},
{
"code": null,
"e": 257246,
"s": 257052,
"text": "A champion team and a team of champions are indeed different. The former would lead to a successful project whilst the latter would yield to a conflict of egos, each chasing an individual goal."
},
{
"code": null,
"e": 257440,
"s": 257246,
"text": "A champion team and a team of champions are indeed different. The former would lead to a successful project whilst the latter would yield to a conflict of egos, each chasing an individual goal."
},
{
"code": null,
"e": 257676,
"s": 257440,
"text": "It pays to know who the decision makers are. Such individuals may not always be readily visible, but they will be calling the shots, so developing a strong line of communication with such individuals will reap benefits in the long run."
},
{
"code": null,
"e": 257912,
"s": 257676,
"text": "It pays to know who the decision makers are. Such individuals may not always be readily visible, but they will be calling the shots, so developing a strong line of communication with such individuals will reap benefits in the long run."
},
{
"code": null,
"e": 258070,
"s": 257912,
"text": "If you have the knowledge and experience to make a decision, then you should go ahead and so, without expecting top managers to spoon feed you at every turn."
},
{
"code": null,
"e": 258228,
"s": 258070,
"text": "If you have the knowledge and experience to make a decision, then you should go ahead and so, without expecting top managers to spoon feed you at every turn."
},
{
"code": null,
"e": 258494,
"s": 258228,
"text": "Procrastination does not work. After assimilating the relevant information, decisions need to be made. Wrong decisions can be salvaged, if discovered early; but right decisions cannot be postponed. So, Carpe Diem, (seize the day), as advocated by the popular maxim."
},
{
"code": null,
"e": 258760,
"s": 258494,
"text": "Procrastination does not work. After assimilating the relevant information, decisions need to be made. Wrong decisions can be salvaged, if discovered early; but right decisions cannot be postponed. So, Carpe Diem, (seize the day), as advocated by the popular maxim."
},
{
"code": null,
"e": 259010,
"s": 258760,
"text": "When things go wrong, as they invariably will; excuses will not work. Find an alternative course of action or remedial propositions instead. Allocating blame only causes dissention and hostility, searching for solutions will bring the team together."
},
{
"code": null,
"e": 259260,
"s": 259010,
"text": "When things go wrong, as they invariably will; excuses will not work. Find an alternative course of action or remedial propositions instead. Allocating blame only causes dissention and hostility, searching for solutions will bring the team together."
},
{
"code": null,
"e": 259328,
"s": 259260,
"text": "Be pro-active in your approach. Reactivity is just not good enough."
},
{
"code": null,
"e": 259396,
"s": 259328,
"text": "Be pro-active in your approach. Reactivity is just not good enough."
},
{
"code": null,
"e": 259542,
"s": 259396,
"text": "Be open to change. Sometimes, you may find that the things you knew along may not be correct at this given time, under these specific conditions."
},
{
"code": null,
"e": 259688,
"s": 259542,
"text": "Be open to change. Sometimes, you may find that the things you knew along may not be correct at this given time, under these specific conditions."
},
{
"code": null,
"e": 260024,
"s": 259688,
"text": "Know what resources are available. Not just those under your purview but those which are at the discretion of other teams. Sometimes, others may be happy to help. After all, the favor bank concept which is colloquially referred to as the 'you scratch my back and I will scratch yours' philosophy, is apparent in the business world too."
},
{
"code": null,
"e": 260360,
"s": 260024,
"text": "Know what resources are available. Not just those under your purview but those which are at the discretion of other teams. Sometimes, others may be happy to help. After all, the favor bank concept which is colloquially referred to as the 'you scratch my back and I will scratch yours' philosophy, is apparent in the business world too."
},
{
"code": null,
"e": 260612,
"s": 260360,
"text": "Paperwork and documentation are necessary for reporting purposes. But when making decisions, placing too much reliance on data which may have changed within a surprisingly short timeframe pays few dividends, especially in an unpredictable environment."
},
{
"code": null,
"e": 260864,
"s": 260612,
"text": "Paperwork and documentation are necessary for reporting purposes. But when making decisions, placing too much reliance on data which may have changed within a surprisingly short timeframe pays few dividends, especially in an unpredictable environment."
},
{
"code": null,
"e": 261035,
"s": 260864,
"text": "Know your customer and know the objectives of the project at hand. If any significant changes need to be made, do so, but remember you need to consult the customer first."
},
{
"code": null,
"e": 261206,
"s": 261035,
"text": "Know your customer and know the objectives of the project at hand. If any significant changes need to be made, do so, but remember you need to consult the customer first."
},
{
"code": null,
"e": 261513,
"s": 261206,
"text": "Respect your leader and his/her decisions. Sometimes, you may not agree with these. That is fine. Voice your objections, especially if they are reasonable. But once an action has been decided upon, even if it is contrary to your idea of what should have been done, support it, and try to make it a success."
},
{
"code": null,
"e": 261820,
"s": 261513,
"text": "Respect your leader and his/her decisions. Sometimes, you may not agree with these. That is fine. Voice your objections, especially if they are reasonable. But once an action has been decided upon, even if it is contrary to your idea of what should have been done, support it, and try to make it a success."
},
{
"code": null,
"e": 262076,
"s": 261820,
"text": "Take account of all the known facts. Try to make sense of it, but don't blindly force-fit scenarios into a pre-established mould. Such scenarios may have been right before, and will, in all likelihood, be right once again, but maybe just not in this case."
},
{
"code": null,
"e": 262332,
"s": 262076,
"text": "Take account of all the known facts. Try to make sense of it, but don't blindly force-fit scenarios into a pre-established mould. Such scenarios may have been right before, and will, in all likelihood, be right once again, but maybe just not in this case."
},
{
"code": null,
"e": 262480,
"s": 262332,
"text": "Do not be afraid of taking calculated risks. After all, as the adage goes, a ship is safe in the harbor, but that is not what ships were built for."
},
{
"code": null,
"e": 262628,
"s": 262480,
"text": "Do not be afraid of taking calculated risks. After all, as the adage goes, a ship is safe in the harbor, but that is not what ships were built for."
},
{
"code": null,
"e": 262685,
"s": 262628,
"text": "When things go wrong, know who you can turn to for help."
},
{
"code": null,
"e": 262742,
"s": 262685,
"text": "When things go wrong, know who you can turn to for help."
},
{
"code": null,
"e": 263040,
"s": 262742,
"text": "Always disclose information to those, who will need it. This is not the time or place for obtaining an edge over another by keeping crucial data close to your chest. People, who know what is expected of them and have the means of doing so, will play a pivotal role in making the project a success."
},
{
"code": null,
"e": 263338,
"s": 263040,
"text": "Always disclose information to those, who will need it. This is not the time or place for obtaining an edge over another by keeping crucial data close to your chest. People, who know what is expected of them and have the means of doing so, will play a pivotal role in making the project a success."
},
{
"code": null,
"e": 263413,
"s": 263338,
"text": "Use modern technology and time tested management skills to your advantage."
},
{
"code": null,
"e": 263488,
"s": 263413,
"text": "Use modern technology and time tested management skills to your advantage."
},
{
"code": null,
"e": 263647,
"s": 263488,
"text": "Good communication is that which will stop mistakes from becoming failures. Mistakes happen and recovery is always possible. But failure is a dead-end street."
},
{
"code": null,
"e": 263806,
"s": 263647,
"text": "Good communication is that which will stop mistakes from becoming failures. Mistakes happen and recovery is always possible. But failure is a dead-end street."
},
{
"code": null,
"e": 264016,
"s": 263806,
"text": "Do not blindly rush into decisions. Careful thought needs to be given to the circumstances at hand prior to engaging in decision making. This will save time in the long run by minimizing the need to redo work."
},
{
"code": null,
"e": 264226,
"s": 264016,
"text": "Do not blindly rush into decisions. Careful thought needs to be given to the circumstances at hand prior to engaging in decision making. This will save time in the long run by minimizing the need to redo work."
},
{
"code": null,
"e": 264439,
"s": 264226,
"text": "Repetitive mistakes are the best avoided. Project lessons learned should be documented so that future team leaders can make use of the learning experience of others in order to avoid the same pitfalls themselves."
},
{
"code": null,
"e": 264829,
"s": 264439,
"text": "In order to achieve goals and planned results within a defined schedule and a budget, a manager uses a project. Regardless of which field or which trade, there are assortments of methodologies to help managers at every stage of a project from the initiation to implementation to the closure. In this tutorial, we will try to discuss the most commonly used project management methodologies."
},
{
"code": null,
"e": 265055,
"s": 264829,
"text": "A methodology is a model, which project managers employ for the design, planning, implementation and achievement of their project objectives. There are different project management methodologies to benefit different projects."
},
{
"code": null,
"e": 265359,
"s": 265055,
"text": "For example, there is a specific methodology, which NASA uses to build a space station while the Navy employs a different methodology to build submarines. Hence, there are different project management methodologies that cater to the needs of different projects spanned across different business domains."
},
{
"code": null,
"e": 265467,
"s": 265359,
"text": "Following are the most frequently used project management methodologies in the project management practice:"
},
{
"code": null,
"e": 265720,
"s": 265467,
"text": "In this methodology, the project scope is a variable. Additionally, the time and the cost are constants for the project. Therefore, during the project execution, the project scope is adjusted in order to get the maximum business value from the project."
},
{
"code": null,
"e": 266010,
"s": 265720,
"text": "Agile software development methodology is for a project that needs extreme agility in requirements. The key features of agile are its short-termed delivery cycles (sprints), agile requirements, dynamic team culture, less restrictive project control and emphasis on real-time communication."
},
{
"code": null,
"e": 266238,
"s": 266010,
"text": "In crystal method, the project processes are given a low priority. Instead of the processes, this method focuses more on team communication, team member skills, people and interaction. Crystal methods come under agile category."
},
{
"code": null,
"e": 266540,
"s": 266238,
"text": "This is the successor of Rapid Application Development (RAD) methodology. This is also a subset of agile software development methodology and boasts about the training and documents support this methodology has. This method emphasizes more on the active user involvement during the project life cycle."
},
{
"code": null,
"e": 266817,
"s": 266540,
"text": "Lowering the cost of requirement changes is the main objective of extreme programming. XP emphasizes on fine scale feedback, continuous process, shared understanding and programmer welfare. In XP, there is no detailed requirements specification or software architecture built."
},
{
"code": null,
"e": 267026,
"s": 266817,
"text": "This methodology is more focused on simple and well-defined processes, short iterative and feature driven delivery cycles. All the planning and execution in this project type take place based on the features."
},
{
"code": null,
"e": 267204,
"s": 267026,
"text": "This methodology is a collection of best practices in project management. ITIL covers a broad aspect of project management which starts from the organizational management level."
},
{
"code": null,
"e": 267489,
"s": 267204,
"text": "Involving the client from the early stages with the project tasks is emphasized by this methodology. The project team and the client hold JAD sessions collaboratively in order to get the contribution from the client. These JAD sessions take place during the entire project life cycle."
},
{
"code": null,
"e": 267713,
"s": 267489,
"text": "Lean development focuses on developing change-tolerance software. In this method, satisfying the customer comes as the highest priority. The team is motivated to provide the highest value for the money paid by the customer."
},
{
"code": null,
"e": 267832,
"s": 267713,
"text": "PRINCE2 takes a process-based approach to project management. This methodology is based on eight high-level processes."
},
{
"code": null,
"e": 268105,
"s": 267832,
"text": "This methodology focuses on developing products faster with higher quality. When it comes to gathering requirements, it uses the workshop method. Prototyping is used for getting clear requirements and re-use the software components to accelerate the development timelines."
},
{
"code": null,
"e": 268183,
"s": 268105,
"text": "In this method, all types of internal communications are considered informal."
},
{
"code": null,
"e": 268425,
"s": 268183,
"text": "RUP tries to capture all the positive aspects of modern software development methodologies and offer them in one package. This is one of the first project management methodologies that suggested an iterative approach to software development."
},
{
"code": null,
"e": 268615,
"s": 268425,
"text": "This is an agile methodology. The main goal of this methodology is to improve team productivity dramatically by removing every possible burden. Scrum projects are managed by a Scrum master."
},
{
"code": null,
"e": 268761,
"s": 268615,
"text": "Spiral methodology is the extended waterfall model with prototyping. This method is used instead of using the waterfall model for large projects."
},
{
"code": null,
"e": 269036,
"s": 268761,
"text": "This is a conceptual model used in software development projects. In this method, there is a possibility of combining two or more project management methodologies for the best outcome. SDLC also heavily emphasizes on the use of documentation and has strict guidelines on it."
},
{
"code": null,
"e": 269366,
"s": 269036,
"text": "This is the legacy model for software development projects. This methodology has been in practice for decades before the new methodologies were introduced. In this model, development lifecycle has fixed phases and linear timelines. This model is not capable of addressing the challenges in the modern software development domain."
},
{
"code": null,
"e": 269629,
"s": 269366,
"text": "Selecting the most suitable project management methodology could be a tricky task. When it comes to selecting an appropriate one, there are a few dozens of factors you should consider. Each project management methodology carries its own strengths and weaknesses."
},
{
"code": null,
"e": 269770,
"s": 269629,
"text": "Therefore, there is no good or bad methodology and what you should follow is the most suitable one for your project management requirements."
},
{
"code": null,
"e": 269865,
"s": 269770,
"text": "When organizations grow, they establish different entities for governing respective practices."
},
{
"code": null,
"e": 270040,
"s": 269865,
"text": "The Project Management Office (PMO) is the entity created for governing the processes, practices, tools and other activities related to project management in an organization."
},
{
"code": null,
"e": 270139,
"s": 270040,
"text": "This office (team) defines and maintains the standards for project management in the organization."
},
{
"code": null,
"e": 270291,
"s": 270139,
"text": "Usually, the management of the organization assigns a team of experts in the field of project management in order to run the project management office."
},
{
"code": null,
"e": 270469,
"s": 270291,
"text": "The organization looks for qualifications such as PMI certifications and extensive experience is managing large projects when selecting people for the project management office."
},
{
"code": null,
"e": 270590,
"s": 270469,
"text": "Due to the complexity of present projects, the project management function should be a matured and streamlined practice."
},
{
"code": null,
"e": 270815,
"s": 270590,
"text": "Therefore, organizations look for better ways of managing the projects in order to maximize the profit margins. For this, organizations look into process optimization, productivity enhancement and building their bottom-line."
},
{
"code": null,
"e": 271031,
"s": 270815,
"text": "Since there are many parameters involved in the project management function (such as people, technology, communication and resources), governing the project management function by the senior management can be risky."
},
{
"code": null,
"e": 271196,
"s": 271031,
"text": "Therefore, a project management office is the ideal solution for building and maintaining the project management practice as a capable function of the organization."
},
{
"code": null,
"e": 271382,
"s": 271196,
"text": "Implementing a project management office is as same as any other organizational change project. Therefore, it is approached with a strong and rigid methodology with a lot of experience."
},
{
"code": null,
"e": 271556,
"s": 271382,
"text": "There are a number of key steps involved in building a project management office and PMBOK (Project Management Body of Knowledge) can be a great reference for this purpose. "
},
{
"code": null,
"e": 271772,
"s": 271556,
"text": "Some traditional organizations view the project management office as an overhead. This is mainly due to the fact that the organization is small enough where there is no explicit need for a project management office."
},
{
"code": null,
"e": 271984,
"s": 271772,
"text": "In such organizations, the general management can govern project management practice. For the rest of the organizations where there are large projects, a project management office is a lot more than an overhead."
},
{
"code": null,
"e": 272134,
"s": 271984,
"text": "At present, the world economy is at a recession. Therefore, a lot of companies look at cutting costs in order to retain in the corporate environment."
},
{
"code": null,
"e": 272378,
"s": 272134,
"text": "Among the ways of doing this, cutting down staff and closing down departments have become two popular options. In such cases, project management office has become an easy victim, as it does not add any figure to the bottom-line of the company."
},
{
"code": null,
"e": 272497,
"s": 272378,
"text": "Therefore, it has become a challenge for the project management offices to justify their work to the upper management."
},
{
"code": null,
"e": 272688,
"s": 272497,
"text": "Project management is one of the key functions of an organization. Therefore, refining the processes related to project management could add a lot of value to the organization's bottom-line."
},
{
"code": null,
"e": 272754,
"s": 272688,
"text": "This is what exactly a successful project management office does."
},
{
"code": null,
"e": 272878,
"s": 272754,
"text": "Based on the historical statistics, only one-third of project management offices work and the rest do not work as expected."
},
{
"code": null,
"e": 273110,
"s": 272878,
"text": "This is one of the main concerns that senior management faces when deciding to build a project management office for an organization. The management is doubtful about the success of the project management office from the beginning."
},
{
"code": null,
"e": 273345,
"s": 273110,
"text": "One of the main reasons for project management office to fail is the lack of executive management support. In most cases, the executive management does not have enough knowledge on how to support and guide a project management office."
},
{
"code": null,
"e": 273508,
"s": 273345,
"text": "Secondly, incapability of the project management office causes failures. This is mainly due to the people and resources assigned to the project management office."
},
{
"code": null,
"e": 273746,
"s": 273508,
"text": "Project management office is one of the entities that will add value to large organizations in the long run. A project management office could be an overhead for smaller scale organizations and such establishment may end up as a failure."
},
{
"code": null,
"e": 273953,
"s": 273746,
"text": "A successful project management office can enhance the productivity of the project teams and cause a lot of cost savings. In addition to that, it can make the organization a more matured and capable entity."
},
{
"code": null,
"e": 274156,
"s": 273953,
"text": "Project management is one of the critical processes of any project. This is due to the fact that project management is the core process that connects all other project activities and processes together."
},
{
"code": null,
"e": 274329,
"s": 274156,
"text": "When it comes to the activities of project management, there are plenty. However, these plenty of project management activities can be categorized into five main processes."
},
{
"code": null,
"e": 274404,
"s": 274329,
"text": "Let's have a look at the five main project management processes in detail."
},
{
"code": null,
"e": 274597,
"s": 274404,
"text": "Project initiation is the starting point of any project. In this process, all the activities related to winning a project takes place. Usually, the main activity of this phase is the pre-sale."
},
{
"code": null,
"e": 274821,
"s": 274597,
"text": "During the pre-sale period, the service provider proves the eligibility and ability of completing the project to the client and eventually wins the business. Then, it is the detailed requirements gathering which comes next."
},
{
"code": null,
"e": 275059,
"s": 274821,
"text": "During the requirements gathering activity, all the client requirements are gathered and analysed for implementation. In this activity, negotiations may take place to change certain requirements or remove certain requirements altogether."
},
{
"code": null,
"e": 275128,
"s": 275059,
"text": "Usually, project initiation process ends with requirements sign-off."
},
{
"code": null,
"e": 275329,
"s": 275128,
"text": "Project planning is one of the main project management processes. If the project management team gets this step wrong, there could be heavy negative consequences during the next phases of the project."
},
{
"code": null,
"e": 275436,
"s": 275329,
"text": "Therefore, the project management team will have to pay detailed attention to this process of the project."
},
{
"code": null,
"e": 275651,
"s": 275436,
"text": "In this process, the project plan is derived in order to address the project requirements such as, requirements scope, budget and timelines. Once the project plan is derived, then the project schedule is developed."
},
{
"code": null,
"e": 275823,
"s": 275651,
"text": "Depending on the budget and the schedule, the resources are then allocated to the project. This phase is the most important phase when it comes to project cost and effort."
},
{
"code": null,
"e": 275951,
"s": 275823,
"text": "After all paperwork is done, in this phase, the project management executes the project in order to achieve project objectives."
},
{
"code": null,
"e": 276160,
"s": 275951,
"text": "When it comes to execution, each member of the team carries out their own assignments within the given deadline for each activity. The detailed project schedule will be used for tracking the project progress."
},
{
"code": null,
"e": 276344,
"s": 276160,
"text": "During the project execution, there are many reporting activities to be done. The senior management of the company will require daily or weekly status updates on the project progress."
},
{
"code": null,
"e": 276603,
"s": 276344,
"text": "In addition to that, the client may also want to track the progress of the project. During the project execution, it is a must to track the effort and cost of the project in order to determine whether the project is progressing in the right direction or not."
},
{
"code": null,
"e": 276903,
"s": 276603,
"text": "In addition to reporting, there are multiple deliveries to be made during the project execution. Usually, project deliveries are not onetime deliveries made at the end of the project. Instead, the deliveries are scattered through out the project execution period and delivered upon agreed timelines."
},
{
"code": null,
"e": 277166,
"s": 276903,
"text": "During the project life cycle, the project activities should be thoroughly controlled and validated. The controlling can be mainly done by adhering to the initial protocols such as project plan, quality assurance test plan and communication plan for the project."
},
{
"code": null,
"e": 277359,
"s": 277166,
"text": "Sometimes, there can be instances that are not covered by such protocols. In such cases, the project manager should use adequate and necessary measurements in order to control such situations."
},
{
"code": null,
"e": 277599,
"s": 277359,
"text": "Validation is a supporting activity that runs from first day to the last day of a project. Each and every activity and delivery should have its own validation criteria in order to verify the successful outcome or the successful completion."
},
{
"code": null,
"e": 277773,
"s": 277599,
"text": "When it comes to project deliveries and requirements, a separate team called 'quality assurance team' will assist the project team for validation and verification functions."
},
{
"code": null,
"e": 278043,
"s": 277773,
"text": "Once all the project requirements are achieved, it is time to hand over the implemented system and closeout the project. If the project deliveries are in par with the acceptance criteria defined by the client, the project will be duly accepted and paid by the customer."
},
{
"code": null,
"e": 278270,
"s": 278043,
"text": "Once the project closeout takes place, it is time to evaluate the entire project. In this evaluation, the mistakes made by the project team will be identified and will take necessary steps to avoid them in the future projects."
},
{
"code": null,
"e": 278465,
"s": 278270,
"text": "During the project evaluation process, the service provider may notice that they haven't gained the expected margins for the project and may have exceeded the timelines planned at the beginning."
},
{
"code": null,
"e": 278651,
"s": 278465,
"text": "In such cases, the project is not a 100% success to the service provider. Therefore, such instances should be studied carefully and should take necessary actions to avoid in the future."
},
{
"code": null,
"e": 278814,
"s": 278651,
"text": "Project management is a responsible process. The project management process connects all other project activities together and creates the harmony in the project."
},
{
"code": null,
"e": 279004,
"s": 278814,
"text": "Therefore, the project management team should have a detailed understanding on all the project management processes and the tools that they can make use for each project management process."
},
{
"code": null,
"e": 279228,
"s": 279004,
"text": "Project management is one of the high-responsibility tasks in modern organizations. Project management is used in many types of projects ranging from software development to developing the next generation fighter aircrafts."
},
{
"code": null,
"e": 279362,
"s": 279228,
"text": "In order to execute a project successfully, the project manager or the project management team should be supported by a set of tools."
},
{
"code": null,
"e": 279488,
"s": 279362,
"text": "These tools can be specifically designed tools or regular productivity tools that can be adopted for project management work."
},
{
"code": null,
"e": 279629,
"s": 279488,
"text": "The use of such tools usually makes the project managers work easy as well as it standardizes the work and the routine of a project manager."
},
{
"code": null,
"e": 279704,
"s": 279629,
"text": "Following are some of those tools used by project managers in all domains:"
},
{
"code": null,
"e": 279862,
"s": 279704,
"text": "All the projects that should be managed by a project manager should have a project plan. The project plan details many aspects of the project to be executed."
},
{
"code": null,
"e": 280016,
"s": 279862,
"text": "First of all, it details out the project scope. Then, it describes the approach or strategy used for addressing the project scope and project objectives."
},
{
"code": null,
"e": 280154,
"s": 280016,
"text": "The strategy is the core of the project plan. The strategy could vary depending on the project purpose and specific project requirements."
},
{
"code": null,
"e": 280365,
"s": 280154,
"text": "The resource allocation and delivery schedule are other two main components of the project plan. These detail each activity involved in the project as well as the information such as who executes them and when."
},
{
"code": null,
"e": 280473,
"s": 280365,
"text": "This is important information for the project manager as well as all the other stakeholders of the project."
},
{
"code": null,
"e": 280608,
"s": 280473,
"text": "This is one of the best tools the project manager can use to determine whether he or she is on track in terms of the project progress."
},
{
"code": null,
"e": 280751,
"s": 280608,
"text": "The project manager does not have to use expensive software to track this. The project manager can use a simple Excel template to do this job."
},
{
"code": null,
"e": 280846,
"s": 280751,
"text": "The milestone checklist should be a live document that should be updated once or twice a week."
},
{
"code": null,
"e": 281062,
"s": 280846,
"text": "Gantt chart illustrates the project schedule and shows the project manager the interdependencies of each activity. Gantt charts are universally used for any type of project from construction to software development."
},
{
"code": null,
"e": 281204,
"s": 281062,
"text": "Although deriving a Gantt chart looks quite easy, it is one of the most complex tasks when the project is involved in hundreds of activities."
},
{
"code": null,
"e": 281394,
"s": 281204,
"text": "There are many ways you can create a Gantt chart. If the project is small and simple in nature, you can create your own Gantt chart in Excel or download an Excel template from the Internet."
},
{
"code": null,
"e": 281527,
"s": 281394,
"text": "If the project has a high financial value or high-risk exposure, then the project manager can use software tools such as MS Project."
},
{
"code": null,
"e": 281763,
"s": 281527,
"text": "With the introduction of computer technology, there have been a number of software tools specifically developed for project management purpose. MS Project is one such tool that has won the hearts of project managers all over the world."
},
{
"code": null,
"e": 281969,
"s": 281763,
"text": "MS Project can be used as a standalone tool for tracking project progress or it can be used for tracking complex projects distributed in many geographical areas and managed by a number of project managers."
},
{
"code": null,
"e": 282224,
"s": 281969,
"text": "There are many other software packages for project management in addition to MS Project. Most of these new additions are online portals for project management activities where the project members have access to project details and progress from anywhere."
},
{
"code": null,
"e": 282442,
"s": 282224,
"text": "A comprehensive project review mechanism is a great tool for project management. More mature companies tend to have more strict and comprehensive project reviews as opposed to basic ones done by smaller organizations."
},
{
"code": null,
"e": 282647,
"s": 282442,
"text": "In project reviews, the project progress and the adherence to the process standards are mainly considered. Usually, project reviews are accompanied by project audits by a 3rd party (internal or external)."
},
{
"code": null,
"e": 282728,
"s": 282647,
"text": "The non-compliances and action items are then tracked in order to complete them."
},
{
"code": null,
"e": 282880,
"s": 282728,
"text": "Delivery reviews make sure that the deliveries made by the project team meet the customer requirements and adhere to the general guidelines of quality."
},
{
"code": null,
"e": 283041,
"s": 282880,
"text": "Usually, a 3rd party team or supervisors (internal) conduct the delivery review and the main stakeholders of the project delivery do participate for this event."
},
{
"code": null,
"e": 283145,
"s": 283041,
"text": "The delivery review may decide to reject the delivery due to the quality standards and non-compliances."
},
{
"code": null,
"e": 283369,
"s": 283145,
"text": "When it comes to performance of the project team, a scorecard is the way of tracking it. Every project manager is responsible of accessing the performance of the team members and reporting it to the upper management and HR."
},
{
"code": null,
"e": 283566,
"s": 283369,
"text": "This information is then used for promotion purposes as well as human resource development. A comprehensive score card and performance assessment can place the team member in the correct position."
},
{
"code": null,
"e": 283783,
"s": 283566,
"text": "A project manager cannot execute his/her job without a proper set of tools. These tools do not have to be renowned software or something, but it can pretty well be simple and proven techniques to manage project work."
},
{
"code": null,
"e": 283894,
"s": 283783,
"text": "Having a solid set of project management tools always makes project managers' work pleasurable and productive."
},
{
"code": null,
"e": 284116,
"s": 283894,
"text": "The project management triangle is used by managers to analyze or understand the difficulties that may arise due to implementing and executing a project. All projects irrespective of their size will have many constraints."
},
{
"code": null,
"e": 284267,
"s": 284116,
"text": "Although there are many such project constraints, these should not be barriers for successful project execution and for the effective decision making."
},
{
"code": null,
"e": 284407,
"s": 284267,
"text": "There are three main interdependent constraints for every project; time, cost and scope. This is also known as Project Management Triangle."
},
{
"code": null,
"e": 284520,
"s": 284407,
"text": "Let's try to understand each of the element of project triangle and then how to face challenges related to each."
},
{
"code": null,
"e": 284601,
"s": 284520,
"text": "The three constraints in a project management triangle are time, cost and scope."
},
{
"code": null,
"e": 284815,
"s": 284601,
"text": "A project's activities can either take shorter or longer amount of time to complete. Completion of tasks depends on a number of factors such as the number of people working on the project, experience, skills, etc."
},
{
"code": null,
"e": 285055,
"s": 284815,
"text": "Time is a crucial factor which is uncontrollable. On the other hand, failure to meet the deadlines in a project can create adverse effects. Most often, the main reason for organizations to fail in terms of time is due to lack of resources."
},
{
"code": null,
"e": 285258,
"s": 285055,
"text": "It's imperative for both the project manager and the organization to have an estimated cost when undertaking a project. Budgets will ensure that project is developed or implemented below a certain cost."
},
{
"code": null,
"e": 285399,
"s": 285258,
"text": "Sometimes, project managers have to allocate additional resources in order to meet the deadlines with a penalty of additional project costs."
},
{
"code": null,
"e": 285542,
"s": 285399,
"text": "Scope looks at the outcome of the project undertaken. This consists of a list of deliverables, which need to be addressed by the project team."
},
{
"code": null,
"e": 285674,
"s": 285542,
"text": "A successful project manager will know to manage both the scope of the project and any change in scope which impacts time and cost."
},
{
"code": null,
"e": 285851,
"s": 285674,
"text": "Quality is not a part of the project management triangle, but it is the ultimate objective of every delivery. Hence, the project management triangle represents implies quality."
},
{
"code": null,
"e": 286077,
"s": 285851,
"text": "Many project managers are under the notion that 'high quality comes with high cost', which to some extent is true. By using low quality resources to accomplish project deadlines does not ensure success of the overall project."
},
{
"code": null,
"e": 286161,
"s": 286077,
"text": "Like with the scope, quality will also be an important deliverable for the project."
},
{
"code": null,
"e": 286241,
"s": 286161,
"text": "A project undergoes six stages during its life cycles and they are noted below:"
},
{
"code": null,
"e": 286366,
"s": 286241,
"text": "Project Definition - This refers to defining the objectives and the factors to be considered to make the project successful."
},
{
"code": null,
"e": 286491,
"s": 286366,
"text": "Project Definition - This refers to defining the objectives and the factors to be considered to make the project successful."
},
{
"code": null,
"e": 286592,
"s": 286491,
"text": "Project Initiation - This refers to the resources as well as the planning before the project starts."
},
{
"code": null,
"e": 286693,
"s": 286592,
"text": "Project Initiation - This refers to the resources as well as the planning before the project starts."
},
{
"code": null,
"e": 286881,
"s": 286693,
"text": "Project Planning - Outlines the plan as to how the project should be executed. This is where project management triangle is essential. It looks at the time, cost and scope of the project."
},
{
"code": null,
"e": 287069,
"s": 286881,
"text": "Project Planning - Outlines the plan as to how the project should be executed. This is where project management triangle is essential. It looks at the time, cost and scope of the project."
},
{
"code": null,
"e": 287145,
"s": 287069,
"text": "Project Execution - Undertaking work to deliver the outcome of the project."
},
{
"code": null,
"e": 287221,
"s": 287145,
"text": "Project Execution - Undertaking work to deliver the outcome of the project."
},
{
"code": null,
"e": 287331,
"s": 287221,
"text": "Project Monitoring & Control - Taking necessary measures, so that the operation of the project runs smoothly."
},
{
"code": null,
"e": 287441,
"s": 287331,
"text": "Project Monitoring & Control - Taking necessary measures, so that the operation of the project runs smoothly."
},
{
"code": null,
"e": 287557,
"s": 287441,
"text": "Project Closure - Acceptance of the deliverables and discontinuing resources that were required to run the project."
},
{
"code": null,
"e": 287673,
"s": 287557,
"text": "Project Closure - Acceptance of the deliverables and discontinuing resources that were required to run the project."
},
{
"code": null,
"e": 287920,
"s": 287673,
"text": "It is always a requirement to overcome the challenges related to the project triangle during the project execution period. Project managers need to understand that the three constraints outlined in the project management triangle can be adjusted."
},
{
"code": null,
"e": 288093,
"s": 287920,
"text": "The important aspect is to deal with it. The project manager needs to strike a balance between the three constraints so that quality of the project will not be compromised."
},
{
"code": null,
"e": 288332,
"s": 288093,
"text": "To overcome the constraints, the project managers have several methods to keep the project going. Some of these will be based on preventing stakeholders from changing the scope and maintaining limits on both financial and human resources."
},
{
"code": null,
"e": 288488,
"s": 288332,
"text": "A project manager's role is evolved around responsibility. A project manager needs to supervise and control the project from the beginning to the closure."
},
{
"code": null,
"e": 288549,
"s": 288488,
"text": "The following factors will outline a project manager's role:"
},
{
"code": null,
"e": 288714,
"s": 288549,
"text": "The project manager needs to define the project and split the tasks amongst team members. The project manager also needs to obtain key resources and build teamwork."
},
{
"code": null,
"e": 288879,
"s": 288714,
"text": "The project manager needs to define the project and split the tasks amongst team members. The project manager also needs to obtain key resources and build teamwork."
},
{
"code": null,
"e": 288995,
"s": 288879,
"text": "The project manager needs to set the objectives required for the project and work towards meeting these objectives."
},
{
"code": null,
"e": 289111,
"s": 288995,
"text": "The project manager needs to set the objectives required for the project and work towards meeting these objectives."
},
{
"code": null,
"e": 289225,
"s": 289111,
"text": "The most important activity of a project manager is to keep stakeholders informed on the progress of the project."
},
{
"code": null,
"e": 289339,
"s": 289225,
"text": "The most important activity of a project manager is to keep stakeholders informed on the progress of the project."
},
{
"code": null,
"e": 289418,
"s": 289339,
"text": "The project manager needs to asses and carefully monitor risks of the project."
},
{
"code": null,
"e": 289497,
"s": 289418,
"text": "The project manager needs to asses and carefully monitor risks of the project."
},
{
"code": null,
"e": 289663,
"s": 289497,
"text": "In order to overcome the challenges related to project triangle and meet the project objectives, the project manager needs to have a range of skills, which includes:"
},
{
"code": null,
"e": 289674,
"s": 289663,
"text": "Leadership"
},
{
"code": null,
"e": 289685,
"s": 289674,
"text": "Leadership"
},
{
"code": null,
"e": 289701,
"s": 289685,
"text": "Managing people"
},
{
"code": null,
"e": 289717,
"s": 289701,
"text": "Managing people"
},
{
"code": null,
"e": 289729,
"s": 289717,
"text": "Negotiation"
},
{
"code": null,
"e": 289741,
"s": 289729,
"text": "Negotiation"
},
{
"code": null,
"e": 289757,
"s": 289741,
"text": "Time management"
},
{
"code": null,
"e": 289773,
"s": 289757,
"text": "Time management"
},
{
"code": null,
"e": 289797,
"s": 289773,
"text": "Effective communication"
},
{
"code": null,
"e": 289821,
"s": 289797,
"text": "Effective communication"
},
{
"code": null,
"e": 289830,
"s": 289821,
"text": "Planning"
},
{
"code": null,
"e": 289839,
"s": 289830,
"text": "Planning"
},
{
"code": null,
"e": 289851,
"s": 289839,
"text": "Controlling"
},
{
"code": null,
"e": 289863,
"s": 289851,
"text": "Controlling"
},
{
"code": null,
"e": 289883,
"s": 289863,
"text": "Conflict resolution"
},
{
"code": null,
"e": 289903,
"s": 289883,
"text": "Conflict resolution"
},
{
"code": null,
"e": 289919,
"s": 289903,
"text": "Problem solving"
},
{
"code": null,
"e": 289935,
"s": 289919,
"text": "Problem solving"
},
{
"code": null,
"e": 290145,
"s": 289935,
"text": "Project management is very often represented on a triangle. A successful project manager needs to keep a balance between the triple constraints so that the quality of the project or outcome is not compromised."
},
{
"code": null,
"e": 290363,
"s": 290145,
"text": "There are many tools and techniques that are available in order to face the challenges related to the three constraints. A good project manager will use appropriate tools in order to execute the project successfully. "
},
{
"code": null,
"e": 290755,
"s": 290363,
"text": "Every organization requires good leadership in order to carry out all their projects successfully. This requires the organization to appoint efficient project managers to carry out various tasks, and of course, to guide and lead the project management team and get them to a point, where they have effectively completed any given project at hand, taking into account a whole load of factors."
},
{
"code": null,
"e": 290972,
"s": 290755,
"text": "In order to understand how project management can run smoothly, it is important to first identify the role and the tasks carried out by the project manager. So who is a project manager and why is he/she so important?"
},
{
"code": null,
"e": 291058,
"s": 290972,
"text": "The role of a project manager basically involves handling all aspects of the project."
},
{
"code": null,
"e": 291282,
"s": 291058,
"text": "This includes not just the logistics but also the planning, brainstorming and seeing to the overall completion of the project while also preventing glitches and ensuring that the project management team works well together."
},
{
"code": null,
"e": 291435,
"s": 291282,
"text": "Following should be the the main goals for a project manager, but they are not limited to the listed ones because it very much depends on the situation:"
},
{
"code": null,
"e": 291523,
"s": 291435,
"text": "A project manager must always be able to carry out his role in a very effective manner."
},
{
"code": null,
"e": 291738,
"s": 291523,
"text": "This means that in most cases he/she would have to run against time with the clock ticking away. All projects would have deadlines, so it is the duty of a project manager to complete the project by this given date."
},
{
"code": null,
"e": 292027,
"s": 291738,
"text": "It should be noted that although the project manager and his team may draw up a schedule at the outset that may seem perfect, as time goes on you will find that the requirements may change, and the projects may require new strategies to be implemented and more planning to be carried out."
},
{
"code": null,
"e": 292265,
"s": 292027,
"text": "Time therefore could be a big obstacle for a project manager achieving his/her goal. As the project manager you should never lose sight of the deadline, your role would be to keep pushing your team to finish the work and deliver on time."
},
{
"code": null,
"e": 292335,
"s": 292265,
"text": "Remember that your clients' satisfaction is your number one priority."
},
{
"code": null,
"e": 292468,
"s": 292335,
"text": "Satisfaction of the client, however, does not mean that you rush to finish the work on time without ensuring that standards are met."
},
{
"code": null,
"e": 292642,
"s": 292468,
"text": "The reputation of your organization would depend on the quality of the delivery of your projects. This is another factor you should not lose sight of throughout the project."
},
{
"code": null,
"e": 292722,
"s": 292642,
"text": "Your role would also be to keep reminding the team members that quality is key."
},
{
"code": null,
"e": 292967,
"s": 292722,
"text": "No project can be started off without the preparation of the budget. Although this is just a forecast of the costs that would be incurred, it is essential that this budget is prepared after careful research and comparing prices to get the best."
},
{
"code": null,
"e": 293138,
"s": 292967,
"text": "You would need to consider ways of cutting costs while also ensuring that you meet the needs of the client as well as meeting the standards expected of your organization."
},
{
"code": null,
"e": 293392,
"s": 293138,
"text": "This budget must include all costs with regard equipment, labor and everything else. You then need to try and always stick to the budget, although it's always best to leave some allowance for a few 100 dollars for any additional expenses that may arise."
},
{
"code": null,
"e": 293610,
"s": 293392,
"text": "Another goal of a project manager involves meeting all requirements of the client. You would need to therefore have all specifications at hand and go through them every once in a while to ensure that you are on track."
},
{
"code": null,
"e": 293724,
"s": 293610,
"text": "If there is confusion as to any requirements, it would be best for you to get them cleared at the very beginning."
},
{
"code": null,
"e": 293879,
"s": 293724,
"text": "While you would have to ensure that all aspects of the project are maintained, you are also responsible as project manager for the happiness of your team."
},
{
"code": null,
"e": 294074,
"s": 293879,
"text": "You need to keep in mind that it is the incentives and encouragement provided to them that will make them work harder and want to complete the work on time, thereby helping you reach your goals."
},
{
"code": null,
"e": 294327,
"s": 294074,
"text": "If the team members are unhappy with the way things are being carried out, productivity will also in turn decrease, pulling you further away from achieving your goals. It is essential therefore to always maintain a warm friendly relationship with them."
},
{
"code": null,
"e": 294520,
"s": 294327,
"text": "The communication within the team should be very effective. They should be willing to voice out their opinions while you listen to their suggestions and consider including them in the project."
},
{
"code": null,
"e": 294613,
"s": 294520,
"text": "This is after all a team effort. Your goals with regard to the project are also their goals."
},
{
"code": null,
"e": 294800,
"s": 294613,
"text": "The role of a project manager is therefore no easy task. It involves taking up a lot of responsibility as each of the goals of the project must be met without making too many sacrifices."
},
{
"code": null,
"e": 295028,
"s": 294800,
"text": "If these goals are outlined to the project management team at the very beginning, there in no way for the delivery of the goals to be delayed in any way as everyone will always be aware of what they need to achieve and by when."
},
{
"code": null,
"e": 295260,
"s": 295028,
"text": "When there are many projects run by an organization, it is vital for the organization to manage their project portfolio. This helps the organization to categorize the projects and align the projects with their organizational goals."
},
{
"code": null,
"e": 295455,
"s": 295260,
"text": "Project Portfolio Management (PPM) is a management process with the help of methods aimed at helping the organization to acquire information and sort out projects according to a set of criteria."
},
{
"code": null,
"e": 295662,
"s": 295455,
"text": "Same as with financial portfolio management, the project portfolio management also has its own set of objectives. These objectives are designed to bring about expected results through coherent team players."
},
{
"code": null,
"e": 295738,
"s": 295662,
"text": "When it comes to the objectives, the following factors need to be outlined."
},
{
"code": null,
"e": 295890,
"s": 295738,
"text": "The need to create a descriptive document, which contains vital information such as name of project, estimated timeframe, cost and business objectives."
},
{
"code": null,
"e": 296042,
"s": 295890,
"text": "The need to create a descriptive document, which contains vital information such as name of project, estimated timeframe, cost and business objectives."
},
{
"code": null,
"e": 296169,
"s": 296042,
"text": "The project needs to be evaluated on a regular basis to ensure that the project is meeting its target and stays in its course."
},
{
"code": null,
"e": 296296,
"s": 296169,
"text": "The project needs to be evaluated on a regular basis to ensure that the project is meeting its target and stays in its course."
},
{
"code": null,
"e": 296385,
"s": 296296,
"text": "Selection of the team players, who will work towards achieving the project's objectives."
},
{
"code": null,
"e": 296474,
"s": 296385,
"text": "Selection of the team players, who will work towards achieving the project's objectives."
},
{
"code": null,
"e": 296840,
"s": 296474,
"text": "Project portfolio management ensures that projects have a set of objectives, which when followed brings about the expected results. Furthermore, PPM can be used to bring out changes to the organization which will create a flexible structure within the organization in terms of project execution. In this manner, the change will not be a threat for the organization."
},
{
"code": null,
"e": 296925,
"s": 296840,
"text": "The following benefits can be gained through efficient project portfolio management:"
},
{
"code": null,
"e": 296962,
"s": 296925,
"text": "Greater adaptability towards change."
},
{
"code": null,
"e": 296999,
"s": 296962,
"text": "Greater adaptability towards change."
},
{
"code": null,
"e": 297066,
"s": 296999,
"text": "Constant review and close monitoring brings about a higher return."
},
{
"code": null,
"e": 297133,
"s": 297066,
"text": "Constant review and close monitoring brings about a higher return."
},
{
"code": null,
"e": 297329,
"s": 297133,
"text": "Management's perspectives with regards to project portfolio management is seen as an 'initiative towards higher return'. Therefore, this will not be considered to be a detrimental factor to work."
},
{
"code": null,
"e": 297525,
"s": 297329,
"text": "Management's perspectives with regards to project portfolio management is seen as an 'initiative towards higher return'. Therefore, this will not be considered to be a detrimental factor to work."
},
{
"code": null,
"e": 297633,
"s": 297525,
"text": "Identification of dependencies is easier to identify. This will eliminate some inefficiency from occurring."
},
{
"code": null,
"e": 297741,
"s": 297633,
"text": "Identification of dependencies is easier to identify. This will eliminate some inefficiency from occurring."
},
{
"code": null,
"e": 297799,
"s": 297741,
"text": "Advantage over other competitors (competitive advantage)."
},
{
"code": null,
"e": 297857,
"s": 297799,
"text": "Advantage over other competitors (competitive advantage)."
},
{
"code": null,
"e": 297980,
"s": 297857,
"text": "Helps to concentrate on the strategies, which will help to achieve the targets rather than focusing on the project itself."
},
{
"code": null,
"e": 298103,
"s": 297980,
"text": "Helps to concentrate on the strategies, which will help to achieve the targets rather than focusing on the project itself."
},
{
"code": null,
"e": 298204,
"s": 298103,
"text": "The responsibilities of IT is focused on part of the business rather than scattering across several."
},
{
"code": null,
"e": 298305,
"s": 298204,
"text": "The responsibilities of IT is focused on part of the business rather than scattering across several."
},
{
"code": null,
"e": 298415,
"s": 298305,
"text": "The mix of both IT and business projects are seen as contributors to achieving the organizational objectives."
},
{
"code": null,
"e": 298525,
"s": 298415,
"text": "The mix of both IT and business projects are seen as contributors to achieving the organizational objectives."
},
{
"code": null,
"e": 298650,
"s": 298525,
"text": "There are many tools that can be used for project portfolio management. Following are the essential features of those tools:"
},
{
"code": null,
"e": 298697,
"s": 298650,
"text": "A systematic method of evaluation of projects."
},
{
"code": null,
"e": 298744,
"s": 298697,
"text": "A systematic method of evaluation of projects."
},
{
"code": null,
"e": 298774,
"s": 298744,
"text": "Resources need to be planned."
},
{
"code": null,
"e": 298804,
"s": 298774,
"text": "Resources need to be planned."
},
{
"code": null,
"e": 298853,
"s": 298804,
"text": "Costs and the benefits need to be kept on track."
},
{
"code": null,
"e": 298902,
"s": 298853,
"text": "Costs and the benefits need to be kept on track."
},
{
"code": null,
"e": 298937,
"s": 298902,
"text": "Undertaking cost benefit analysis."
},
{
"code": null,
"e": 298972,
"s": 298937,
"text": "Undertaking cost benefit analysis."
},
{
"code": null,
"e": 299008,
"s": 298972,
"text": "Progress reports from time to time."
},
{
"code": null,
"e": 299044,
"s": 299008,
"text": "Progress reports from time to time."
},
{
"code": null,
"e": 299092,
"s": 299044,
"text": "Access to information as and when its required."
},
{
"code": null,
"e": 299140,
"s": 299092,
"text": "Access to information as and when its required."
},
{
"code": null,
"e": 299216,
"s": 299140,
"text": "Communication mechanism, which will take through the information necessary."
},
{
"code": null,
"e": 299292,
"s": 299216,
"text": "Communication mechanism, which will take through the information necessary."
},
{
"code": null,
"e": 299459,
"s": 299292,
"text": "There are various techniques, which are used to measure or support PPM process from time to time. However, there are three types of techniques, which are widely used:"
},
{
"code": null,
"e": 299476,
"s": 299459,
"text": "Heuristic model."
},
{
"code": null,
"e": 299493,
"s": 299476,
"text": "Heuristic model."
},
{
"code": null,
"e": 299512,
"s": 299493,
"text": "Scoring technique."
},
{
"code": null,
"e": 299531,
"s": 299512,
"text": "Scoring technique."
},
{
"code": null,
"e": 299561,
"s": 299531,
"text": "Visual or Mapping techniques."
},
{
"code": null,
"e": 299591,
"s": 299561,
"text": "Visual or Mapping techniques."
},
{
"code": null,
"e": 299759,
"s": 299591,
"text": "The use of such techniques should be done in consideration of the project and organizational objectives, resource skills and the infrastructure for project management."
},
{
"code": null,
"e": 299996,
"s": 299759,
"text": "PPM is crucial for a project to be successful as well as to identify any back lags if it were to occur. Project Managers often face a difficult situation arising from lack of planning and sometimes this may lead to a project withdrawal."
},
{
"code": null,
"e": 300280,
"s": 299996,
"text": "It's the primary responsibility of project managers to ensure that there are enough available resources for the projects that an organization undertakes. Proper resources will ensure that the project is completed within the set timeline and delivered without a compromise on quality."
},
{
"code": null,
"e": 300584,
"s": 300280,
"text": "Project managers also may wish to work on projects, which are given its utmost priority and value to an organization. This will enable project managers to deliver and receive support for quality projects that they have undertaken. PPM ensures that these objectives of the project management will be met."
},
{
"code": null,
"e": 300786,
"s": 300584,
"text": "The five question model of project portfolio management illustrates that the project manager is required to answer five essential questions before the inception as well as during the project execution."
},
{
"code": null,
"e": 300882,
"s": 300786,
"text": "The answers to these questions will determine the success of the implementation of the project."
},
{
"code": null,
"e": 301083,
"s": 300882,
"text": "Project portfolio management is aimed at reducing inefficiencies that occur when undertaking a project and eliminating potential risks, which can occur due to lack of information or systems available."
},
{
"code": null,
"e": 301203,
"s": 301083,
"text": "It helps the organization to align its project work to meet the projects whilst utilizing its resources to the maximum."
},
{
"code": null,
"e": 301423,
"s": 301203,
"text": "Therefore, all the project managers of the organization need to have an awareness of the organizational project portfolio management in order to contribute to the organizational goals when executing respective projects."
},
{
"code": null,
"e": 301684,
"s": 301423,
"text": "Every project delivers something at the end of the project execution. When it comes to the project initiation, the project management and the client collaboratively define the objectives and the deliveries of the project together with the completion timelines."
},
{
"code": null,
"e": 301887,
"s": 301684,
"text": "During the project execution, there are a number of project deliveries made. All these deliveries should adhere to certain quality standards (industry standards) as well as specific client requirements."
},
{
"code": null,
"e": 302094,
"s": 301887,
"text": "Therefore, each of these deliveries should be validated and verified before delivering to the client. For that, there should be a quality assurance function, which runs from start to the end of the project."
},
{
"code": null,
"e": 302297,
"s": 302094,
"text": "When it comes to the quality, not only the quality of the deliveries that matter the most. The processes or activities that produce deliverables should also adhere to certain quality guidelines as well."
},
{
"code": null,
"e": 302544,
"s": 302297,
"text": "As a principle, if the processes and activities that produce the deliverables do not adhere to their own quality standards (process quality standards), then there is a high probability that deliverables not meeting the delivery quality standards."
},
{
"code": null,
"e": 302852,
"s": 302544,
"text": "To address all the quality requirements, standards and quality assurance mechanisms in a project, a document called 'project quality plan' is developed by the project team. This plan acts as the quality bible for the project and all the stakeholders of the project should adhere to the project quality plan."
},
{
"code": null,
"e": 303071,
"s": 302852,
"text": "Depending on the nature of the industry and the nature of the project, the components or the areas addressed by a quality plan may vary. However, there are some components that can be found in any type of quality plan."
},
{
"code": null,
"e": 303149,
"s": 303071,
"text": "Let's have a look at the most essential attributes of a project quality plan."
},
{
"code": null,
"e": 303365,
"s": 303149,
"text": "This describes how the management is responsible for achieving the project quality. Since management is the controlling and monitoring function for the project, project quality is mainly a management responsibility."
},
{
"code": null,
"e": 303552,
"s": 303365,
"text": "Documents are the main method of communication in project management. Documents are used for communication between the team members, project management, senior management and the client."
},
{
"code": null,
"e": 303793,
"s": 303552,
"text": "Therefore, the project quality plan should describe a way to manage and control the documents used in the project. Usually, there can be a common documentation repository with controlled access in order to store and retrieve the documents. "
},
{
"code": null,
"e": 304030,
"s": 303793,
"text": "The correct requirements to be implemented are listed here. This is an abstraction of the requirements sign-off document. Having requirements noted in the project quality plan helps the quality assurance team to correctly validate them."
},
{
"code": null,
"e": 304232,
"s": 304030,
"text": "This way, quality assurance function knows what exactly to test and what exactly to leave out from the scope. Testing the requirements that are not in the scope may be a waste for the service provider."
},
{
"code": null,
"e": 304617,
"s": 304232,
"text": "This specifies the controls and procedures used for the design phase of the project. Usually, there should be design reviews in order to analyse the correctness of the proposed technical design. For fruitful design reviews, senior designers or the architects of the respective domain should get involved. Once the designs are reviewed and agreed, they are signed-off with the client. "
},
{
"code": null,
"e": 304825,
"s": 304617,
"text": "With the time, the client may come up with changes to the requirements or new requirements. In such cases, design may be changed. Every time the design changes, the changes should be reviewed and signed-off."
},
{
"code": null,
"e": 305072,
"s": 304825,
"text": "Once the construction of the project starts, all the processes, procedures and activities should be closely monitored and measured. By this type of control, the project management can make sure that the project is progressing in the correct path."
},
{
"code": null,
"e": 305355,
"s": 305072,
"text": "This component of the project quality plan takes precedence over other components. This is the element, which describes the main quality assurance functions of the project. This section should clearly identify the quality objectives for the project and the approach to achieve them."
},
{
"code": null,
"e": 305528,
"s": 305355,
"text": "This section identifies the project quality risks. Then, the project management team should come up with appropriate mitigation plans in order to address each quality risk."
},
{
"code": null,
"e": 305742,
"s": 305528,
"text": "For every project, regardless of its size or the nature, there should be periodic quality audits to measure the adherence to the quality standards. These audits can be done by an internal team or an external team."
},
{
"code": null,
"e": 305891,
"s": 305742,
"text": "Sometimes, the client may employ external audit teams to measure the compliance to standards and procedures of the project processes and activities."
},
{
"code": null,
"e": 306121,
"s": 305891,
"text": "During testing and quality assurance, defects are usually caught. This is quite common when it comes to software development projects. The project quality plan should have guidelines and instructions on how to manage the defects."
},
{
"code": null,
"e": 306311,
"s": 306121,
"text": "Every project team requires some kind of training before the project commences. For this, a skill gap analysis is done to identify the training requirements at the project initiation phase."
},
{
"code": null,
"e": 306426,
"s": 306311,
"text": "The project quality plan should indicate these training requirements and necessary steps to get the staff trained."
},
{
"code": null,
"e": 306506,
"s": 306426,
"text": "Project quality plan is one of the mandatory documents for any type of project."
},
{
"code": null,
"e": 306653,
"s": 306506,
"text": " As long as a project has defined objectives and deliverables, there should be a project quality plan to measure the delivery and process quality."
},
{
"code": null,
"e": 306861,
"s": 306653,
"text": "Project management is an approach, which helps managers to manage the projects. Project management also means using controls in place to meet the deadlines and other requirements such as cost of the project."
},
{
"code": null,
"e": 307084,
"s": 306861,
"text": "These controls involve proper and effective recording of project management activities. Record management is a systematic approach for organizing, planning and tracking documents during the course of the project execution."
},
{
"code": null,
"e": 307222,
"s": 307084,
"text": "A record system is a systematic process in which an organization determines the following considerations, activities and characteristics:"
},
{
"code": null,
"e": 307271,
"s": 307222,
"text": "The type of information that should be recorded."
},
{
"code": null,
"e": 307320,
"s": 307271,
"text": "The type of information that should be recorded."
},
{
"code": null,
"e": 307350,
"s": 307320,
"text": "A process for recording data."
},
{
"code": null,
"e": 307380,
"s": 307350,
"text": "A process for recording data."
},
{
"code": null,
"e": 307416,
"s": 307380,
"text": "Handling and collecting of records."
},
{
"code": null,
"e": 307452,
"s": 307416,
"text": "Handling and collecting of records."
},
{
"code": null,
"e": 307495,
"s": 307452,
"text": "The time period for retention and storage."
},
{
"code": null,
"e": 307538,
"s": 307495,
"text": "The time period for retention and storage."
},
{
"code": null,
"e": 307603,
"s": 307538,
"text": "Disposal or protecting records, which relate to external events."
},
{
"code": null,
"e": 307668,
"s": 307603,
"text": "Disposal or protecting records, which relate to external events."
},
{
"code": null,
"e": 307708,
"s": 307668,
"text": "Elements in a record management system."
},
{
"code": null,
"e": 307748,
"s": 307708,
"text": "Elements in a record management system."
},
{
"code": null,
"e": 307811,
"s": 307748,
"text": "Content analysis, which states or describes the record system."
},
{
"code": null,
"e": 307874,
"s": 307811,
"text": "Content analysis, which states or describes the record system."
},
{
"code": null,
"e": 307957,
"s": 307874,
"text": "A file plan, which indicates the kind of record that is required for each project."
},
{
"code": null,
"e": 308040,
"s": 307957,
"text": "A file plan, which indicates the kind of record that is required for each project."
},
{
"code": null,
"e": 308199,
"s": 308040,
"text": "A compliance requirement document, which will outline the IT procedures that everyone needs to follow. This will ensure that team members are fully compliant."
},
{
"code": null,
"e": 308358,
"s": 308199,
"text": "A compliance requirement document, which will outline the IT procedures that everyone needs to follow. This will ensure that team members are fully compliant."
},
{
"code": null,
"e": 308487,
"s": 308358,
"text": "A method, which collects out dated documents. These should be done across all record sources such as e-mails, file servers, etc."
},
{
"code": null,
"e": 308616,
"s": 308487,
"text": "A method, which collects out dated documents. These should be done across all record sources such as e-mails, file servers, etc."
},
{
"code": null,
"e": 308647,
"s": 308616,
"text": "A method for auditing records."
},
{
"code": null,
"e": 308678,
"s": 308647,
"text": "A method for auditing records."
},
{
"code": null,
"e": 308720,
"s": 308678,
"text": "A system, which captures the record data."
},
{
"code": null,
"e": 308762,
"s": 308720,
"text": "A system, which captures the record data."
},
{
"code": null,
"e": 308852,
"s": 308762,
"text": "A system, which ensures monitoring and reporting in the way which records are being held."
},
{
"code": null,
"e": 308942,
"s": 308852,
"text": "A system, which ensures monitoring and reporting in the way which records are being held."
},
{
"code": null,
"e": 309133,
"s": 308942,
"text": "In the project record management process, there are three distinct stages. These stages have many other activities involved in order to complete and accomplish the objectives for each stage."
},
{
"code": null,
"e": 309149,
"s": 309133,
"text": "The stages are:"
},
{
"code": null,
"e": 309174,
"s": 309149,
"text": "The creation of records "
},
{
"code": null,
"e": 309199,
"s": 309174,
"text": "The creation of records "
},
{
"code": null,
"e": 309222,
"s": 309199,
"text": "Maintenance of records"
},
{
"code": null,
"e": 309245,
"s": 309222,
"text": "Maintenance of records"
},
{
"code": null,
"e": 309278,
"s": 309245,
"text": "Storage and retrieval of records"
},
{
"code": null,
"e": 309311,
"s": 309278,
"text": "Storage and retrieval of records"
},
{
"code": null,
"e": 309361,
"s": 309311,
"text": "Let's have a look at each of the stage in detail."
},
{
"code": null,
"e": 309523,
"s": 309361,
"text": "This refers to the underlying reason as to why the record is being created. This could be for a receipt or for an inventory control report or some other reason."
},
{
"code": null,
"e": 309729,
"s": 309523,
"text": "The primary objective of project record management is to determine the flow of the record handling once the record is created. When it comes to creating records, the following questions should be answered."
},
{
"code": null,
"e": 309755,
"s": 309729,
"text": "Who will view the record?"
},
{
"code": null,
"e": 309781,
"s": 309755,
"text": "Who will view the record?"
},
{
"code": null,
"e": 309824,
"s": 309781,
"text": "Who will be the final owner of the record?"
},
{
"code": null,
"e": 309867,
"s": 309824,
"text": "Who will be the final owner of the record?"
},
{
"code": null,
"e": 309910,
"s": 309867,
"text": "Who is responsible for storing the record?"
},
{
"code": null,
"e": 309953,
"s": 309910,
"text": "Who is responsible for storing the record?"
},
{
"code": null,
"e": 310194,
"s": 309953,
"text": "Developing an operation to store the records refers to maintaining the records. The access levels to the records should be defined at this stage and should take all necessary steps in order to avoid the records getting into the wrong hands."
},
{
"code": null,
"e": 310296,
"s": 310194,
"text": "Proper compliance procedures and security measures need to be in place to avoid misusing of records. "
},
{
"code": null,
"e": 310562,
"s": 310296,
"text": "Storing of records could refer to manual storage of documents as well as digital storage. Project managers need to ensure that the records are returned in the way it was borrowed. Maintaining records also refers to the amount of time that records can be maintained."
},
{
"code": null,
"e": 310811,
"s": 310562,
"text": "Some organizations may retain records up to six years whilst others less amount of years. If records are saved digitally, proper folders need to be created. Once created, the older documents need to be archived so that hard drive space is retained."
},
{
"code": null,
"e": 310973,
"s": 310811,
"text": "Records, which are collated needs to be planned. The following outlines the steps that management needs to take to ensure record planning process is successful."
},
{
"code": null,
"e": 311269,
"s": 310973,
"text": "Identification of roles, which ensure that records are managed properly\n\nAllocating dedicated roles or appointing dedicated people to categorize the records, which are available in an organization.\nAppointing IT professionals to implement systems, which maintain and support record management.\n\n"
},
{
"code": null,
"e": 311341,
"s": 311269,
"text": "Identification of roles, which ensure that records are managed properly"
},
{
"code": null,
"e": 311466,
"s": 311341,
"text": "Allocating dedicated roles or appointing dedicated people to categorize the records, which are available in an organization."
},
{
"code": null,
"e": 311591,
"s": 311466,
"text": "Allocating dedicated roles or appointing dedicated people to categorize the records, which are available in an organization."
},
{
"code": null,
"e": 311687,
"s": 311591,
"text": "Appointing IT professionals to implement systems, which maintain and support record management."
},
{
"code": null,
"e": 311783,
"s": 311687,
"text": "Appointing IT professionals to implement systems, which maintain and support record management."
},
{
"code": null,
"e": 311892,
"s": 311783,
"text": "Managers need to make sure that the team members are aware of the procedures in place for record management."
},
{
"code": null,
"e": 312001,
"s": 311892,
"text": "Managers need to make sure that the team members are aware of the procedures in place for record management."
},
{
"code": null,
"e": 312101,
"s": 312001,
"text": "The record management process needs to analyze the content of the documents, which are to be saved."
},
{
"code": null,
"e": 312201,
"s": 312101,
"text": "The record management process needs to analyze the content of the documents, which are to be saved."
},
{
"code": null,
"e": 312290,
"s": 312201,
"text": "Implement a file plan, which will store the different kinds of files in an organization."
},
{
"code": null,
"e": 312379,
"s": 312290,
"text": "Implement a file plan, which will store the different kinds of files in an organization."
},
{
"code": null,
"e": 312498,
"s": 312379,
"text": "Develop retention schedules, which could vary from one organization to another depending on the activity taking place."
},
{
"code": null,
"e": 312617,
"s": 312498,
"text": "Develop retention schedules, which could vary from one organization to another depending on the activity taking place."
},
{
"code": null,
"e": 312663,
"s": 312617,
"text": "Design effective record management solutions."
},
{
"code": null,
"e": 312709,
"s": 312663,
"text": "Design effective record management solutions."
},
{
"code": null,
"e": 312765,
"s": 312709,
"text": "Planning of how content can be moved to record methods."
},
{
"code": null,
"e": 312821,
"s": 312765,
"text": "Planning of how content can be moved to record methods."
},
{
"code": null,
"e": 312876,
"s": 312821,
"text": "Develop a plan where e-mail integration could be made."
},
{
"code": null,
"e": 312931,
"s": 312876,
"text": "Develop a plan where e-mail integration could be made."
},
{
"code": null,
"e": 312979,
"s": 312931,
"text": "Plan a compliance procedure for social content."
},
{
"code": null,
"e": 313027,
"s": 312979,
"text": "Plan a compliance procedure for social content."
},
{
"code": null,
"e": 313109,
"s": 313027,
"text": "Develop compliance procedures that align the objectives of project record system."
},
{
"code": null,
"e": 313191,
"s": 313109,
"text": "Develop compliance procedures that align the objectives of project record system."
},
{
"code": null,
"e": 313413,
"s": 313191,
"text": "A record is a document or an electronic storage of data in an organization which acts as evidence or a guideline. A project record management is a systematic process, which allows people to retain records for future use."
},
{
"code": null,
"e": 313561,
"s": 313413,
"text": "It outlines the details which are relevant to the project. Hence, project record management needs to be monitored and retained in a careful manner."
},
{
"code": null,
"e": 313690,
"s": 313561,
"text": "All projects start off with a bang. Yet, some are destined for failure from its very inception, whilst others collapse later on."
},
{
"code": null,
"e": 313802,
"s": 313690,
"text": "Yet, others reach the finish line triumphantly, carrying with them a few scars from battles faced and overcome."
},
{
"code": null,
"e": 313937,
"s": 313802,
"text": "Therefore, in order to minimize project failure, it is prudent to identify the main causative factors that contribute to project risk."
},
{
"code": null,
"e": 314139,
"s": 313937,
"text": "The three main constraints on projects can be classified as schedule, scope and resources, and the mishandling of each can cause a ripple effect on the project, which would then face imminent collapse."
},
{
"code": null,
"e": 314349,
"s": 314139,
"text": "Defining what is required is not always easy. However, so as to ensure that scope risk is minimized, the deliverables, the objectives, the project charter, and of course, the scope needs to be clearly defined."
},
{
"code": null,
"e": 314640,
"s": 314349,
"text": "All scope risks, be they quantifiable or not, needs to recognized. Scope creep, hardware defects, software defects, an insufficiently defined scope, unexpected changes in the legal or regulatory framework and integration defects can all be classified under the broad umbrella of scope risk."
},
{
"code": null,
"e": 314890,
"s": 314640,
"text": "There are a variety of methods that help stakeholders identify the scope of the project. The risk framework analyses the project's dependency on technology and the market and then assesses how changes in each would affect the outcome of the project."
},
{
"code": null,
"e": 315083,
"s": 314890,
"text": "Similarly, the risk complexity index looks at the technical aspects of the projects, which can be easily quantified and allocated a number between 0 and 99 to indicate the risk of the project."
},
{
"code": null,
"e": 315214,
"s": 315083,
"text": "Risk assessment, on the other hand, uses a grid of technology, structure and magnitude to assess the proposed risk of the project."
},
{
"code": null,
"e": 315378,
"s": 315214,
"text": "A work breakdown structure, commonly abbreviated as WBS, also considers the risks of projects, which are ill defined and where the stated objectives are ambiguous."
},
{
"code": null,
"e": 315795,
"s": 315378,
"text": "Scope risks can be minimized and managed with savvy planning. Defining the project clearly, managing the changes in scope throughout the duration of the project, making use of risk registers to better manage risks, identifying the causative factors, and the appropriate responses to risky situations and developing greater risk tolerance in collaboration with the customer, would pay great dividends in the long run."
},
{
"code": null,
"e": 315914,
"s": 315795,
"text": "Keeping to timelines and agreed critical paths is one of the most difficult situations that project managers now face."
},
{
"code": null,
"e": 316159,
"s": 315914,
"text": "An extensive reliance on external parties whose output is not within the project's scope of control, estimation errors, which most often are too optimistic, hardware delays and putting off decision making, all tend to delay the project at hand."
},
{
"code": null,
"e": 316511,
"s": 316159,
"text": "To minimize schedule risks, there are a few time-tested methods that can be put to good use. The process flow of the project should be broken down into small, clearly defined components where the allocated timeframe for each process is relatively short in duration (this makes it easy to identify things when tasks veer off schedule, at its earliest)."
},
{
"code": null,
"e": 316673,
"s": 316511,
"text": "Be wary of team members or external parties, who hesitate to give estimates or whose estimates seem unrealistic based on historical data and previous experience."
},
{
"code": null,
"e": 316910,
"s": 316673,
"text": "When formulating the critical path, ensure that any holidays that arise are in-built into the equation, so that realistic expectations are created, right from inception. Defining re-work loops too is also recommended, wherever possible."
},
{
"code": null,
"e": 317253,
"s": 316910,
"text": "People and funds are any project's main resource base. If the people are unskilled or incompetent to perform the task at hand, if the project is under-staffed from the beginning, or if key project members come on aboard far after the inception of the project, there is an obvious project risk that has ill-planned human resources as its base."
},
{
"code": null,
"e": 317538,
"s": 317253,
"text": "Similarly, from a financial perspective, if insufficient funds are provided to carry out the necessary tasks, be it relevant training programs for the people in question or be it inadequate investments in technology or required machinery, the project is doomed to fail from inception."
},
{
"code": null,
"e": 317797,
"s": 317538,
"text": "Estimating project costs accurately, allocating a suitable budget to meet these costs, not placing undue expectations on the capacity of the staff in question and avoiding burn-out at a later date are all factors that help minimize the project resource risk."
},
{
"code": null,
"e": 318029,
"s": 317797,
"text": "Outsourced functions merit even more attention to detail, as it is for the most part, it is away from the direct purview of the project manager. Clearly defined contracts and regular monitoring would lessen this risk substantially."
},
{
"code": null,
"e": 318225,
"s": 318029,
"text": "Conflict management, which too generally arises with the progression of a project, should also be handled in a skilful manner, so that the project has a smooth run throughout its entire duration."
},
{
"code": null,
"e": 318346,
"s": 318225,
"text": "As is readily apparent, all projects do run the risk of failure due to unplanned contingencies and inaccurate estimates."
},
{
"code": null,
"e": 318623,
"s": 318346,
"text": "Yet, careful planning, constraint management, successful recovery from mistakes if and when they do arise will minimize most risks. True, luck too, does play a part in the success of a project, but hard work and savvy management practices will override most such difficulties."
},
{
"code": null,
"e": 318869,
"s": 318623,
"text": "Risk is inevitable in a business organization when undertaking projects. However, the project manager needs to ensure that risks are kept to a minimal. Risks can be mainly divided between two types, negative impact risk and positive impact risk."
},
{
"code": null,
"e": 319122,
"s": 318869,
"text": "Not all the time would project managers be facing negative impact risks as there are positive impact risks too. Once the risk has been identified, project managers need to come up with a mitigation plan or any other solution to counter attack the risk."
},
{
"code": null,
"e": 319301,
"s": 319122,
"text": "Managers can plan their strategy based on four steps of risk management which prevails in an organization. Following are the steps to manage risks effectively in an organization:"
},
{
"code": null,
"e": 319321,
"s": 319301,
"text": "Risk Identification"
},
{
"code": null,
"e": 319341,
"s": 319321,
"text": "Risk Identification"
},
{
"code": null,
"e": 319361,
"s": 319341,
"text": "Risk Quantification"
},
{
"code": null,
"e": 319381,
"s": 319361,
"text": "Risk Quantification"
},
{
"code": null,
"e": 319395,
"s": 319381,
"text": "Risk Response"
},
{
"code": null,
"e": 319409,
"s": 319395,
"text": "Risk Response"
},
{
"code": null,
"e": 319437,
"s": 319409,
"text": "Risk Monitoring and Control"
},
{
"code": null,
"e": 319465,
"s": 319437,
"text": "Risk Monitoring and Control"
},
{
"code": null,
"e": 319527,
"s": 319465,
"text": "Let's go through each of the step in project risk management:"
},
{
"code": null,
"e": 319890,
"s": 319527,
"text": "Managers face many difficulties when it comes to identifying and naming the risks that occur when undertaking projects. These risks could be resolved through structured or unstructured brainstorming or strategies. It's important to understand that risks pertaining to the project can only be handled by the project manager and other stakeholders of the project."
},
{
"code": null,
"e": 320195,
"s": 319890,
"text": "Risks, such as operational or business risks will be handled by the relevant teams. The risks that often impact a project are supplier risk, resource risk and budget risk. Supplier risk would refer to risks that can occur in case the supplier is not meeting the timeline to supply the resources required."
},
{
"code": null,
"e": 320391,
"s": 320195,
"text": "Resource risk occurs when the human resource used in the project is not enough or not skilled enough. Budget risk would refer to risks that can occur if the costs are more than what was budgeted."
},
{
"code": null,
"e": 320532,
"s": 320391,
"text": "Risks can be evaluated based on quantity. Project managers need to analyze the likely chances of a risk occurring with the help of a matrix."
},
{
"code": null,
"e": 320929,
"s": 320532,
"text": "Using the matrix, the project manager can categorize the risk into four categories as Low, Medium, High and Critical. The probability of occurrence and the impact on the project are the two parameters used for placing the risk in the matrix categories. As an example, if a risk occurrence is low (probability = 2) and it has the highest impact (impact = 4), the risk can be categorized as 'High'."
},
{
"code": null,
"e": 321153,
"s": 320929,
"text": "When it comes to risk management, it depends on the project manager to choose strategies that will reduce the risk to minimal. Project managers can choose between the four risk response strategies, which are outlined below."
},
{
"code": null,
"e": 321174,
"s": 321153,
"text": "Risks can be avoided"
},
{
"code": null,
"e": 321195,
"s": 321174,
"text": "Risks can be avoided"
},
{
"code": null,
"e": 321212,
"s": 321195,
"text": "Pass on the risk"
},
{
"code": null,
"e": 321229,
"s": 321212,
"text": "Pass on the risk"
},
{
"code": null,
"e": 321284,
"s": 321229,
"text": "Take corrective measures to reduce the impact of risks"
},
{
"code": null,
"e": 321339,
"s": 321284,
"text": "Take corrective measures to reduce the impact of risks"
},
{
"code": null,
"e": 321360,
"s": 321339,
"text": "Acknowledge the risk"
},
{
"code": null,
"e": 321381,
"s": 321360,
"text": "Acknowledge the risk"
},
{
"code": null,
"e": 321544,
"s": 321381,
"text": "Risks can be monitored on a continuous basis to check if any change is made. New risks can be identified through the constant monitoring and assessing mechanisms."
},
{
"code": null,
"e": 321619,
"s": 321544,
"text": "Following are the considerations when it comes to risk management process:"
},
{
"code": null,
"e": 321737,
"s": 321619,
"text": "Each person involved in the process of planning needs to identify and understand the risks pertaining to the project."
},
{
"code": null,
"e": 321855,
"s": 321737,
"text": "Each person involved in the process of planning needs to identify and understand the risks pertaining to the project."
},
{
"code": null,
"e": 321996,
"s": 321855,
"text": "Once the team members have given their list of risks, the risks should be consolidated to a single list in order to remove the duplications."
},
{
"code": null,
"e": 322137,
"s": 321996,
"text": "Once the team members have given their list of risks, the risks should be consolidated to a single list in order to remove the duplications."
},
{
"code": null,
"e": 322223,
"s": 322137,
"text": "Assessing the probability and impact of the risks involved with the help of a matrix."
},
{
"code": null,
"e": 322309,
"s": 322223,
"text": "Assessing the probability and impact of the risks involved with the help of a matrix."
},
{
"code": null,
"e": 322411,
"s": 322309,
"text": "Split the team into subgroups where each group will identify the triggers that lead to project risks."
},
{
"code": null,
"e": 322513,
"s": 322411,
"text": "Split the team into subgroups where each group will identify the triggers that lead to project risks."
},
{
"code": null,
"e": 322632,
"s": 322513,
"text": "The teams need to come up with a contingency plan whereby to strategically eliminate the risks involved or identified."
},
{
"code": null,
"e": 322751,
"s": 322632,
"text": "The teams need to come up with a contingency plan whereby to strategically eliminate the risks involved or identified."
},
{
"code": null,
"e": 322926,
"s": 322751,
"text": "Plan the risk management process. Each person involved in the project is assigned a risk in which he/she looks out for any triggers and then finds a suitable solution for it."
},
{
"code": null,
"e": 323101,
"s": 322926,
"text": "Plan the risk management process. Each person involved in the project is assigned a risk in which he/she looks out for any triggers and then finds a suitable solution for it."
},
{
"code": null,
"e": 323278,
"s": 323101,
"text": "Often project managers will compile a document, which outlines the risks involved and the strategies in place. This document is vital as it provides a huge deal of information."
},
{
"code": null,
"e": 323521,
"s": 323278,
"text": "Risk register will often consists of diagrams to aid the reader as to the types of risks that are dealt by the organization and the course of action taken. The risk register should be freely accessible for all the members of the project team."
},
{
"code": null,
"e": 323723,
"s": 323521,
"text": "As mentioned above, risks contain two sides. It can be either viewed as a negative element or a positive element. Negative risks can be detrimental factors that can haphazard situations for a project."
},
{
"code": null,
"e": 323944,
"s": 323723,
"text": "Therefore, these should be curbed once identified. On the other hand, positive risks can bring about acknowledgements from both the customer and the management. All the risks need to be addressed by the project manager."
},
{
"code": null,
"e": 324160,
"s": 323944,
"text": "An organization will not be able to fully eliminate or eradicate risks. Every project engagement will have its own set of risks to be dealt with. A certain degree of risk will be involved when undertaking a project."
},
{
"code": null,
"e": 324396,
"s": 324160,
"text": "The risk management process should not be compromised at any point, if ignored can lead to detrimental effects. The entire management team of the organization should be aware of the project risk management methodologies and techniques."
},
{
"code": null,
"e": 324497,
"s": 324396,
"text": "Enhanced education and frequent risk assessments are the best way to minimize the damage from risks."
},
{
"code": null,
"e": 324893,
"s": 324497,
"text": "When it comes to project planning, defining the project scope is the most critical step. In case if you start the project without knowing what you are supposed to be delivering at the end to the client and what the boundaries of the project are, there is a little chance for you to success. In most of the instances, you actually do not have any chance to success with this unorganized approach."
},
{
"code": null,
"e": 325026,
"s": 324893,
"text": "If you do not do a good job in project scope definition, project scope management during the project execution is almost impossible."
},
{
"code": null,
"e": 325244,
"s": 325026,
"text": "The main purpose of the scope definition is to clearly describe the boundaries of your project. Clearly describing the boundaries is not enough when it comes to project. You need to get the client's agreement as well."
},
{
"code": null,
"e": 325447,
"s": 325244,
"text": "Therefore, the defined scope of the project usually included into the contractual agreements between the client and the service provider. SOW, or in other words, Statement of Work, is one such document."
},
{
"code": null,
"e": 325742,
"s": 325447,
"text": "In the project scope definition, the elements within the scope and out of the scope are well defined in order to clearly understand what will be the area under the project control. Therefore, you should identify more elements in detailed manner and divide them among the scope and out of scope."
},
{
"code": null,
"e": 325924,
"s": 325742,
"text": "When the project is about to be funded, there should be a set of defined deliveries and objectives for the project. There can be a high level-scope statement prepared at this level."
},
{
"code": null,
"e": 326143,
"s": 325924,
"text": "This high-level scope statement can be taken from the initial documents such as SOW. In addition to the SOW, you need to use any other document or information in order to further define the project scope at this level."
},
{
"code": null,
"e": 326334,
"s": 326143,
"text": "In case, if you feel that you do not have enough information to come up with a high-level scope statement, you should then work closely with the client in order gather necessary information."
},
{
"code": null,
"e": 326581,
"s": 326334,
"text": "Project objectives can be used for defining the project scope. As a matter of fact, there should be one or more deliveries addressing each project objective in the project. By looking at the deliverables, you can actually gauge the project scope."
},
{
"code": null,
"e": 326727,
"s": 326581,
"text": "Once you get to know the main deliverables of the project, start asking questions about the other processes and different aspects of the project."
},
{
"code": null,
"e": 327028,
"s": 326727,
"text": "First identifying and clearly defining the out of scope also helps you to understand the scope of a project. When you go on defining the out of scope, you will automatically get an idea of the real project scope. In order to follow this method, you need to have a defined scope up to a certain level."
},
{
"code": null,
"e": 327195,
"s": 327028,
"text": "Whenever you identify an item for the scope or out-of-scope, make sure you document it then and there. Later, you can revisit these items and elaborate more on those."
},
{
"code": null,
"e": 327459,
"s": 327195,
"text": "Once you have successfully defined the scope of the project, you need to get the sign-off from the related and applicable parties. Without proper sign-off for the scope, the next phases of the project, i.e., requirements gathering, might have issues in executing."
},
{
"code": null,
"e": 327697,
"s": 327459,
"text": "Scope creep is something common with every project. This refers to the incremental expansion of the project scope. Most of the time, the client may come back to the service provider during the project execution and add more requirements."
},
{
"code": null,
"e": 327876,
"s": 327697,
"text": "Most of such requirements haven't been in the initial requirements. As a result, change requests need to be raised in order to cover the increasing costs of the service provider."
},
{
"code": null,
"e": 328061,
"s": 327876,
"text": "Due to business cope creep, there can be technological scope creep as well. The project team may require new technologies in order to address some of the new requirements in the scope."
},
{
"code": null,
"e": 328198,
"s": 328061,
"text": "In such instances, the service provider may want to work with the client closely and make necessary logistic and financial arrangements."
},
{
"code": null,
"e": 328426,
"s": 328198,
"text": "Project scope definition is the most important factor when it comes to project requirements. It is vital for service providers to define the scope of the project in order to successfully enter into an agreement with the client."
},
{
"code": null,
"e": 328667,
"s": 328426,
"text": "In addition to this, the scope of the project gives an idea to the services provider about the estimated cost of the project. Therefore, service provider's profit margins are wholly dependent on the accuracy of the project scope definition."
},
{
"code": null,
"e": 328921,
"s": 328667,
"text": "One of the biggest decisions that any organization would have to make is related to the projects they would undertake. Once a proposal has been received, there are numerous factors that need to be considered before an organization decides to take it up."
},
{
"code": null,
"e": 329202,
"s": 328921,
"text": "The most viable option needs to be chosen, keeping in mind the goals and requirements of the organization. How is it then that you decide whether a project is viable? How do you decide if the project at hand is worth approving? This is where project selection methods come in use."
},
{
"code": null,
"e": 329357,
"s": 329202,
"text": "Choosing a project using the right method is therefore of utmost importance. This is what will ultimately define the way the project is to be carried out."
},
{
"code": null,
"e": 329679,
"s": 329357,
"text": "But the question then arises as to how you would go about finding the right methodology for your particular organization. At this instance, you would need careful guidance in the project selection criteria, as a small mistake could be detrimental to your project as a whole, and in the long run, the organization as well."
},
{
"code": null,
"e": 329900,
"s": 329679,
"text": "There are various project selection methods practised by the modern business organizations. These methods have different features and characteristics. Therefore, each selection method is best for different organizations."
},
{
"code": null,
"e": 330038,
"s": 329900,
"text": "Although there are many differences between these project selection methods, usually the underlying concepts and principles are the same."
},
{
"code": null,
"e": 330150,
"s": 330038,
"text": "Following is an illustration of two of such methods (Benefit Measurement and Constrained Optimization methods):"
},
{
"code": null,
"e": 330362,
"s": 330150,
"text": "As the value of one project would need to be compared against the other projects, you could use the benefit measurement methods. This could include various techniques, of which the following are the most common:"
},
{
"code": null,
"e": 330610,
"s": 330362,
"text": "You and your team could come up with certain criteria that you want your ideal project objectives to meet. You could then give each project scores based on how they rate in each of these criteria and then choose the project with the highest score."
},
{
"code": null,
"e": 330858,
"s": 330610,
"text": "You and your team could come up with certain criteria that you want your ideal project objectives to meet. You could then give each project scores based on how they rate in each of these criteria and then choose the project with the highest score."
},
{
"code": null,
"e": 331115,
"s": 330858,
"text": "When it comes to the Discounted Cash flow method, the future value of a project is ascertained by considering the present value and the interest earned on the money. The higher the present value of the project, the better it would be for your organization."
},
{
"code": null,
"e": 331372,
"s": 331115,
"text": "When it comes to the Discounted Cash flow method, the future value of a project is ascertained by considering the present value and the interest earned on the money. The higher the present value of the project, the better it would be for your organization."
},
{
"code": null,
"e": 331524,
"s": 331372,
"text": "The rate of return received from the money is what is known as the IRR. Here again, you need to be looking for a high rate of return from the project. "
},
{
"code": null,
"e": 331676,
"s": 331524,
"text": "The rate of return received from the money is what is known as the IRR. Here again, you need to be looking for a high rate of return from the project. "
},
{
"code": null,
"e": 331873,
"s": 331676,
"text": "The mathematical approach is commonly used for larger projects. The constrained optimization methods require several calculations in order to decide on whether or not a project should be rejected."
},
{
"code": null,
"e": 332291,
"s": 331873,
"text": "Cost-benefit analysis is used by several organizations to assist them to make their selections. Going by this method, you would have to consider all the positive aspects of the project which are the benefits and then deduct the negative aspects (or the costs) from the benefits. Based on the results you receive for different projects, you could choose which option would be the most viable and financially rewarding."
},
{
"code": null,
"e": 332483,
"s": 332291,
"text": "These benefits and costs need to be carefully considered and quantified in order to arrive at a proper conclusion. Questions that you may want to consider asking in the selection process are:"
},
{
"code": null,
"e": 332561,
"s": 332483,
"text": "Would this decision help me to increase organizational value in the long run?"
},
{
"code": null,
"e": 332639,
"s": 332561,
"text": "Would this decision help me to increase organizational value in the long run?"
},
{
"code": null,
"e": 332677,
"s": 332639,
"text": "How long will the equipment last for?"
},
{
"code": null,
"e": 332715,
"s": 332677,
"text": "How long will the equipment last for?"
},
{
"code": null,
"e": 332767,
"s": 332715,
"text": "Would I be able to cut down on costs as I go along?"
},
{
"code": null,
"e": 332819,
"s": 332767,
"text": "Would I be able to cut down on costs as I go along?"
},
{
"code": null,
"e": 333044,
"s": 332819,
"text": "In addition to these methods, you could also consider choosing based on opportunity cost - When choosing any project, you would need to keep in mind the profits that you would make if you decide to go ahead with the project."
},
{
"code": null,
"e": 333231,
"s": 333044,
"text": "Profit optimization is therefore the ultimate goal. You need to consider the difference between the profits of the project you are primarily interested in and the next best alternative."
},
{
"code": null,
"e": 333580,
"s": 333231,
"text": "The methods mentioned above can be carried out in various combinations. It is best that you try out different methods, as in this way you would be able to make the best decision for your organization considering a wide range of factors rather than concentrating on just a few. Careful consideration would therefore need to be given to each project."
},
{
"code": null,
"e": 333723,
"s": 333580,
"text": "In conclusion, you would need to remember that these methods are time-consuming, but are absolutely essential for efficient business planning."
},
{
"code": null,
"e": 333961,
"s": 333723,
"text": "It is always best to have a good plan from the inception, with a list of criteria to be considered and goals to be achieved. This will guide you through the entire selection process and will also ensure that you do make the right choice."
},
{
"code": null,
"e": 334164,
"s": 333961,
"text": "As a project manager, the main objective of the project manager is to deliver the project within the time stated and on budget defined. However, that's not all when it comes to project success criteria."
},
{
"code": null,
"e": 334336,
"s": 334164,
"text": "In addition to above conditions, the project manager needs to work closely with the customer and should ensure the project deliverables have met the customer expectations."
},
{
"code": null,
"e": 334394,
"s": 334336,
"text": "There are many parameters in a project success criterion."
},
{
"code": null,
"e": 334604,
"s": 334394,
"text": "The first project success criterion is to deliver projects bearing in mind the business drivers. Key Performance Indicators (KPI's) is a method used to measure the benefits gained from undertaking the project."
},
{
"code": null,
"e": 334690,
"s": 334604,
"text": "These provide an insight to the scope of the project. The performance indicators are:"
},
{
"code": null,
"e": 334781,
"s": 334690,
"text": "Established by the clients at the start of the project and are listed on a priority basis."
},
{
"code": null,
"e": 334872,
"s": 334781,
"text": "Established by the clients at the start of the project and are listed on a priority basis."
},
{
"code": null,
"e": 334910,
"s": 334872,
"text": "Aligned with the business objectives."
},
{
"code": null,
"e": 334948,
"s": 334910,
"text": "Aligned with the business objectives."
},
{
"code": null,
"e": 335012,
"s": 334948,
"text": "Able to make critical decisions based on KPI's for the project."
},
{
"code": null,
"e": 335076,
"s": 335012,
"text": "Able to make critical decisions based on KPI's for the project."
},
{
"code": null,
"e": 335141,
"s": 335076,
"text": "Prove to be a stance for products to be accepted by the clients."
},
{
"code": null,
"e": 335206,
"s": 335141,
"text": "Prove to be a stance for products to be accepted by the clients."
},
{
"code": null,
"e": 335254,
"s": 335206,
"text": "It's a quantitative method and it's measurable."
},
{
"code": null,
"e": 335302,
"s": 335254,
"text": "It's a quantitative method and it's measurable."
},
{
"code": null,
"e": 335461,
"s": 335302,
"text": "To create a project success, criteria based on KPI is not enough and targets need to be set. These set targets need to be realistic and achievable at the end."
},
{
"code": null,
"e": 335684,
"s": 335461,
"text": "A project success criterion begins with the initiatives taken by the project manager to the project in question. This will increase the chances of the project becoming successful as well as meeting customer's expectations."
},
{
"code": null,
"e": 335790,
"s": 335684,
"text": "The project manager, who wants his/her project successful will definitely ask the customers for feedback."
},
{
"code": null,
"e": 335992,
"s": 335790,
"text": "This approach will prove to be successful and will be a learning curve if any mistakes had been done. KPI need to go hand in hand with the business objectives for a project to be considered successful."
},
{
"code": null,
"e": 336276,
"s": 335992,
"text": "Going the extra mile is not restricted to only customer services, it's also a magic word for project management. A top most important factor for a project success criterion is to exceed customer's expectations by completing the project within the stated deadline, budget and quality."
},
{
"code": null,
"e": 336579,
"s": 336276,
"text": "However, project manager needs to bear in mind that this could be misinterpreted and could lead to unnecessary cost. Ideas to make a better product than sticking to the original idea could be done with the approval of the customer. For this to be successful, proper implementation needs to be in place."
},
{
"code": null,
"e": 336727,
"s": 336579,
"text": "Success factors are contributions made by the management towards a successful project. These can be classified broadly into five groups as follows:"
},
{
"code": null,
"e": 336835,
"s": 336727,
"text": "The project manager - The person needs to have an array of skills under his arm to use during the project. "
},
{
"code": null,
"e": 336943,
"s": 336835,
"text": "The project manager - The person needs to have an array of skills under his arm to use during the project. "
},
{
"code": null,
"e": 337094,
"s": 336943,
"text": "Project team - The team needs to consist of variety of skills and experience. Collectively as a team, success is easy to achieve with proper guidance."
},
{
"code": null,
"e": 337245,
"s": 337094,
"text": "Project team - The team needs to consist of variety of skills and experience. Collectively as a team, success is easy to achieve with proper guidance."
},
{
"code": null,
"e": 337305,
"s": 337245,
"text": "Project - The scope and timeline of the project is crucial."
},
{
"code": null,
"e": 337365,
"s": 337305,
"text": "Project - The scope and timeline of the project is crucial."
},
{
"code": null,
"e": 337472,
"s": 337365,
"text": "Organization - The organization needs to provide support to both the project manager and the project team."
},
{
"code": null,
"e": 337579,
"s": 337472,
"text": "Organization - The organization needs to provide support to both the project manager and the project team."
},
{
"code": null,
"e": 337740,
"s": 337579,
"text": "External environment - External constraints should not affect the project. Back-up plans need to be in place in case daily tasks cannot be carried by the team. "
},
{
"code": null,
"e": 337901,
"s": 337740,
"text": "External environment - External constraints should not affect the project. Back-up plans need to be in place in case daily tasks cannot be carried by the team. "
},
{
"code": null,
"e": 338018,
"s": 337901,
"text": "The project's quality should not be compromised under any circumstances as this will drive away potential customers."
},
{
"code": null,
"e": 338238,
"s": 338018,
"text": "The criteria for a successful project are not restricted to only above. However, following are some of other supporting factors that need to be considered when it comes to a successful project management and execution: "
},
{
"code": null,
"e": 338251,
"s": 338238,
"text": "Negotiations"
},
{
"code": null,
"e": 338264,
"s": 338251,
"text": "Negotiations"
},
{
"code": null,
"e": 338298,
"s": 338264,
"text": "Proper and conducive project plan"
},
{
"code": null,
"e": 338332,
"s": 338298,
"text": "Proper and conducive project plan"
},
{
"code": null,
"e": 338368,
"s": 338332,
"text": "Assigning tasks to the team members"
},
{
"code": null,
"e": 338404,
"s": 338368,
"text": "Assigning tasks to the team members"
},
{
"code": null,
"e": 338446,
"s": 338404,
"text": "Developing a plan to achieve common tasks"
},
{
"code": null,
"e": 338488,
"s": 338446,
"text": "Developing a plan to achieve common tasks"
},
{
"code": null,
"e": 338529,
"s": 338488,
"text": "Reviewing and doing a rework when needed"
},
{
"code": null,
"e": 338570,
"s": 338529,
"text": "Reviewing and doing a rework when needed"
},
{
"code": null,
"e": 338605,
"s": 338570,
"text": "Managing project risks efficiently"
},
{
"code": null,
"e": 338640,
"s": 338605,
"text": "Managing project risks efficiently"
},
{
"code": null,
"e": 338680,
"s": 338640,
"text": "Allocating time for process improvement"
},
{
"code": null,
"e": 338720,
"s": 338680,
"text": "Allocating time for process improvement"
},
{
"code": null,
"e": 338750,
"s": 338720,
"text": "Learn from the learning curve"
},
{
"code": null,
"e": 338780,
"s": 338750,
"text": "Learn from the learning curve"
},
{
"code": null,
"e": 338868,
"s": 338780,
"text": "Proper estimation of project in terms of not only quantitatively but also qualitatively"
},
{
"code": null,
"e": 338956,
"s": 338868,
"text": "Proper estimation of project in terms of not only quantitatively but also qualitatively"
},
{
"code": null,
"e": 339126,
"s": 338956,
"text": "A project to be considered successful requires proper planning and the help from the management. Exceeding customer requirements will bring about success to the project."
},
{
"code": null,
"e": 339261,
"s": 339126,
"text": "Understanding the business drivers and ensuring that the project meets the objectives of the business will also contribute to success."
},
{
"code": null,
"e": 339426,
"s": 339261,
"text": "Aligning the key performance indicator to that of the business objective will not only help project managers to keep track but also measure and improve performance."
},
{
"code": null,
"e": 339513,
"s": 339426,
"text": "Time is a terrible resource to waste. This is the most valuable resource in a project."
},
{
"code": null,
"e": 339655,
"s": 339513,
"text": "Every delivery that you are supposed to make is time-bound. Therefore, without proper time management, a project can head towards a disaster."
},
{
"code": null,
"e": 339796,
"s": 339655,
"text": "When it comes to project time management, it is not just the time of the project manager, but it is the time management of the project team."
},
{
"code": null,
"e": 340000,
"s": 339796,
"text": "Scheduling is the easiest way of managing project time. In this approach, the activities of the project are estimated and the durations are determined based on the resource utilization for each activity."
},
{
"code": null,
"e": 340173,
"s": 340000,
"text": "In addition to the estimate and resource allocation, cost always plays a vital role in time management. This is due to the fact that schedule over-runs are quite expensive."
},
{
"code": null,
"e": 340306,
"s": 340173,
"text": "Following are the main steps in the project time management process. Each addresses a distinct area of time management in a project."
},
{
"code": null,
"e": 340482,
"s": 340306,
"text": "When it comes to a project, there are a few levels for identifying activities. First of all, the high-level requirements are broken down into high-level tasks or deliverables."
},
{
"code": null,
"e": 340646,
"s": 340482,
"text": "Then, based on the task granularity, the high-level tasks/deliverables are broken down into activities and presented in the form of WBS (Work Breakdown Structure)."
},
{
"code": null,
"e": 340830,
"s": 340646,
"text": "In order to manage the project time, it is critical to identify the activity sequence. The activities identified in the previous step should be sequenced based on the execution order."
},
{
"code": null,
"e": 340901,
"s": 340830,
"text": "When sequencing, the activity interdependencies should be considered. "
},
{
"code": null,
"e": 341084,
"s": 340901,
"text": "The estimation of amount and the types of resources required for activities is done in this step. Depending on the number of resources allocated for an activity, its duration varies."
},
{
"code": null,
"e": 341236,
"s": 341084,
"text": "Therefore, the project management team should have a clear understanding about the resources allocation in order to accurately manage the project time."
},
{
"code": null,
"e": 341403,
"s": 341236,
"text": "This is one of the key steps in the project planning process. Since estimates are all about the time (duration), this step should be completed with a higher accuracy."
},
{
"code": null,
"e": 341515,
"s": 341403,
"text": "For this step, there are many estimation mechanisms in place, so your project should select an appropriate one."
},
{
"code": null,
"e": 341621,
"s": 341515,
"text": "Most of the companies follow either WBS based estimating or Function Points based estimates in this step."
},
{
"code": null,
"e": 341827,
"s": 341621,
"text": "Once the activity estimates are completed, critical path of the project should be identified in order to determine the total project duration. This is one of the key inputs for the project time management."
},
{
"code": null,
"e": 341923,
"s": 341827,
"text": "In order to create an accurate schedule, a few parameters from the previous steps are required."
},
{
"code": null,
"e": 342059,
"s": 341923,
"text": "Activity sequence, duration of each activity and the resource requirements/allocation for each activity are the most important factors."
},
{
"code": null,
"e": 342299,
"s": 342059,
"text": "In case if you perform this step manually, you may end up wasting a lot of valuable project planning time. There are many software packages, such as Microsoft Project, that will assist you to develop reliable and accurate project schedule."
},
{
"code": null,
"e": 342419,
"s": 342299,
"text": "As part of the schedule, you will develop a Gantt chart in order to visually monitor the activities and the milestones."
},
{
"code": null,
"e": 342600,
"s": 342419,
"text": "No project in the practical world can be executed without changes to the original schedule. Therefore, it is essential for you to update your project schedule with ongoing changes."
},
{
"code": null,
"e": 342746,
"s": 342600,
"text": "Time management is a key responsibility of a project manager. The project manager should equip with a strong skill and sense for time management."
},
{
"code": null,
"e": 342870,
"s": 342746,
"text": "There are a number of time management techniques that have been integrated into the management theories and best practices."
},
{
"code": null,
"e": 342966,
"s": 342870,
"text": "As an example, Agile/Scrum project management style has its own techniques for time management."
},
{
"code": null,
"e": 343148,
"s": 342966,
"text": "In addition, if you are keen on learning time management into greater depths, you can always get into a training course of one of the reputed and respected time management trainers."
},
{
"code": null,
"e": 343352,
"s": 343148,
"text": "There are many logistic elements in a project. Different team members are responsible for managing each element and sometimes, the organization may have a mechanism to manage some logistic areas as well."
},
{
"code": null,
"e": 343641,
"s": 343352,
"text": "When it comes to project workforce management, it is all about managing all the logistic aspects of a project or an organization through a software application. Usually, this software has a workflow engine defined in them. So, all the logistic processes take place in the workflow engine."
},
{
"code": null,
"e": 343777,
"s": 343641,
"text": "Following are the regular and most common types of tasks handled by project workforce management software or a similar workflow engine:"
},
{
"code": null,
"e": 343839,
"s": 343777,
"text": "Planning and monitoring the project schedules and milestones."
},
{
"code": null,
"e": 343901,
"s": 343839,
"text": "Planning and monitoring the project schedules and milestones."
},
{
"code": null,
"e": 343952,
"s": 343901,
"text": "Tracking the cost and revenue aspects of projects."
},
{
"code": null,
"e": 344003,
"s": 343952,
"text": "Tracking the cost and revenue aspects of projects."
},
{
"code": null,
"e": 344040,
"s": 344003,
"text": "Resource utilization and monitoring."
},
{
"code": null,
"e": 344077,
"s": 344040,
"text": "Resource utilization and monitoring."
},
{
"code": null,
"e": 344129,
"s": 344077,
"text": "Other management aspects of the project management."
},
{
"code": null,
"e": 344181,
"s": 344129,
"text": "Other management aspects of the project management."
},
{
"code": null,
"e": 344417,
"s": 344181,
"text": "Due to the software use, all of the project workflow management tasks can be fully automated with leaving much for the project managers. This returns high efficiency to the project management when it comes to project tracking purposes."
},
{
"code": null,
"e": 344653,
"s": 344417,
"text": "In addition to different tracking mechanisms, project workforce management software also offer a dashboard for the project team. Through the dashboard, the project team has a glance view of the overall progress of the project elements."
},
{
"code": null,
"e": 344779,
"s": 344653,
"text": "The dashboard is also a great place for the upper management to track the progress of each project during executive meetings."
},
{
"code": null,
"e": 345017,
"s": 344779,
"text": "Most of the times, project workforce management software can work with the existing legacy software systems such as ERP systems. This easy integration allows the organization use a combination of software systems for management purposes."
},
{
"code": null,
"e": 345238,
"s": 345017,
"text": "The traditional management and the project workflow management have significant differences. There are at least three main differences when it comes to operations and management. Following are the three main differences:"
},
{
"code": null,
"e": 345417,
"s": 345238,
"text": "The management of all the processes is done through a graphical workflow engine. In this, the users can design, control and audit the different processes involved in the project."
},
{
"code": null,
"e": 345554,
"s": 345417,
"text": "The graphical workflow is quite attractive for the users of the system and allows the users to have a clear idea of the workflow engine."
},
{
"code": null,
"e": 345737,
"s": 345554,
"text": "Project workforce management provides the facility for work breakdown structure and organization of the same. The users can create, manage, edit and report work breakdown structures."
},
{
"code": null,
"e": 345875,
"s": 345737,
"text": "These work breakdown structures are done in different abstraction levels, so the information related to such can be tracked at any level."
},
{
"code": null,
"e": 346179,
"s": 345875,
"text": "Usually, project workforce management has approval hierarchies. Therefore, each workflow created will go through several verifications before it becomes an organizational or project standard. This helps the organization to reduce the inefficiencies of the process, as it is audited by many stakeholders."
},
{
"code": null,
"e": 346402,
"s": 346179,
"text": "In project workforce management software, everything is neatly connected. Once workforce and billing management software are integrated, it provides the organization all the necessary information and management facilities."
},
{
"code": null,
"e": 346594,
"s": 346402,
"text": "Due to the integrated nature of all these processes, the management and tracking functions are centralized. This allows the higher management to have a unified view of the project activities."
},
{
"code": null,
"e": 346800,
"s": 346594,
"text": "Project workflow management is one of the best methods for managing different aspects of project. If the project is complex, then the outcomes from the project workforce management could be more effective."
},
{
"code": null,
"e": 347029,
"s": 346800,
"text": "For simple projects or small organizations, project workflow management may not add much value. This is due to the fact that small organizations or projects do not have a significant overhead when it comes to managing processes."
},
{
"code": null,
"e": 347192,
"s": 347029,
"text": "There are many software systems in the market for project workflow management, but in many cases, organizations are too unique to adopt such ready-made solutions."
},
{
"code": null,
"e": 347442,
"s": 347192,
"text": "Therefore, organization gets software development companies to develop custom project workflow management systems for them. This has proved to be the most suitable way of getting the best project workforce management system acquired for the company."
},
{
"code": null,
"e": 347799,
"s": 347442,
"text": "Since the project management is one of the core functions of a business organization, the project management function should be supported by software. Before software was born, project management was fully done through papers. This eventually produced a lot of paper documents and searching through them for information which was not a pleasant experience."
},
{
"code": null,
"e": 348090,
"s": 347799,
"text": "Once software came available for an affordable cost for the business organizations, software development companies started developing project management software. This became quite popular among all the industries and these software were quickly adopted by the project management community."
},
{
"code": null,
"e": 348430,
"s": 348090,
"text": "There are two types of project management software available for project managers. The first category of such software is the desktop software. Microsoft Project is a good example for this type. You can manage your entire project using MS Project, but you need to share the electronic documents with others, when collaboration is required."
},
{
"code": null,
"e": 348650,
"s": 348430,
"text": "All the updates should be done to the same document by relevant parties time to time. Therefore, such desktop project management software has limitations when it should be updated and maintained by more than one person."
},
{
"code": null,
"e": 348869,
"s": 348650,
"text": "As a solution for the above issue, the web-based project management software was introduced. With this type, the users can access the web application and read, write or change the project management-related activities."
},
{
"code": null,
"e": 349133,
"s": 348869,
"text": "This was a good solution for distributed projects across departments and geographies. This way, all the stakeholders of the project have access to project details at any given time. Specially, this model is the best for virtual teams that operate on the Internet."
},
{
"code": null,
"e": 349313,
"s": 349133,
"text": "When it comes to choosing project management software, there are many things to consider. Not all the projects may utilize all the features offered by project management software."
},
{
"code": null,
"e": 349504,
"s": 349313,
"text": "Therefore, you should have a good understanding of your project requirements before attempting to select one for you. Following are the most important aspects of project management software:"
},
{
"code": null,
"e": 349716,
"s": 349504,
"text": "The project management software should facilitate the team collaboration. This means that the relevant stakeholders of the project should be able to access and update the project documents whenever they want to."
},
{
"code": null,
"e": 349877,
"s": 349716,
"text": "Therefore, the project management software should have access control and authentication management in order to grand access levels to the project stakeholders."
},
{
"code": null,
"e": 350096,
"s": 349877,
"text": "Scheduling is one of the main features that should be provided by project management software. Usually, modern project management software provides the ability to draw Gantt charts when it comes to activity scheduling."
},
{
"code": null,
"e": 350287,
"s": 350096,
"text": "In addition to this, activity dependencies can also be added to the schedules, so such software will show you the project critical path and later changes to the critical path automatically. "
},
{
"code": null,
"e": 350433,
"s": 350287,
"text": "Baselining is also a useful feature offered by project management software. Usually, a project is basedlined when the requirements are finalized."
},
{
"code": null,
"e": 350663,
"s": 350433,
"text": "When requirements are changed and new requirements are added to the project later, project management team can compare the new schedule with the baseline schedule automatically to understand the project scope and cost deviations."
},
{
"code": null,
"e": 350838,
"s": 350663,
"text": "During the project life cycle, there can be many issues related to project that needs constant tracking and monitoring. Software defects is one of the good examples for this."
},
{
"code": null,
"e": 350983,
"s": 350838,
"text": "Therefore, the project management software should have features to track and monitor the issues reported by various stakeholders of the project."
},
{
"code": null,
"e": 351229,
"s": 350983,
"text": "Project portfolio management is one of the key aspects when an organization has engaged in more than one project. The organization should be able measure and monitor multiple projects, so the organization knows how the projects progress overall."
},
{
"code": null,
"e": 351468,
"s": 351229,
"text": "If you are a small company with only a couple of projects, you may not want this feature. In such case, you should select project management software without project portfolio management, as such features could be quite expensive for you."
},
{
"code": null,
"e": 351708,
"s": 351468,
"text": "A project has many documents in use. Most of these documents should be accessible to the stakeholders of the project. Therefore, the project management software should have a document management facility with correct access control system."
},
{
"code": null,
"e": 351874,
"s": 351708,
"text": "In addition to this, documents need to be versioned whenever they are updated. Therefore, the document management feature should support document versioning as well."
},
{
"code": null,
"e": 352026,
"s": 351874,
"text": "Resource management of the project is one of the key expectations from project management software. This includes both human resources and other types."
},
{
"code": null,
"e": 352145,
"s": 352026,
"text": "The project management software should show the utilization of each resource throughout the entire project life cycle."
},
{
"code": null,
"e": 352355,
"s": 352145,
"text": "Modern project management practice requires the assistance of project management software. The modern project management practice is complicated to an extent that it cannot operate without the use of software."
},
{
"code": null,
"e": 352533,
"s": 352355,
"text": "When choosing the correct project management software for your purpose, you need to evaluate the characteristics of software and match with your project management requirements."
},
{
"code": null,
"e": 352764,
"s": 352533,
"text": "Never choose one with more feature than you require, as usually project management software come with a high price tag. In addition, having more than the required features could make confusions when using the software in practice."
},
{
"code": null,
"e": 352953,
"s": 352764,
"text": "Quality is an important factor when it comes to any product or service. With the high market competition, quality has become the market differentiator for almost all products and services."
},
{
"code": null,
"e": 353082,
"s": 352953,
"text": "Therefore, all manufacturers and service providers out there constantly look for enhancing their product or the service quality."
},
{
"code": null,
"e": 353368,
"s": 353082,
"text": "In order to maintain or enhance the quality of the offerings, manufacturers use two techniques, quality control and quality assurance. These two practices make sure that the end product or the service meets the quality requirements and standards defined for the product or the service."
},
{
"code": null,
"e": 353605,
"s": 353368,
"text": "There are many methods followed by organizations to achieve and maintain required level of quality. Some organizations believe in the concepts of Total Quality Management (TQM) and some others believe in internal and external standards."
},
{
"code": null,
"e": 353775,
"s": 353605,
"text": "The standards usually define the processes and procedures for organizational activities and assist to maintain the quality in every aspect of organizational functioning."
},
{
"code": null,
"e": 353962,
"s": 353775,
"text": "When it comes to standards for quality, there are many. ISO (International Standards Organization) is one of the prominent bodies for defining quality standards for different industries."
},
{
"code": null,
"e": 354135,
"s": 353962,
"text": "Therefore, many organizations try to adhere to the quality requirements of ISO. In addition to that, there are many other standards that are specific to various industries."
},
{
"code": null,
"e": 354227,
"s": 354135,
"text": "As an example, SEI-CMMi is one such standard followed in the field of software development."
},
{
"code": null,
"e": 354417,
"s": 354227,
"text": "Since standards have become a symbol for products and service quality, the customers are now keen on buying their product or the service from a certified manufacturer or a service provider."
},
{
"code": null,
"e": 354531,
"s": 354417,
"text": "Therefore, complying with standards such as ISO has become a necessity when it comes to attracting the customers."
},
{
"code": null,
"e": 354674,
"s": 354531,
"text": "Many people get confused between quality control (QC) and quality assurance (QA). Let's take a look at quality control function in high-level."
},
{
"code": null,
"e": 354906,
"s": 354674,
"text": "As we have already discussed, organizations can define their own internal quality standards, processes and procedures; the organization will develop these over time and then relevant stakeholders will be required to adhere by them."
},
{
"code": null,
"e": 355090,
"s": 354906,
"text": "The process of making sure that the stakeholders are adhered to the defined standards and procedures is called quality control. In quality control, a verification process takes place."
},
{
"code": null,
"e": 355180,
"s": 355090,
"text": "Certain activities and products are verified against a defined set of rules or standards."
},
{
"code": null,
"e": 355335,
"s": 355180,
"text": "Every organization that practices QC needs to have a Quality Manual. The quality manual outlines the quality focus and the objectives in the organization."
},
{
"code": null,
"e": 355543,
"s": 355335,
"text": "The quality manual gives the quality guidance to different departments and functions. Therefore, everyone in the organization needs to be aware of his or her responsibilities mentioned in the quality manual."
},
{
"code": null,
"e": 355710,
"s": 355543,
"text": "Quality Assurance is a broad practice used for assuring the quality of products or services. There are many differences between quality control and quality assurance."
},
{
"code": null,
"e": 355812,
"s": 355710,
"text": "In quality assurance, a constant effort is made to enhance the quality practices in the organization."
},
{
"code": null,
"e": 355965,
"s": 355812,
"text": "Therefore, continuous improvements are expected in quality functions in the company. For this, there is a dedicated quality assurance team commissioned."
},
{
"code": null,
"e": 356123,
"s": 355965,
"text": "Sometimes, in larger organizations, a 'Process' team is also allocated for enhancing the processes and procedures in addition to the quality assurance team. "
},
{
"code": null,
"e": 356287,
"s": 356123,
"text": "Quality assurance team of the organization has many responsibilities. First and foremost responsibility is to define a process for achieving and improving quality."
},
{
"code": null,
"e": 356503,
"s": 356287,
"text": "Some organizations come up with their own process and others adopt a standard processes such as ISO or CMMi. Processes such as CMMi allow the organizations to define their own internal processes and adhere by them. "
},
{
"code": null,
"e": 356684,
"s": 356503,
"text": "Quality assurance function of an organization uses a number of tools for enhancing the quality practices. These tools vary from simple techniques to sophisticated software systems."
},
{
"code": null,
"e": 356890,
"s": 356684,
"text": "The quality assurance professionals also should go through formal industrial trainings and get them certified. This is especially applicable for quality assurance functions in software development houses. "
},
{
"code": null,
"e": 357004,
"s": 356890,
"text": "Since quality is a relative term, there is plenty of opportunity to enhance the quality of products and services."
},
{
"code": null,
"e": 357202,
"s": 357004,
"text": "The quality assurance teams of organizations constantly work to enhance the existing quality of products and services by optimizing the existing production processes and introducing new processes. "
},
{
"code": null,
"e": 357367,
"s": 357202,
"text": "When it comes to our focus, we understand that quality control is a product-oriented process. When it comes to quality assurance, it is a process-oriented practice."
},
{
"code": null,
"e": 357548,
"s": 357367,
"text": "When quality control makes sure the end product meets the quality requirements, quality assurance makes sure that the process of manufacturing the product does adhere to standards."
},
{
"code": null,
"e": 357677,
"s": 357548,
"text": "Therefore, quality assurance can be identified as a proactive process, while quality control can be noted as a reactive process."
},
{
"code": null,
"e": 357914,
"s": 357677,
"text": "RACI denotes Responsible, Accountable, Consulted and Informed, which are four parameters used in a matrix used in decision making. RACI chart tool outlines the activities undertaken within an organization to that of the people or roles."
},
{
"code": null,
"e": 358056,
"s": 357914,
"text": "In an organization, people can be allocated or assigned to specific roles for which they are responsible, accountable, consulted or informed."
},
{
"code": null,
"e": 358294,
"s": 358056,
"text": "RACI chart tool is a great tool when it comes to identifying employee roles within an organization. This tool can be successfully used when there is role confusion within the company. Role confusion may lead to unproductive work culture."
},
{
"code": null,
"e": 358440,
"s": 358294,
"text": "RACI chart tool represents four parameters as we have already noted in the Introduction. Following are the meanings for each of these parameters:"
},
{
"code": null,
"e": 358539,
"s": 358440,
"text": "Responsible: This is a person, who performs a task or work and he/she is responsible for the work."
},
{
"code": null,
"e": 358638,
"s": 358539,
"text": "Responsible: This is a person, who performs a task or work and he/she is responsible for the work."
},
{
"code": null,
"e": 358703,
"s": 358638,
"text": "Accountable: Primarily the person in charge of the task or work."
},
{
"code": null,
"e": 358768,
"s": 358703,
"text": "Accountable: Primarily the person in charge of the task or work."
},
{
"code": null,
"e": 358840,
"s": 358768,
"text": "Consulted: Person, who gives feedback, contribute as and when required."
},
{
"code": null,
"e": 358912,
"s": 358840,
"text": "Consulted: Person, who gives feedback, contribute as and when required."
},
{
"code": null,
"e": 358987,
"s": 358912,
"text": "Informed: Person in charge who needs to know the action or decision taken."
},
{
"code": null,
"e": 359062,
"s": 358987,
"text": "Informed: Person in charge who needs to know the action or decision taken."
},
{
"code": null,
"e": 359145,
"s": 359062,
"text": "Following are the well-noted benefits of this tool for the business organizations:"
},
{
"code": null,
"e": 359231,
"s": 359145,
"text": "Identifying the workload that have been assigned to specific employees or departments"
},
{
"code": null,
"e": 359317,
"s": 359231,
"text": "Identifying the workload that have been assigned to specific employees or departments"
},
{
"code": null,
"e": 359367,
"s": 359317,
"text": "Making sure that the processes are not overlooked"
},
{
"code": null,
"e": 359417,
"s": 359367,
"text": "Making sure that the processes are not overlooked"
},
{
"code": null,
"e": 359494,
"s": 359417,
"text": "Ensuring that new recruits are explained of their roles and responsibilities"
},
{
"code": null,
"e": 359571,
"s": 359494,
"text": "Ensuring that new recruits are explained of their roles and responsibilities"
},
{
"code": null,
"e": 359643,
"s": 359571,
"text": "Finding the right balance between the line and project responsibilities"
},
{
"code": null,
"e": 359715,
"s": 359643,
"text": "Finding the right balance between the line and project responsibilities"
},
{
"code": null,
"e": 359778,
"s": 359715,
"text": "Redistributing work between groups to get the work done faster"
},
{
"code": null,
"e": 359841,
"s": 359778,
"text": "Redistributing work between groups to get the work done faster"
},
{
"code": null,
"e": 359885,
"s": 359841,
"text": "Open to resolving conflicts and discussions"
},
{
"code": null,
"e": 359929,
"s": 359885,
"text": "Open to resolving conflicts and discussions"
},
{
"code": null,
"e": 360010,
"s": 359929,
"text": "Documenting the roles and responsibilities of the people within the organization"
},
{
"code": null,
"e": 360091,
"s": 360010,
"text": "Documenting the roles and responsibilities of the people within the organization"
},
{
"code": null,
"e": 360325,
"s": 360091,
"text": "Identifying key functions and processes within an organization is the first step towards using the RACI chart tool. Then, the organization needs to outline the activities that take place and should avoid any miscellaneous activities."
},
{
"code": null,
"e": 360385,
"s": 360325,
"text": "Following are the detailed steps for using RACI chart tool:"
},
{
"code": null,
"e": 360429,
"s": 360385,
"text": "Explain each activity that had taken place."
},
{
"code": null,
"e": 360473,
"s": 360429,
"text": "Explain each activity that had taken place."
},
{
"code": null,
"e": 360533,
"s": 360473,
"text": "Create phrases to indicate the result of the decision made."
},
{
"code": null,
"e": 360593,
"s": 360533,
"text": "Create phrases to indicate the result of the decision made."
},
{
"code": null,
"e": 360683,
"s": 360593,
"text": "Decisions and activities need to be applied to the role rather than targeting the person."
},
{
"code": null,
"e": 360773,
"s": 360683,
"text": "Decisions and activities need to be applied to the role rather than targeting the person."
},
{
"code": null,
"e": 360865,
"s": 360773,
"text": "Create a matrix, which represents the roles and activities and enter the RACI Code created."
},
{
"code": null,
"e": 360957,
"s": 360865,
"text": "Create a matrix, which represents the roles and activities and enter the RACI Code created."
},
{
"code": null,
"e": 361078,
"s": 360957,
"text": "Once all the relevant data have been collated and input onto the RACI chart tool, any discrepancies need to be resolved."
},
{
"code": null,
"e": 361197,
"s": 361078,
"text": "The primary reason for creating a RACI chart tool is to resolve organizational issues. It looks at three main factors:"
},
{
"code": null,
"e": 361274,
"s": 361197,
"text": "Role conception: The attitude or thinking of people towards their work roles"
},
{
"code": null,
"e": 361351,
"s": 361274,
"text": "Role conception: The attitude or thinking of people towards their work roles"
},
{
"code": null,
"e": 361440,
"s": 361351,
"text": "Role expectation: The expectation of a person with regards to another person's job role."
},
{
"code": null,
"e": 361529,
"s": 361440,
"text": "Role expectation: The expectation of a person with regards to another person's job role."
},
{
"code": null,
"e": 361592,
"s": 361529,
"text": "Role behavior: The activities of people in their job function."
},
{
"code": null,
"e": 361655,
"s": 361592,
"text": "Role behavior: The activities of people in their job function."
},
{
"code": null,
"e": 361765,
"s": 361655,
"text": "These three concepts help management to identify the misconceptions that people have towards their job roles."
},
{
"code": null,
"e": 361976,
"s": 361765,
"text": "Although role confusion can be solved using RACI chart tool, it is always a good idea to identify the reasons behind such confusion. This helps the organization to avoid such situations occurring in the future."
},
{
"code": null,
"e": 362030,
"s": 361976,
"text": "Following are some of the reasons for role confusion:"
},
{
"code": null,
"e": 362055,
"s": 362030,
"text": "Improper balance of work"
},
{
"code": null,
"e": 362080,
"s": 362055,
"text": "Improper balance of work"
},
{
"code": null,
"e": 362090,
"s": 362080,
"text": "Idle time"
},
{
"code": null,
"e": 362100,
"s": 362090,
"text": "Idle time"
},
{
"code": null,
"e": 362141,
"s": 362100,
"text": "Passing on the ball, being irresponsible"
},
{
"code": null,
"e": 362182,
"s": 362141,
"text": "Passing on the ball, being irresponsible"
},
{
"code": null,
"e": 362221,
"s": 362182,
"text": "Confused as to who makes the decisions"
},
{
"code": null,
"e": 362260,
"s": 362221,
"text": "Confused as to who makes the decisions"
},
{
"code": null,
"e": 362287,
"s": 362260,
"text": "Ineffective communications"
},
{
"code": null,
"e": 362314,
"s": 362287,
"text": "Ineffective communications"
},
{
"code": null,
"e": 362328,
"s": 362314,
"text": "De-motivation"
},
{
"code": null,
"e": 362342,
"s": 362328,
"text": "De-motivation"
},
{
"code": null,
"e": 362408,
"s": 362342,
"text": "Filling idle time by creating and attending to non-essential time"
},
{
"code": null,
"e": 362474,
"s": 362408,
"text": "Filling idle time by creating and attending to non-essential time"
},
{
"code": null,
"e": 362518,
"s": 362474,
"text": "Don't care since no one's bothered attitude"
},
{
"code": null,
"e": 362562,
"s": 362518,
"text": "Don't care since no one's bothered attitude"
},
{
"code": null,
"e": 362635,
"s": 362562,
"text": "RACI chart tool can be successfully used under the following conditions."
},
{
"code": null,
"e": 362736,
"s": 362635,
"text": "For employees to get a clear understanding of the role and responsibilities around the work process."
},
{
"code": null,
"e": 362837,
"s": 362736,
"text": "For employees to get a clear understanding of the role and responsibilities around the work process."
},
{
"code": null,
"e": 362944,
"s": 362837,
"text": "To improve the understanding of function between departments and responsibilities within one's department."
},
{
"code": null,
"e": 363051,
"s": 362944,
"text": "To improve the understanding of function between departments and responsibilities within one's department."
},
{
"code": null,
"e": 363147,
"s": 363051,
"text": "To clearly define the roles and responsibilities of team members, who are working on a project."
},
{
"code": null,
"e": 363243,
"s": 363147,
"text": "To clearly define the roles and responsibilities of team members, who are working on a project."
},
{
"code": null,
"e": 363480,
"s": 363243,
"text": "The first step towards designing RACI chart tool is that the management needs to identify the process or function that faces issues. The process or feature needs to be thoroughly investigated in terms of its requirements and objectives."
},
{
"code": null,
"e": 363717,
"s": 363480,
"text": "The first step towards designing RACI chart tool is that the management needs to identify the process or function that faces issues. The process or feature needs to be thoroughly investigated in terms of its requirements and objectives."
},
{
"code": null,
"e": 363851,
"s": 363717,
"text": "The roles or job functions need to be identified in terms as to which ones will be impacted and who will be implementing the changes."
},
{
"code": null,
"e": 363985,
"s": 363851,
"text": "The roles or job functions need to be identified in terms as to which ones will be impacted and who will be implementing the changes."
},
{
"code": null,
"e": 364088,
"s": 363985,
"text": "The roles to be created will have its owner. The management needs to assign a role to each individual."
},
{
"code": null,
"e": 364191,
"s": 364088,
"text": "The roles to be created will have its owner. The management needs to assign a role to each individual."
},
{
"code": null,
"e": 364390,
"s": 364191,
"text": "Identify who has an R role (responsible) and then it needs to be listed in terms of A, C and I. RACI chart tools do not work in a way that two people will be held responsible (R) for the same thing."
},
{
"code": null,
"e": 364589,
"s": 364390,
"text": "Identify who has an R role (responsible) and then it needs to be listed in terms of A, C and I. RACI chart tools do not work in a way that two people will be held responsible (R) for the same thing."
},
{
"code": null,
"e": 364666,
"s": 364589,
"text": "Review needs to be conducted so that there are no duplicates in the process."
},
{
"code": null,
"e": 364743,
"s": 364666,
"text": "Review needs to be conducted so that there are no duplicates in the process."
},
{
"code": null,
"e": 364920,
"s": 364743,
"text": "RACI chart tool is a useful and effective decision making tool that helps to define roles and responsibilities. This is used to identify inefficiencies of organizational roles."
},
{
"code": null,
"e": 365016,
"s": 364920,
"text": "It helps to resolve any functional issues that arise within departments or between individuals."
},
{
"code": null,
"e": 365223,
"s": 365016,
"text": "The main objective of RACI chart tool is to eliminate role confusions and to be able to deliver the product or service successfully to the customer and contribute to the long-term organizational objectives."
},
{
"code": null,
"e": 365339,
"s": 365223,
"text": "Rewards and recognition are considered powerful tools, which are used by an organization to motivate its employees."
},
{
"code": null,
"e": 365452,
"s": 365339,
"text": "Rewards and recognition are remuneration based systems, which include bonus, perks, allowances and certificates."
},
{
"code": null,
"e": 365611,
"s": 365452,
"text": "Often people are under the impression that companies only offer remuneration-based systems and not recognize the employees' performance. This is not the case."
},
{
"code": null,
"e": 365733,
"s": 365611,
"text": "In an organization, you will find following systems in place to boost motivation in addition to the regular compensation."
},
{
"code": null,
"e": 365750,
"s": 365733,
"text": "Remuneration pay"
},
{
"code": null,
"e": 365767,
"s": 365750,
"text": "Remuneration pay"
},
{
"code": null,
"e": 365789,
"s": 365767,
"text": "Nonfinancial benefits"
},
{
"code": null,
"e": 365811,
"s": 365789,
"text": "Nonfinancial benefits"
},
{
"code": null,
"e": 365825,
"s": 365811,
"text": "Share options"
},
{
"code": null,
"e": 365839,
"s": 365825,
"text": "Share options"
},
{
"code": null,
"e": 366106,
"s": 365839,
"text": "Following are the common methods of rewards that can be found in modern business organizations. Although not all these reward methods are used by the same company, the companies can adopt the best reward methods that suit the company culture and other company goals."
},
{
"code": null,
"e": 366320,
"s": 366106,
"text": "As an example, some companies do like to give all the benefits to the employees as financials, while other companies like giving the employees the other benefits such as insurance, better working environment, etc."
},
{
"code": null,
"e": 366578,
"s": 366320,
"text": "Pay is an essential factor, which is closely related to job satisfaction and motivation. Although pay may not be a reward as this is a static amount, which an employee will be paid every month, it will be considered as a reward if similar work is paid less."
},
{
"code": null,
"e": 366767,
"s": 366578,
"text": "This is similar to that of overtime. However, it is paid to employees if they put in an extra hour of work for working at unsocial hours or for working long hours on top of overtime hours."
},
{
"code": null,
"e": 367010,
"s": 366767,
"text": "Many organizations pay commission to sales staff based on the sales that they have generated. The commission is based on the number of successful sales and the total business revenue that they have made. This is a popular method of incentive."
},
{
"code": null,
"e": 367161,
"s": 367010,
"text": "Bonuses will be paid to employees, who meet their targets and objectives. This is aimed at employees to improve their performance and to work harder."
},
{
"code": null,
"e": 367328,
"s": 367161,
"text": "This is typically paid to employees, who have met or exceeded their targets and objectives. This method of reward can be measured at either team or department level."
},
{
"code": null,
"e": 367596,
"s": 367328,
"text": "Profits related pay is associated with if an organization is incurring a profit situation. If the organization is getting more than the expected profits, then employees receive an additional amount of money that has been defined as a variable component of the salary."
},
{
"code": null,
"e": 367742,
"s": 367596,
"text": "This is very similar to that of profit related pay. This reward is based on the number of sales and total revenue generated by the organization."
},
{
"code": null,
"e": 367955,
"s": 367742,
"text": "Piece rate reward is directly related to output. The employees get paid on the number of 'pieces' that they have produced. These pieces will be closely inspected to make sure that quality standards are being met."
},
{
"code": null,
"e": 368098,
"s": 367955,
"text": "Employees will not always be motivated by monetary value alone. They do require recognition to be motivated and to perform well in their work."
},
{
"code": null,
"e": 368291,
"s": 368098,
"text": "This is a common type of recognition that is aimed at employees to get motivated. Job enrichment allows more challenging tasks to be included in the day-to-day tasks performed by the employee."
},
{
"code": null,
"e": 368438,
"s": 368291,
"text": "Working the same way everyday may prove to be monotonous to the employees. Therefore, there will be a lack of interest and the performance drops. "
},
{
"code": null,
"e": 368596,
"s": 368438,
"text": "Unlike job enrichment, job rotation refers to shifting employees between different functions. This will give them more experience and a sense of achievement."
},
{
"code": null,
"e": 368778,
"s": 368596,
"text": "Teamwork is also considered as recognition. Creating teamwork between team members will improve performance at work. Social relationships at work are essential for any organization."
},
{
"code": null,
"e": 368899,
"s": 368778,
"text": "Healthy social relationships are considered as recognition to the employees. This improves their morale and performance."
},
{
"code": null,
"e": 369058,
"s": 368899,
"text": "Empowerment refers to when employees are given authority to make certain decisions. This decision making authority is restricted only to the day-to-day tasks."
},
{
"code": null,
"e": 369315,
"s": 369058,
"text": "By giving employees authority and power can lead to wrong decisions to be made which will cost the company. Empowerment will not relate to day-to-day functioning authority. This will make employees more responsible, vigilant and increase their performance."
},
{
"code": null,
"e": 369500,
"s": 369315,
"text": "Many organizations place a greater emphasis on training. This is considered as recognition for employees. Training could vary from on the job training to personal development training."
},
{
"code": null,
"e": 369669,
"s": 369500,
"text": "Training workshops such as train the trainer or how to become a manager will give employees a chance to switch job roles and this will increase their motivation levels."
},
{
"code": null,
"e": 369904,
"s": 369669,
"text": "This again is an important type of recognition that is given to employees, who perform better. Organizations have introduced award systems such as best performer of the month, etc., and all these will lead employees to perform better."
},
{
"code": null,
"e": 370069,
"s": 369904,
"text": "Rewards and recognitions are equally important when trying to promote performance and morale amongst employees. The above methods can be used to motivate employees."
},
{
"code": null,
"e": 370236,
"s": 370069,
"text": "Since all the methods may not be applicable to the same organization, the organizations should make sure that they choose the best rewards that suit the organization."
},
{
"code": null,
"e": 370440,
"s": 370236,
"text": "When it comes to any type of project, requirement collection plays a key role. Requirements collection is not only important for the project, but it is also important for the project management function."
},
{
"code": null,
"e": 370708,
"s": 370440,
"text": "For the project, understanding what the project will eventually deliver is critical for its success. Through requirements, the project management can determine the end deliveries of the project and how the end deliveries should address client's specific requirements."
},
{
"code": null,
"e": 371035,
"s": 370708,
"text": "Although requirements collection looks quite straightforward; surprisingly, this is one of the project phases where most of the projects start with the wrong foot. In general, majority of the failed projects have failed due to the wrong or insufficient requirements gathering. We will discuss on this in the following section."
},
{
"code": null,
"e": 371129,
"s": 371035,
"text": "Following is an illustration indicating where the requirements collection comes in a project:"
},
{
"code": null,
"e": 371521,
"s": 371129,
"text": "Let's take a software development project as an example. Once the project initiation is over, the business analyst team is in a hurry to collect requirements. The BA (business analysts) team use various methods to capture project requirements and then pass the requirements to the project team. Once business requirements are converted into technical requirements, the implementation starts."
},
{
"code": null,
"e": 371874,
"s": 371521,
"text": "Although the above cycle looks quite normal and trouble-free, the reality is somewhat different. In most of the cases, the BA team is unable to capture all the requirements related to the project. They always overlook a portion of requirements. During the construction of the project, usually the client recognizes the requirements gaps of the project."
},
{
"code": null,
"e": 372317,
"s": 371874,
"text": "The project team will have to implement these missing requirements with no additional client payments or with client approved change requests. In case if it was BA team's fault, the service provider may have to absorb the cost for implementing the missing requirements. In such instances, if the effort for missing requirements has a significant impact on the cost of the project, the project may be a financial loss for the service provider."
},
{
"code": null,
"e": 372408,
"s": 372317,
"text": "Therefore, the requirement collection process is the most important phase of any project. "
},
{
"code": null,
"e": 372604,
"s": 372408,
"text": "For the purpose of requirements collection, there are a few methods used by the business analysts. These methods usually differ from one project to another and one client organization to another."
},
{
"code": null,
"e": 372943,
"s": 372604,
"text": "Usually requirements for a new system are gathered from the potential end-users of the system. The methods used for gathering requirements from these potential end-users vary depending on the nature of the end-users. As an example, if there is a large number of end-users, then the workshop method can be used for requirements collection."
},
{
"code": null,
"e": 373242,
"s": 372943,
"text": "In this method, all the potential end-users are asked to participate for a workshop. In this workshop, the business analysts do engage with the users and collect the requirements for the new system. Sometimes, the workshop session is video recorded in order to review and capture any user feedback."
},
{
"code": null,
"e": 373508,
"s": 373242,
"text": "If the user base is quite small in number, the business analysts can carry out face-to-face interviews. This is the most effective way of finding all the necessary requirements as the business analyst can have all their questions asked and cross questioned as well."
},
{
"code": null,
"e": 373736,
"s": 373508,
"text": "Questioners can be used effectively for requirements collection process, but this should not be the only method of interacting with the end-users. Questioners should be used as a supporting feature for interviews or a workshop."
},
{
"code": null,
"e": 373850,
"s": 373736,
"text": "In addition to the above methods, there are many other specific methods that can be used for specific conditions."
},
{
"code": null,
"e": 373940,
"s": 373850,
"text": "Following are some of the tips for making the requirements collection process successful:"
},
{
"code": null,
"e": 374152,
"s": 373940,
"text": "Never assume that you know customer's requirements. What you usually think, could be quite different to what the customer wants. Therefore, always verify with the customer when you have an assumption or a doubt."
},
{
"code": null,
"e": 374364,
"s": 374152,
"text": "Never assume that you know customer's requirements. What you usually think, could be quite different to what the customer wants. Therefore, always verify with the customer when you have an assumption or a doubt."
},
{
"code": null,
"e": 374442,
"s": 374364,
"text": "Get the end-users involved from the start. Get their support for what you do."
},
{
"code": null,
"e": 374520,
"s": 374442,
"text": "Get the end-users involved from the start. Get their support for what you do."
},
{
"code": null,
"e": 374649,
"s": 374520,
"text": "At the initial levels, define the scope and get customer's agreement. This helps you to successfully focus on scope of features."
},
{
"code": null,
"e": 374778,
"s": 374649,
"text": "At the initial levels, define the scope and get customer's agreement. This helps you to successfully focus on scope of features."
},
{
"code": null,
"e": 374910,
"s": 374778,
"text": "When you are in the process of collecting the requirements, make sure that the requirements are realistic, specific and measurable."
},
{
"code": null,
"e": 375042,
"s": 374910,
"text": "When you are in the process of collecting the requirements, make sure that the requirements are realistic, specific and measurable."
},
{
"code": null,
"e": 375339,
"s": 375042,
"text": "Focus on making the requirements document crystal clear. Requirement document is the only way to get the client and the service provider to an agreement. Therefore, there should not be any gray area in this document. If there are gray areas, consider this would lead to potential business issues."
},
{
"code": null,
"e": 375636,
"s": 375339,
"text": "Focus on making the requirements document crystal clear. Requirement document is the only way to get the client and the service provider to an agreement. Therefore, there should not be any gray area in this document. If there are gray areas, consider this would lead to potential business issues."
},
{
"code": null,
"e": 375856,
"s": 375636,
"text": "Do not talk about the solution or the technology to the client until all the requirements are gathered. You are not in a position to promise or indicate anything to the client until you are clear about the requirements."
},
{
"code": null,
"e": 376076,
"s": 375856,
"text": "Do not talk about the solution or the technology to the client until all the requirements are gathered. You are not in a position to promise or indicate anything to the client until you are clear about the requirements."
},
{
"code": null,
"e": 376177,
"s": 376076,
"text": "Before moving into any other project phases, get the requirements document signed off by the client."
},
{
"code": null,
"e": 376278,
"s": 376177,
"text": "Before moving into any other project phases, get the requirements document signed off by the client."
},
{
"code": null,
"e": 376352,
"s": 376278,
"text": "If necessary, create a prototype to visually illustrate the requirements."
},
{
"code": null,
"e": 376426,
"s": 376352,
"text": "If necessary, create a prototype to visually illustrate the requirements."
},
{
"code": null,
"e": 376747,
"s": 376426,
"text": "Requirement collection is the most important step of a project. If the project team fails to capture all the necessary requirements for a solution, the project will be running with a risk. This may lead to many disputes and disagreements in the future, and as a result, the business relationship can be severely damaged."
},
{
"code": null,
"e": 376927,
"s": 376747,
"text": "Therefore, take requirement collection as a key responsibility of the project team. Until the requirements are signed off, do not promise or comment on the nature of the solution."
},
{
"code": null,
"e": 377168,
"s": 376927,
"text": "Resource leveling is a technique in project management that overlooks resource allocation and resolves possible conflict arising from over-allocation. When project managers undertake a project, they need to plan their resources accordingly."
},
{
"code": null,
"e": 377375,
"s": 377168,
"text": "This will benefit the organization without having to face conflicts and not being able to deliver on time. Resource leveling is considered one of the key elements to resource management in the organization."
},
{
"code": null,
"e": 377596,
"s": 377375,
"text": "An organization starts to face problems if resources are not allocated properly i.e., some resource may be over-allocated whilst others will be under-allocated. Both will bring about a financial risk to the organization."
},
{
"code": null,
"e": 377935,
"s": 377596,
"text": "As the main aim of resource leveling is to allocate resource efficiently, so that the project can be completed in the given time period. Hence, resource leveling can be broken down into two main areas; projects that can be completed by using up all resources, which are available and projects that can be completed with limited resources."
},
{
"code": null,
"e": 378220,
"s": 377935,
"text": "Projects, which use limited resources can be extended for over a period of time until the resources required are available. If then again, the number of projects that an organization undertakes exceeds the resources available, then it's wiser to postpone the project for a later date."
},
{
"code": null,
"e": 378327,
"s": 378220,
"text": "Many organizations have a structured hierarchy of resource leveling. A work-based structure is as follows:"
},
{
"code": null,
"e": 378333,
"s": 378327,
"text": "Stage"
},
{
"code": null,
"e": 378339,
"s": 378333,
"text": "Phase"
},
{
"code": null,
"e": 378356,
"s": 378339,
"text": "Task/Deliverable"
},
{
"code": null,
"e": 378548,
"s": 378356,
"text": "All of the above-mentioned layers will determine the scope of the project and find ways to organize tasks across the team. This will make it easier for the project team to complete the tasks."
},
{
"code": null,
"e": 378813,
"s": 378548,
"text": "In addition, depending on the three parameters above, the level of the resources required (seniority, experience, skills, etc.) may be different. Therefore, the resource requirement for a project is always a variable, which is corresponding to the above structure."
},
{
"code": null,
"e": 379057,
"s": 378813,
"text": "The main reason for a project manager to establish dependencies is to ensure that tasks get executed properly. By identifying correct dependencies from that of incorrect dependencies allows the project to be completed within the set timeframe."
},
{
"code": null,
"e": 379252,
"s": 379057,
"text": "Here are some of the constraints that a project manager will come across during the project execution cycle. The constraints a project manager will face can be categorized into three categories."
},
{
"code": null,
"e": 379337,
"s": 379252,
"text": "Mandatory - These constraints arise due to physical limitations such as experiments."
},
{
"code": null,
"e": 379422,
"s": 379337,
"text": "Mandatory - These constraints arise due to physical limitations such as experiments."
},
{
"code": null,
"e": 379510,
"s": 379422,
"text": "Discretionary - These are constraints based on preferences or decisions taken by teams."
},
{
"code": null,
"e": 379598,
"s": 379510,
"text": "Discretionary - These are constraints based on preferences or decisions taken by teams."
},
{
"code": null,
"e": 379666,
"s": 379598,
"text": "External - Often based on needs or desires involving a third party."
},
{
"code": null,
"e": 379734,
"s": 379666,
"text": "External - Often based on needs or desires involving a third party."
},
{
"code": null,
"e": 380003,
"s": 379734,
"text": "For resource leveling to take place, resources are delegated with tasks (deliverables), which needs execution. During the starting phase of a project, idealistically the roles are assigned to resources (human resources) at which point the resources are not identified."
},
{
"code": null,
"e": 380084,
"s": 380003,
"text": "Later, these roles are assigned to specific tasks, which require specialization."
},
{
"code": null,
"e": 380291,
"s": 380084,
"text": "Resource leveling helps an organization to make use of the available resources to the maximum. The idea behind resource leveling is to reduce wastage of resources i.e., to stop over-allocation of resources."
},
{
"code": null,
"e": 380426,
"s": 380291,
"text": "Project manager will identify time that is unused by a resource and will take measures to prevent it or making an advantage out of it."
},
{
"code": null,
"e": 380521,
"s": 380426,
"text": "By resource conflicts, there are numerous disadvantages suffered by the organization, such as:"
},
{
"code": null,
"e": 380560,
"s": 380521,
"text": "Delay in certain tasks being completed"
},
{
"code": null,
"e": 380599,
"s": 380560,
"text": "Delay in certain tasks being completed"
},
{
"code": null,
"e": 380644,
"s": 380599,
"text": "Difficulty in assigning a different resource"
},
{
"code": null,
"e": 380689,
"s": 380644,
"text": "Difficulty in assigning a different resource"
},
{
"code": null,
"e": 380724,
"s": 380689,
"text": "Unable to change task dependencies"
},
{
"code": null,
"e": 380759,
"s": 380724,
"text": "Unable to change task dependencies"
},
{
"code": null,
"e": 380783,
"s": 380759,
"text": "To remove certain tasks"
},
{
"code": null,
"e": 380807,
"s": 380783,
"text": "To remove certain tasks"
},
{
"code": null,
"e": 380825,
"s": 380807,
"text": "To add more tasks"
},
{
"code": null,
"e": 380843,
"s": 380825,
"text": "To add more tasks"
},
{
"code": null,
"e": 380890,
"s": 380843,
"text": "Overall delays and budget overruns of projects"
},
{
"code": null,
"e": 380937,
"s": 380890,
"text": "Overall delays and budget overruns of projects"
},
{
"code": null,
"e": 381173,
"s": 380937,
"text": "Critical path is a common type of technique used by project managers when it comes to resource leveling. The critical path represents for both the longest and shortest time duration paths in the network diagram to complete the project."
},
{
"code": null,
"e": 381307,
"s": 381173,
"text": "However, apart from the widely used critical path concept, project managers use fast tracking and crashing if things get out of hand."
},
{
"code": null,
"e": 381502,
"s": 381307,
"text": "Fast tracking - This performs critical path tasks. This buys time. The prominent feature of this technique is that although the work is completed for the moment, possibility of rework is higher."
},
{
"code": null,
"e": 381697,
"s": 381502,
"text": "Fast tracking - This performs critical path tasks. This buys time. The prominent feature of this technique is that although the work is completed for the moment, possibility of rework is higher."
},
{
"code": null,
"e": 381865,
"s": 381697,
"text": "Crashing - This refers to assigning resources in addition to existing resources to get work done faster, associated with additional cost such as labor, equipment, etc."
},
{
"code": null,
"e": 382033,
"s": 381865,
"text": "Crashing - This refers to assigning resources in addition to existing resources to get work done faster, associated with additional cost such as labor, equipment, etc."
},
{
"code": null,
"e": 382220,
"s": 382033,
"text": "Resource leveling is aimed at increasing efficiency when undertaking projects by utilizing the resources available at hand. Proper resource leveling will not result in heavy expenditure."
},
{
"code": null,
"e": 382395,
"s": 382220,
"text": "The project manager needs to take into account several factors and identify critical to non-critical dependencies to avoid any last minute delays of the project deliverables."
},
{
"code": null,
"e": 382613,
"s": 382395,
"text": "Regardless of what you do in an organization, a staff is required in order to execute work tasks and activities. If you are a project manager, you need to have an adequate staff for executing your project activities."
},
{
"code": null,
"e": 382950,
"s": 382613,
"text": "Just having the required number of staff members for your project will not help you to successfully execute the project activities. These staff members selected for your project should have necessary skills to execute the project responsibilities as well. In addition, they should have the necessary motivation and availability as well."
},
{
"code": null,
"e": 383051,
"s": 382950,
"text": "Therefore, staffing of your project should be done methodologically with a proper and accurate plan."
},
{
"code": null,
"e": 383358,
"s": 383051,
"text": "Before you start staffing your project, you need to understand the purpose of your project. First of all, you need to understand the business goals for the project and other related objectives. Without you being clear about the end results, you may not be able to staff the best resources for your project."
},
{
"code": null,
"e": 383594,
"s": 383358,
"text": "Spend some time brainstorming about your project purpose and then try to understand the related staffing requirements. Understand the different skills required for project execution, in order to understand what kind of staff you want. "
},
{
"code": null,
"e": 383914,
"s": 383594,
"text": "Be precise when you prepare your staffing management plan. Make your staffing plan in black and white. Do not include things just to make the people happy. Always include the truth in your plan in a bold way. Whenever required, emphasize the roles and responsibilities of the staff and organizational policies as well. "
},
{
"code": null,
"e": 384080,
"s": 383914,
"text": "The workforce should be disciplined in order to execute a project successfully. Therefore, you need to include discipline requirements to the staffing plan as well. "
},
{
"code": null,
"e": 384440,
"s": 384080,
"text": "When it comes to articulating the plan, you need to use a good template for that. First of all, there are chances that you can find a suitable one from your organization itself. Talk to your peers and see whether there are templates that they have used in the past. In case if your organization has a knowledge management system, search for a template there. "
},
{
"code": null,
"e": 384623,
"s": 384440,
"text": "Once you get a good template, articulate everything in simple language. The audience of the plan is the management and the staff. Therefore, articulation should be clear and simple. "
},
{
"code": null,
"e": 384739,
"s": 384623,
"text": "Connecting with your staff is the key. By properly connecting, you can measure them for their skills and attitude. "
},
{
"code": null,
"e": 385048,
"s": 384739,
"text": "Interviewing the staff members is the best way to properly engaging with them. By doing this, you can measure their skills and you can see whether they are suitable for your project requirements. For interviews, you can come up with an interview schedule and a set of critical questions you may want to ask. "
},
{
"code": null,
"e": 385137,
"s": 385048,
"text": "In case there are things you cannot uncover through interviews, ask assistance from HR. "
},
{
"code": null,
"e": 385401,
"s": 385137,
"text": "Before you start staffing for the project, you need to know what skills required for your project. This way, you can measure the skills of your potential staff during the interviews. In most instances, you will not find all the staff members with desired skills. "
},
{
"code": null,
"e": 385583,
"s": 385401,
"text": " In such cases, you will have to request for trainings from the training department. Get applicable staff members trained on required skills in advance to the project commencement. "
},
{
"code": null,
"e": 385808,
"s": 385583,
"text": "Staffing management plan should be crystal clear about the staff rewards as well as the consequences. The plan should illustrate the rewards in detail and how a staff member or the entire staff becomes eligible for rewards. "
},
{
"code": null,
"e": 386033,
"s": 385808,
"text": "As an example, early delivery of projects is rewarded by paying a bonus to the staff members, who are involved in the project. This is one of the best ways to keep the staff motivation and focused on the project activities. "
},
{
"code": null,
"e": 386256,
"s": 386033,
"text": "In addition to the above areas, there can be additional considerations. One might be the duration of your staffing requirement. It's very rare that a project will require all the staff during the entire project life cycle."
},
{
"code": null,
"e": 386411,
"s": 386256,
"text": "Usually, the staffing requirement varies during different phases of the project. Refer to the following diagram in order to identify the staff variation. "
},
{
"code": null,
"e": 386661,
"s": 386411,
"text": "Usually, during the initial phases of the project, the project requires only a limited number of staff members. When it comes to development or construction, it may need a lot. Again, when it reaches the end, it will require a less number of staff. "
},
{
"code": null,
"e": 386883,
"s": 386661,
"text": "Staffing management plan for a project plays a critical role in project management. Since resources are the most critical factor for executing the project activities, you should be clear about your staffing requirements. "
},
{
"code": null,
"e": 386951,
"s": 386883,
"text": " Once you know what you want, derive the plan to address the same. "
},
{
"code": null,
"e": 387139,
"s": 386951,
"text": "When working on a project, there are many people or organizations that are dependent on and/or are affected by the final product or output. These people are the stakeholders of a project."
},
{
"code": null,
"e": 387359,
"s": 387139,
"text": "Stakeholder management involves taking into consideration the different interests and values stakeholders have and addressing them during the duration of the project to ensure that all stakeholders are happy at the end."
},
{
"code": null,
"e": 387629,
"s": 387359,
"text": "This branch of management is important because it helps an organization to achieve its strategic objectives by involving both the external and internal environments and by creating a positive relationship with stakeholders through good management of their expectations."
},
{
"code": null,
"e": 387895,
"s": 387629,
"text": "Stakeholder management is also important because it helps identify positive existing relationships with stakeholders. These relationships can be converted to coalitions and partnerships, which go on to build trust and encourage collaboration among the stakeholders."
},
{
"code": null,
"e": 388059,
"s": 387895,
"text": "Stakeholder management, in a business project sense, works through a strategy. This strategy is created using information gathered through the following processes:"
},
{
"code": null,
"e": 388237,
"s": 388059,
"text": "Stakeholder Identification - It is first important to note all the stakeholders involved, whether internal or external. An ideal way to do this is by creating a stakeholder map."
},
{
"code": null,
"e": 388415,
"s": 388237,
"text": "Stakeholder Identification - It is first important to note all the stakeholders involved, whether internal or external. An ideal way to do this is by creating a stakeholder map."
},
{
"code": null,
"e": 388588,
"s": 388415,
"text": "Stakeholder Analysis - Through stakeholder analysis, it is the manager's job to identify a stakeholder's needs, interfaces, expectations, authority and common relationship."
},
{
"code": null,
"e": 388761,
"s": 388588,
"text": "Stakeholder Analysis - Through stakeholder analysis, it is the manager's job to identify a stakeholder's needs, interfaces, expectations, authority and common relationship."
},
{
"code": null,
"e": 389011,
"s": 388761,
"text": "Stakeholder Matrix - During this process, managers position stakeholders using information gathered during the stakeholder analysis process. Stakeholders are positioned according to their level of influence or enrichment they provide to the project."
},
{
"code": null,
"e": 389261,
"s": 389011,
"text": "Stakeholder Matrix - During this process, managers position stakeholders using information gathered during the stakeholder analysis process. Stakeholders are positioned according to their level of influence or enrichment they provide to the project."
},
{
"code": null,
"e": 389720,
"s": 389261,
"text": "Stakeholder Engagement - This is one of the most important processes of stakeholder management where all stakeholders engage with the manager to get to know each other and understand each other better, at an executive level.\nThis communication is important for it gives both the manager and stakeholder a chance to discuss and concur upon expectations and most importantly agree on a common set of Values and Principals, which all stakeholders will stand by."
},
{
"code": null,
"e": 389945,
"s": 389720,
"text": "Stakeholder Engagement - This is one of the most important processes of stakeholder management where all stakeholders engage with the manager to get to know each other and understand each other better, at an executive level."
},
{
"code": null,
"e": 390179,
"s": 389945,
"text": "This communication is important for it gives both the manager and stakeholder a chance to discuss and concur upon expectations and most importantly agree on a common set of Values and Principals, which all stakeholders will stand by."
},
{
"code": null,
"e": 390418,
"s": 390179,
"text": "Communicating Information - Here, expectations of communication are agreed upon and the manner in which communication is managed between the stakeholders is established, that is, how and when communication is received and who receives it."
},
{
"code": null,
"e": 390657,
"s": 390418,
"text": "Communicating Information - Here, expectations of communication are agreed upon and the manner in which communication is managed between the stakeholders is established, that is, how and when communication is received and who receives it."
},
{
"code": null,
"e": 390852,
"s": 390657,
"text": "Stakeholder Agreements - This is the Lexicon of the project or the objectives set forth. All key stakeholders sign this stakeholder agreement, which is a collection of all the agreed decisions. "
},
{
"code": null,
"e": 391047,
"s": 390852,
"text": "Stakeholder Agreements - This is the Lexicon of the project or the objectives set forth. All key stakeholders sign this stakeholder agreement, which is a collection of all the agreed decisions. "
},
{
"code": null,
"e": 391178,
"s": 391047,
"text": "In today's modern management project practice, managers and stakeholders favor an honest and transparent stakeholder relationship."
},
{
"code": null,
"e": 391276,
"s": 391178,
"text": "Some organizations still endure poor stakeholder management practices and this arises because of:"
},
{
"code": null,
"e": 391445,
"s": 391276,
"text": "Communicating with a stakeholder too late. This does not allow for ample revision of stakeholder expectations and hence their views may not be taken into consideration."
},
{
"code": null,
"e": 391614,
"s": 391445,
"text": "Communicating with a stakeholder too late. This does not allow for ample revision of stakeholder expectations and hence their views may not be taken into consideration."
},
{
"code": null,
"e": 391747,
"s": 391614,
"text": "Inviting stakeholders to take part in the decision making process too early. This results in a complicated decision making process. "
},
{
"code": null,
"e": 391880,
"s": 391747,
"text": "Inviting stakeholders to take part in the decision making process too early. This results in a complicated decision making process. "
},
{
"code": null,
"e": 392039,
"s": 391880,
"text": "Involving the wrong stakeholders in a project. This results in a reduction in the value of their contribution and this leads to external criticism in the end."
},
{
"code": null,
"e": 392198,
"s": 392039,
"text": "Involving the wrong stakeholders in a project. This results in a reduction in the value of their contribution and this leads to external criticism in the end."
},
{
"code": null,
"e": 392328,
"s": 392198,
"text": "The management does not value the contribution of stakeholders. Their participation is viewed as unimportant and inconsequential."
},
{
"code": null,
"e": 392458,
"s": 392328,
"text": "The management does not value the contribution of stakeholders. Their participation is viewed as unimportant and inconsequential."
},
{
"code": null,
"e": 392574,
"s": 392458,
"text": "Whatever way stakeholder management is approached, it should be done attentively so as to achieve the best results."
},
{
"code": null,
"e": 392774,
"s": 392574,
"text": "Insufficient involvement and ineffective communication with stakeholders can lead to project failure. The following are a few ideas that can be used to achieve good stakeholder management practices: "
},
{
"code": null,
"e": 392981,
"s": 392774,
"text": "Management and stakeholders should work together to draw up a realistic list of goals and objectives. Engaging stakeholders will improve business performance and they take an active interest in the project."
},
{
"code": null,
"e": 393188,
"s": 392981,
"text": "Management and stakeholders should work together to draw up a realistic list of goals and objectives. Engaging stakeholders will improve business performance and they take an active interest in the project."
},
{
"code": null,
"e": 393450,
"s": 393188,
"text": "Communication is the key. It is important for stakeholders and management to communicate throughout the course of the project on a regular basis. This ensures that both parties will be actively engaged and ensure smooth sailing during the course of the project."
},
{
"code": null,
"e": 393712,
"s": 393450,
"text": "Communication is the key. It is important for stakeholders and management to communicate throughout the course of the project on a regular basis. This ensures that both parties will be actively engaged and ensure smooth sailing during the course of the project."
},
{
"code": null,
"e": 393941,
"s": 393712,
"text": "Agreeing on deliverables is important. This makes sure there is no undue disappointment at the end. Prototypes and samples during the course of the project helps stakeholders have a clear understanding regarding the end project."
},
{
"code": null,
"e": 394170,
"s": 393941,
"text": "Agreeing on deliverables is important. This makes sure there is no undue disappointment at the end. Prototypes and samples during the course of the project helps stakeholders have a clear understanding regarding the end project."
},
{
"code": null,
"e": 394413,
"s": 394170,
"text": "In conclusion, in order to achieve an outcome from the projects, good stakeholder management practices are required. Stakeholder management is the effective management of all participants in a project, be it external or internal contributors."
},
{
"code": null,
"e": 394628,
"s": 394413,
"text": "Arguably, the most important element in stakeholder management is communication where a manager has to spend his 99% time in doing meetings, checking and replying e-mails and updating and distributing reports, etc."
},
{
"code": null,
"e": 394911,
"s": 394628,
"text": "When it comes to implementing or constructing large and complex systems (such as an enterprise software system), the work requirements and conditions should be properly documented. Statement of Work (SOW) is such document that describes what needs to be done in the agreed contract."
},
{
"code": null,
"e": 395083,
"s": 394911,
"text": "Usually, the SOW is written in a precise and definitive language that is relevant to the field of business. This prevents any misinterpretations of terms and requirements."
},
{
"code": null,
"e": 395214,
"s": 395083,
"text": "An SOW covers the work requirements for a specific project and addresses the performance and design requirements at the same time."
},
{
"code": null,
"e": 395341,
"s": 395214,
"text": "Whenever requirements are detailed or contained within a supplementary document, SOW makes reference to the specific document."
},
{
"code": null,
"e": 395514,
"s": 395341,
"text": "The SOW defines the scope and the working agreements between two parties, typically between a client and a service provider. Therefore, SOW carries a legal gravity as well."
},
{
"code": null,
"e": 395646,
"s": 395514,
"text": "The main purpose of a SOW is to define the liabilities, responsibilities and work agreements between clients and service providers."
},
{
"code": null,
"e": 395763,
"s": 395646,
"text": "A well-written SOW will define the scope of the engagement and Key Performance Indicators (KPIs) for the engagement."
},
{
"code": null,
"e": 395916,
"s": 395763,
"text": "Therefore, the KPIs can be used to determine whether the service provider has met conditions of the SOW and use it as a baseline for future engagements."
},
{
"code": null,
"e": 396132,
"s": 395916,
"text": "SOW contains all details of non-specifications requirements of the contractor or service provider's effort. Whenever specifications are involved, the references are made from SOW to specific specification documents."
},
{
"code": null,
"e": 396225,
"s": 396132,
"text": "These specification documents can be functional requirements or non-functional requirements."
},
{
"code": null,
"e": 396479,
"s": 396225,
"text": "Functional requirements (in a software system) define how the software should behave functionally and non-functional requirements detail other characteristics of the software such as performance, security, maintainability, configuration management, etc."
},
{
"code": null,
"e": 396651,
"s": 396479,
"text": "The SOW formats differ from one industry to another. Regardless of the industry, some key areas of the SOW are common. Following are the commonly addressed areas in a SOW:"
},
{
"code": null,
"e": 396892,
"s": 396651,
"text": "This section describes the work to be done in a technical manner. If the system to be built is a software system, this section defines the hardware and software requirements along with the exact work to be done in terms of the final system."
},
{
"code": null,
"e": 396989,
"s": 396892,
"text": "If there is anything 'out of scope', those areas are also mentioned under a suitable subheading."
},
{
"code": null,
"e": 397226,
"s": 396989,
"text": "The location where the work is performed is mentioned under this section. This section also details the hardware and software specifications. In addition to that, a description about human resources and how they work are addressed here."
},
{
"code": null,
"e": 397456,
"s": 397226,
"text": "This defines the timeline allocated for the projects. It includes the development time, warranty time and maintenance time. In addition to calendar time, the man days (total effort) required to complete the project is also noted."
},
{
"code": null,
"e": 397543,
"s": 397456,
"text": "This section of the SOW describes the deliveries and the due dates for the deliveries."
},
{
"code": null,
"e": 397712,
"s": 397543,
"text": "The standards (internal or external) are defined in this section. All deliveries and work done should comply with the standards defined in this section of the document."
},
{
"code": null,
"e": 397838,
"s": 397712,
"text": "This section defines the minimum requirements for accepting deliverables. It also describes the criteria used for acceptance."
},
{
"code": null,
"e": 397927,
"s": 397838,
"text": "There are a number of engagement models when it comes to contracting a service provider."
},
{
"code": null,
"e": 398032,
"s": 397927,
"text": "In the domain of software development, there are two distinct contract models, fixed bid and a retainer."
},
{
"code": null,
"e": 398191,
"s": 398032,
"text": "In fixed bid, the project cost is a constant and it is up to the service provider to optimize the resource allocation in order to maintain the profit margins."
},
{
"code": null,
"e": 398382,
"s": 398191,
"text": "The client does not worry about the number of resources, as long as the delivery schedule is met. In the retainer model, the client pays for the number of resources allocated to the project."
},
{
"code": null,
"e": 398711,
"s": 398382,
"text": "Since SOW is an integrated part of a project, almost all senior members of the project team should become aware of terms and conditions of the SOW. Sometimes, especially in software development projects, a penalty is applied if the delivery dates are missed. Therefore, everyone should be aware of such demanding terms of a SOW."
},
{
"code": null,
"e": 398944,
"s": 398711,
"text": "SOW is a critical document for project management. It defines the scope of the work and the work agreements. Therefore, all stakeholders of the project should have a thorough understanding of the SOW of the project and adhere to it."
},
{
"code": null,
"e": 399051,
"s": 398944,
"text": "Whatever kind of job one is involved in, you would always find several factors that lead to severe stress."
},
{
"code": null,
"e": 399331,
"s": 399051,
"text": "It is not uncommon today, with everyone worrying about whether the state of the economy and high employment rates would mean that they are the next to losing their jobs. Like any other management technique, stress management too is very vital for the success of any organization."
},
{
"code": null,
"e": 399592,
"s": 399331,
"text": "If the employees of an organization are unable to work efficiently and be productive, it is the organization that would eventually collapse. It is therefore essential that stress management techniques are understood by all the stakeholders of any organization."
},
{
"code": null,
"e": 399753,
"s": 399592,
"text": "It isn't easy to point on just one or two causes of stress. There are several factors that could contribute towards a person suffering from all sorts of stress."
},
{
"code": null,
"e": 399861,
"s": 399753,
"text": "You must understand what causes stress if you are to efficiently try and reduce stress from your lifestyle."
},
{
"code": null,
"e": 400108,
"s": 399861,
"text": "Most often, employees find themselves in a state of confusion as to what their job entails and they may even worry as to whether they might lose their jobs given the current economic situation. This could lead to a lot of stress in the workplace."
},
{
"code": null,
"e": 400278,
"s": 400108,
"text": "Increased pressure from employers could also make an employee work too hard and maybe even work overtime in an attempt to impress the employer or outdo another employee."
},
{
"code": null,
"e": 400467,
"s": 400278,
"text": "There are of course other reasons that could contribute to individual employees suffering from severe stress outside the workplace such as family problems, health-related issues and so on."
},
{
"code": null,
"e": 400674,
"s": 400467,
"text": "Failure to understand and eliminate these elements that cause the stress could eventually lead to dire consequences. These elements are generally known as stressors and are found in plenty in the workplace."
},
{
"code": null,
"e": 400810,
"s": 400674,
"text": "It is not only the employees, who need to identify these stressors, but also the organization itself would need to take relevant steps."
},
{
"code": null,
"e": 400930,
"s": 400810,
"text": "It is of utmost importance that an organization takes this issue seriously. The organization can help reduce stress by:"
},
{
"code": null,
"e": 401301,
"s": 400930,
"text": "Reducing the number of hours for which their employees would have to work per week. This will, in the long run, contribute to a more efficient functioning of the organization, as employees would have more time to rest at home and will come back the next day feeling refreshed.\nWorking hours should be flexible. This may also include shifts and the rotation of employees."
},
{
"code": null,
"e": 401578,
"s": 401301,
"text": "Reducing the number of hours for which their employees would have to work per week. This will, in the long run, contribute to a more efficient functioning of the organization, as employees would have more time to rest at home and will come back the next day feeling refreshed."
},
{
"code": null,
"e": 401672,
"s": 401578,
"text": "Working hours should be flexible. This may also include shifts and the rotation of employees."
},
{
"code": null,
"e": 402168,
"s": 401672,
"text": "A tried and tested technique that many organizations have begun using is the provision of lounges and other recreational facilities to help employees relax during the day should they require some time off.\nYou may even choose to add refreshments and a TV so that they could forget all the worries of work for a few minutes. Investing in such facilities is a great idea for any organization. You may also allow them to take more holidays throughout the year to ensure that they have a good break."
},
{
"code": null,
"e": 402374,
"s": 402168,
"text": "A tried and tested technique that many organizations have begun using is the provision of lounges and other recreational facilities to help employees relax during the day should they require some time off."
},
{
"code": null,
"e": 402664,
"s": 402374,
"text": "You may even choose to add refreshments and a TV so that they could forget all the worries of work for a few minutes. Investing in such facilities is a great idea for any organization. You may also allow them to take more holidays throughout the year to ensure that they have a good break."
},
{
"code": null,
"e": 403171,
"s": 402664,
"text": "Female employees may find that they do not have enough time to spend with their newborn if they have just had a baby.\nYou should make allowance for such situations. Providing longer maternity leave could help your female employee to come back to work without having too much on her mind with regard to the baby and any postnatal depression.\nAnother idea would be to provide childcare facilities at the office so that mothers with young children could peep in and ensure their kids are okay every few hours."
},
{
"code": null,
"e": 403289,
"s": 403171,
"text": "Female employees may find that they do not have enough time to spend with their newborn if they have just had a baby."
},
{
"code": null,
"e": 403512,
"s": 403289,
"text": "You should make allowance for such situations. Providing longer maternity leave could help your female employee to come back to work without having too much on her mind with regard to the baby and any postnatal depression."
},
{
"code": null,
"e": 403678,
"s": 403512,
"text": "Another idea would be to provide childcare facilities at the office so that mothers with young children could peep in and ensure their kids are okay every few hours."
},
{
"code": null,
"e": 404070,
"s": 403678,
"text": "As an employee, you should also make it a point to occasionally have a casual chat with your employees to ensure that they are satisfied with their jobs and have no issues at work.\nYou should also encourage them and appreciate and praise him/her for tasks carried out very well. This would reduce any worries they may have of the risks of losing their jobs and help them to feel more secure."
},
{
"code": null,
"e": 404251,
"s": 404070,
"text": "As an employee, you should also make it a point to occasionally have a casual chat with your employees to ensure that they are satisfied with their jobs and have no issues at work."
},
{
"code": null,
"e": 404462,
"s": 404251,
"text": "You should also encourage them and appreciate and praise him/her for tasks carried out very well. This would reduce any worries they may have of the risks of losing their jobs and help them to feel more secure."
},
{
"code": null,
"e": 404633,
"s": 404462,
"text": "If you are suffering from stress and have identified some of the causes, you should try different techniques to help you cope with the pressure or problems that you face."
},
{
"code": null,
"e": 404745,
"s": 404633,
"text": "Being positive and remaining calm would take you a very long way. Try not to worry about insignificant matters."
},
{
"code": null,
"e": 404885,
"s": 404745,
"text": "If you have any queries or any work-related problems, you should always take it up with your employer and try and get the issue sorted out."
},
{
"code": null,
"e": 404996,
"s": 404885,
"text": "It is important to keep in mind that you should take regular breaks while at work and even after you get home."
},
{
"code": null,
"e": 405165,
"s": 404996,
"text": "You can relieve yourself of most of the stress by taking part in relaxing activities, be it yoga or simply curling up on the couch with a good book and a cup of coffee."
},
{
"code": null,
"e": 405294,
"s": 405165,
"text": "Create a schedule and plan out how you would balance both your work life and family life without letting one overtake the other."
},
{
"code": null,
"e": 405407,
"s": 405294,
"text": "You would find that you are more relaxed this way and would actually look forward to going to work the next day."
},
{
"code": null,
"e": 405490,
"s": 405407,
"text": "Of course, nothing can beat a good night's sleep and a healthy lifestyle and diet."
},
{
"code": null,
"e": 405708,
"s": 405490,
"text": "Although most work-related worries may seem too huge to shake off, once you master the art of coping with stress and are able to get rid of any negative thoughts, you would find that peace would come to you naturally."
},
{
"code": null,
"e": 405859,
"s": 405708,
"text": "This is a systematic process, which encourages participants to actively involve by contributing ideas in a non critical or non-evaluative environment."
},
{
"code": null,
"e": 406096,
"s": 405859,
"text": "Structured brainstorming sessions are undertaken by organizations to find solution to problems that persists in a work environment. Many successful organizations use structured brainstorming as key tool when it comes to decision making."
},
{
"code": null,
"e": 406278,
"s": 406096,
"text": "The primary benefit of structured brainstorming is that it's a collaboration of ideas. However, there's a difference between structured brainstorming and unstructured brainstorming."
},
{
"code": null,
"e": 406444,
"s": 406278,
"text": "In structured brainstorming, the participants are given guidelines and rules to follow, so that the input from the sessions is in an orderly manner and constructive."
},
{
"code": null,
"e": 406603,
"s": 406444,
"text": "When it comes to unstructured brainstorming, there are many ideas by participants, but the brainstorming session may not be leading towards any specific goal."
},
{
"code": null,
"e": 406669,
"s": 406603,
"text": "The benefits gained from structured brainstorming are as follows:"
},
{
"code": null,
"e": 406795,
"s": 406669,
"text": "A collection of ideas from the team members with regards to a particular issue or a problem will prove to be more successful."
},
{
"code": null,
"e": 406921,
"s": 406795,
"text": "A collection of ideas from the team members with regards to a particular issue or a problem will prove to be more successful."
},
{
"code": null,
"e": 407018,
"s": 406921,
"text": "Opens up a new culture within the organization where team members are free to voice their ideas."
},
{
"code": null,
"e": 407115,
"s": 407018,
"text": "Opens up a new culture within the organization where team members are free to voice their ideas."
},
{
"code": null,
"e": 407236,
"s": 407115,
"text": "It further prevents dominant team members from taking the lead and giving the rest of the team members an unfair chance."
},
{
"code": null,
"e": 407357,
"s": 407236,
"text": "It further prevents dominant team members from taking the lead and giving the rest of the team members an unfair chance."
},
{
"code": null,
"e": 407394,
"s": 407357,
"text": "Promotes synergy among team members."
},
{
"code": null,
"e": 407431,
"s": 407394,
"text": "Promotes synergy among team members."
},
{
"code": null,
"e": 407508,
"s": 407431,
"text": "Helps the team members to come up with ideas to achieve the mission at hand."
},
{
"code": null,
"e": 407585,
"s": 407508,
"text": "Helps the team members to come up with ideas to achieve the mission at hand."
},
{
"code": null,
"e": 407785,
"s": 407585,
"text": "Structured brainstorming can prove to be difficult as input comes from various team members. Hence, the following steps can be followed to ensure that constructive results can be obtained at the end."
},
{
"code": null,
"e": 407999,
"s": 407785,
"text": "State clearly the objective/theme behind the structured brainstorming. Make sure that each participant is fully aware of what is expected from the brainstorming session. This will save time and energy of the team."
},
{
"code": null,
"e": 408213,
"s": 407999,
"text": "State clearly the objective/theme behind the structured brainstorming. Make sure that each participant is fully aware of what is expected from the brainstorming session. This will save time and energy of the team."
},
{
"code": null,
"e": 408282,
"s": 408213,
"text": "Give each team member a chance to demonstrate or voice his/her idea."
},
{
"code": null,
"e": 408351,
"s": 408282,
"text": "Give each team member a chance to demonstrate or voice his/her idea."
},
{
"code": null,
"e": 408533,
"s": 408351,
"text": "During structured brainstorming, advise that team members are not allowed to criticize one another's opinion or idea. This promotes freedom of sharing one's idea without hesitation."
},
{
"code": null,
"e": 408715,
"s": 408533,
"text": "During structured brainstorming, advise that team members are not allowed to criticize one another's opinion or idea. This promotes freedom of sharing one's idea without hesitation."
},
{
"code": null,
"e": 408796,
"s": 408715,
"text": "Repeat the round until the team members do not have any more ideas or solutions."
},
{
"code": null,
"e": 408877,
"s": 408796,
"text": "Repeat the round until the team members do not have any more ideas or solutions."
},
{
"code": null,
"e": 408949,
"s": 408877,
"text": "Review the input from each team member and discard any duplicate input."
},
{
"code": null,
"e": 409021,
"s": 408949,
"text": "Review the input from each team member and discard any duplicate input."
},
{
"code": null,
"e": 409245,
"s": 409021,
"text": "A bad structured brainstorming session will cost your organization money, energy and time if the objective of the brainstorming session is not met. This may cause detrimental factors, which trigger to loss of projects, etc."
},
{
"code": null,
"e": 409336,
"s": 409245,
"text": "Hence, here are some methods for successful brainstorming to be used in your organization."
},
{
"code": null,
"e": 409569,
"s": 409336,
"text": "Focus is crucial when it comes to structured brainstorming session. Sharpen the concentration levels of the participants. You can use some exercises at the beginning of the session in order to increase the focus of the participants."
},
{
"code": null,
"e": 409802,
"s": 409569,
"text": "Focus is crucial when it comes to structured brainstorming session. Sharpen the concentration levels of the participants. You can use some exercises at the beginning of the session in order to increase the focus of the participants."
},
{
"code": null,
"e": 409878,
"s": 409802,
"text": "Instead of writing down arbitrary rules, positivity with playfulness helps."
},
{
"code": null,
"e": 409954,
"s": 409878,
"text": "Instead of writing down arbitrary rules, positivity with playfulness helps."
},
{
"code": null,
"e": 409981,
"s": 409954,
"text": "State the number of ideas."
},
{
"code": null,
"e": 410008,
"s": 409981,
"text": "State the number of ideas."
},
{
"code": null,
"e": 410024,
"s": 410008,
"text": "Build and jump."
},
{
"code": null,
"e": 410040,
"s": 410024,
"text": "Build and jump."
},
{
"code": null,
"e": 410065,
"s": 410040,
"text": "Make the space remember."
},
{
"code": null,
"e": 410090,
"s": 410065,
"text": "Make the space remember."
},
{
"code": null,
"e": 410114,
"s": 410090,
"text": "Stretch mental muscles."
},
{
"code": null,
"e": 410138,
"s": 410114,
"text": "Stretch mental muscles."
},
{
"code": null,
"e": 410153,
"s": 410138,
"text": "Get practical."
},
{
"code": null,
"e": 410168,
"s": 410153,
"text": "Get practical."
},
{
"code": null,
"e": 410324,
"s": 410168,
"text": "Talk and brainstorm about all the possibilities/causes etc., for the problem at hand. Never miss an idea. Have someone recording the brainstorming session."
},
{
"code": null,
"e": 410410,
"s": 410324,
"text": "SWOT Analysis & PEST Analysis are very effective tools for structured brainstorming. "
},
{
"code": null,
"e": 410678,
"s": 410410,
"text": "SWOT analysis is a useful tool when it comes to decision making. SWOT stands for Strengths, Weakness, Opportunities and Threats. Brainstorming sessions often use SWOT as an analysis tool for reviewing strategies. SWOT analysis is used to assess the following factors:"
},
{
"code": null,
"e": 410701,
"s": 410678,
"text": "Market capitalization "
},
{
"code": null,
"e": 410724,
"s": 410701,
"text": "Market capitalization "
},
{
"code": null,
"e": 410751,
"s": 410724,
"text": "Sales distribution methods"
},
{
"code": null,
"e": 410778,
"s": 410751,
"text": "Sales distribution methods"
},
{
"code": null,
"e": 410799,
"s": 410778,
"text": "A brand or a product"
},
{
"code": null,
"e": 410820,
"s": 410799,
"text": "A brand or a product"
},
{
"code": null,
"e": 410836,
"s": 410820,
"text": "A business idea"
},
{
"code": null,
"e": 410852,
"s": 410836,
"text": "A business idea"
},
{
"code": null,
"e": 410890,
"s": 410852,
"text": "A strategy e.g., entering new markets"
},
{
"code": null,
"e": 410928,
"s": 410890,
"text": "A strategy e.g., entering new markets"
},
{
"code": null,
"e": 410962,
"s": 410928,
"text": "A department of the organization "
},
{
"code": null,
"e": 410996,
"s": 410962,
"text": "A department of the organization "
},
{
"code": null,
"e": 411225,
"s": 410996,
"text": "PEST analysis refers to Political, Economical, Social and Technology. PEST analysis is also often used in brainstorming sessions to understand the market position of an organization. PEST can be used under the following reasons:"
},
{
"code": null,
"e": 411262,
"s": 411225,
"text": "An organization analyzing its market"
},
{
"code": null,
"e": 411299,
"s": 411262,
"text": "An organization analyzing its market"
},
{
"code": null,
"e": 411330,
"s": 411299,
"text": "A product accessing its market"
},
{
"code": null,
"e": 411361,
"s": 411330,
"text": "A product accessing its market"
},
{
"code": null,
"e": 411414,
"s": 411361,
"text": "Assessing a particular brand in relation to a market"
},
{
"code": null,
"e": 411467,
"s": 411414,
"text": "Assessing a particular brand in relation to a market"
},
{
"code": null,
"e": 411494,
"s": 411467,
"text": "A newly venturing business"
},
{
"code": null,
"e": 411521,
"s": 411494,
"text": "A newly venturing business"
},
{
"code": null,
"e": 411567,
"s": 411521,
"text": "For new strategies based on entering a market"
},
{
"code": null,
"e": 411613,
"s": 411567,
"text": "For new strategies based on entering a market"
},
{
"code": null,
"e": 411632,
"s": 411613,
"text": "For an acquisition"
},
{
"code": null,
"e": 411651,
"s": 411632,
"text": "For an acquisition"
},
{
"code": null,
"e": 411681,
"s": 411651,
"text": "For an investment opportunity"
},
{
"code": null,
"e": 411711,
"s": 411681,
"text": "For an investment opportunity"
},
{
"code": null,
"e": 411794,
"s": 411711,
"text": "Once you have completed the brainstorming session, the following needs to be done:"
},
{
"code": null,
"e": 411854,
"s": 411794,
"text": "Reduce the list of ideas given based on the agreed priority"
},
{
"code": null,
"e": 411914,
"s": 411854,
"text": "Reduce the list of ideas given based on the agreed priority"
},
{
"code": null,
"e": 411967,
"s": 411914,
"text": "Mix the points, which are similar in nature together"
},
{
"code": null,
"e": 412020,
"s": 411967,
"text": "Mix the points, which are similar in nature together"
},
{
"code": null,
"e": 412080,
"s": 412020,
"text": "Discussion is crucial, merits to be given for each feedback"
},
{
"code": null,
"e": 412140,
"s": 412080,
"text": "Discussion is crucial, merits to be given for each feedback"
},
{
"code": null,
"e": 412191,
"s": 412140,
"text": "Eradicate ideas that are not relevant to the topic"
},
{
"code": null,
"e": 412242,
"s": 412191,
"text": "Eradicate ideas that are not relevant to the topic"
},
{
"code": null,
"e": 412330,
"s": 412242,
"text": "Give the team members a chance to jot down ideas if they have any and communicate later"
},
{
"code": null,
"e": 412418,
"s": 412330,
"text": "Give the team members a chance to jot down ideas if they have any and communicate later"
},
{
"code": null,
"e": 412616,
"s": 412418,
"text": "Structured brainstorming is a technique used to generate ideas, which can help to solve a problem. Structured brainstorming helps to encourage creative thinking and enthusiasm between team members."
},
{
"code": null,
"e": 412677,
"s": 412616,
"text": "It also encourages freewill to accept each other's thoughts."
},
{
"code": null,
"e": 412904,
"s": 412677,
"text": "Succession planning is one of the most critical functions of an organization. This is the process that identifies the critical and core roles of an organization and identifies and assesses the suitable candidates for the same."
},
{
"code": null,
"e": 413094,
"s": 412904,
"text": "The succession planning process ramps up potential candidates with appropriate skills and experiences in an effort to train them to handle future responsibilities in their respective roles."
},
{
"code": null,
"e": 413336,
"s": 413094,
"text": "Succession planning is applicable for all critical roles in the organization. The upper management of each practice or department is responsible of coming up with a suitable succession plan for each core position under his or her department."
},
{
"code": null,
"e": 413400,
"s": 413336,
"text": "There are four main important steps in planning for succession."
},
{
"code": null,
"e": 413642,
"s": 413400,
"text": "This is one of the key steps of the succession planning. Hiring the right and skilled employees is the key to growing human resources in the organization. Sometimes, some companies require a paradigm shift in order to retain in the business."
},
{
"code": null,
"e": 413868,
"s": 413642,
"text": "In such cases, the organization requires to let go or redefine the roles and responsibilities of the portion of existing staff. Then, the organization hires the new blood in order to acquire the required skills and expertise."
},
{
"code": null,
"e": 414005,
"s": 413868,
"text": "When it comes to succession planning, organization should always hire people, who will have the potential to go up the corporate ladder."
},
{
"code": null,
"e": 414109,
"s": 414005,
"text": "All the organizational training can come under two categories; skills training and management training."
},
{
"code": null,
"e": 414212,
"s": 414109,
"text": "Skills training: Employees are trained to enhance their skills, so their day-to-day work becomes easy."
},
{
"code": null,
"e": 414315,
"s": 414212,
"text": "Skills training: Employees are trained to enhance their skills, so their day-to-day work becomes easy."
},
{
"code": null,
"e": 414448,
"s": 414315,
"text": "Management training: A selected set of employees undergoes training where they are trained to take over management responsibilities."
},
{
"code": null,
"e": 414581,
"s": 414448,
"text": "Management training: A selected set of employees undergoes training where they are trained to take over management responsibilities."
},
{
"code": null,
"e": 414722,
"s": 414581,
"text": "Based on their performance, the employees, who have the potential to become leaders in the organization should be appropriately compensated."
},
{
"code": null,
"e": 414820,
"s": 414722,
"text": "These employees should be considered for fast track promotions and special compensation benefits."
},
{
"code": null,
"e": 415018,
"s": 414820,
"text": "Talent management is one of the key factors that contribute for succession planning. The right candidate will have the required level of skills in order to execute responsibilities of the new role."
},
{
"code": null,
"e": 415195,
"s": 415018,
"text": "The upper management and mentors of the staff member should always make sure that the employee is constantly enhancing his/her skills by accepting challenging responsibilities."
},
{
"code": null,
"e": 415336,
"s": 415195,
"text": "Succession planning has many activities involved. Some of these activities are sequential and others can be performed in parallel to others."
},
{
"code": null,
"e": 415403,
"s": 415336,
"text": "Following are the core activities involved in succession planning."
},
{
"code": null,
"e": 415576,
"s": 415403,
"text": "Identification of the critical roles for the growth of the company. There are many tools such as Pareto charts in case if you need any assistance in prioritizing the roles."
},
{
"code": null,
"e": 415749,
"s": 415576,
"text": "Identification of the critical roles for the growth of the company. There are many tools such as Pareto charts in case if you need any assistance in prioritizing the roles."
},
{
"code": null,
"e": 415962,
"s": 415749,
"text": "Identification of gaps in the succession planning process. In this step, the process of succession planning is analyzed for its strength. If there are weaknesses and gaps, they will be methodologically addressed."
},
{
"code": null,
"e": 416175,
"s": 415962,
"text": "Identification of gaps in the succession planning process. In this step, the process of succession planning is analyzed for its strength. If there are weaknesses and gaps, they will be methodologically addressed."
},
{
"code": null,
"e": 416368,
"s": 416175,
"text": "In this step, the possible candidates for the potential role will be identified. This will be done by analyzing their past performances as well and for some other characteristics such as age. "
},
{
"code": null,
"e": 416561,
"s": 416368,
"text": "In this step, the possible candidates for the potential role will be identified. This will be done by analyzing their past performances as well and for some other characteristics such as age. "
},
{
"code": null,
"e": 416805,
"s": 416561,
"text": "All short-listed employees for potential roles will be then educated about their career path. The employees should understand that they are being trained and their skills are being developed in order to fill critical roles in the organization."
},
{
"code": null,
"e": 417049,
"s": 416805,
"text": "All short-listed employees for potential roles will be then educated about their career path. The employees should understand that they are being trained and their skills are being developed in order to fill critical roles in the organization."
},
{
"code": null,
"e": 417240,
"s": 417049,
"text": "When it comes to training and developing people, they should be developed for the positions that exist in the company as well as the positions (roles) that will be introduced in the future. "
},
{
"code": null,
"e": 417431,
"s": 417240,
"text": "When it comes to training and developing people, they should be developed for the positions that exist in the company as well as the positions (roles) that will be introduced in the future. "
},
{
"code": null,
"e": 417580,
"s": 417431,
"text": "Have a clear understanding of the timeline required for filling key roles. For this, an understanding of when key roles will be vacant is necessary."
},
{
"code": null,
"e": 417729,
"s": 417580,
"text": "Have a clear understanding of the timeline required for filling key roles. For this, an understanding of when key roles will be vacant is necessary."
},
{
"code": null,
"e": 417799,
"s": 417729,
"text": "Conduct regular meetings on the succession plans of the organization."
},
{
"code": null,
"e": 417869,
"s": 417799,
"text": "Conduct regular meetings on the succession plans of the organization."
},
{
"code": null,
"e": 417987,
"s": 417869,
"text": "Identify top players of every department and make necessary arrangements to keep them in the company for a long time."
},
{
"code": null,
"e": 418105,
"s": 417987,
"text": "Identify top players of every department and make necessary arrangements to keep them in the company for a long time."
},
{
"code": null,
"e": 418261,
"s": 418105,
"text": "Review past succession that took place based on the succession plan and review success. If there are issues, make necessary changes to the succession plan."
},
{
"code": null,
"e": 418417,
"s": 418261,
"text": "Review past succession that took place based on the succession plan and review success. If there are issues, make necessary changes to the succession plan."
},
{
"code": null,
"e": 418607,
"s": 418417,
"text": "Every organization requires succession planning. By succession planning, organization's key roles are constantly maintained with talented people, so organizations can maintain its strength."
},
{
"code": null,
"e": 418811,
"s": 418607,
"text": "When selecting people for key roles, their adherence to organization's mission and vision is important. This is how visionary leaders are sprung in organizations with commitment for the company's growth."
},
{
"code": null,
"e": 418975,
"s": 418811,
"text": "In an organization, if a product is manufactured using raw materials from various suppliers and if these products are sold to customers, a supply chain is created."
},
{
"code": null,
"e": 419108,
"s": 418975,
"text": "Depending on the size of the organization and the number of products that are manufactured, a supply chain may be complex or simple."
},
{
"code": null,
"e": 419270,
"s": 419108,
"text": "Supply Chain Management refers to the management of an interconnected network of businesses involved in the ultimate delivery of goods and services to customers."
},
{
"code": null,
"e": 419463,
"s": 419270,
"text": "It entails the storage and transport of raw materials, the process of inventory and the storage and transportation of the final goods from the point of manufacture to the point of consumption."
},
{
"code": null,
"e": 419837,
"s": 419463,
"text": "Customer - The start of the supply chain is the customer. The customer decides to purchase a product and in turn contacts the sales department of a company. A sales order is completed with the date of delivery and the quantity of the product requested. It may also include a segment for the production facility depending on whether the product is available in stock or not."
},
{
"code": null,
"e": 420211,
"s": 419837,
"text": "Customer - The start of the supply chain is the customer. The customer decides to purchase a product and in turn contacts the sales department of a company. A sales order is completed with the date of delivery and the quantity of the product requested. It may also include a segment for the production facility depending on whether the product is available in stock or not."
},
{
"code": null,
"e": 420464,
"s": 420211,
"text": "Planning - Once the customer has made his/her sales order, the planning department will create a production plan to produce the product adhering to the needs of the customer. At this stage, the planning department will be aware of raw materials needed."
},
{
"code": null,
"e": 420717,
"s": 420464,
"text": "Planning - Once the customer has made his/her sales order, the planning department will create a production plan to produce the product adhering to the needs of the customer. At this stage, the planning department will be aware of raw materials needed."
},
{
"code": null,
"e": 420951,
"s": 420717,
"text": "Purchasing - If raw materials are required, the purchasing department will be notified and they in turn send purchasing orders to the suppliers asking for the deliverance of a specific quantity of raw materials on the required date. "
},
{
"code": null,
"e": 421185,
"s": 420951,
"text": "Purchasing - If raw materials are required, the purchasing department will be notified and they in turn send purchasing orders to the suppliers asking for the deliverance of a specific quantity of raw materials on the required date. "
},
{
"code": null,
"e": 421367,
"s": 421185,
"text": "Inventory - Once the raw materials have been delivered, they are checked for quality and accuracy and then stored in a warehouse till they are required by the production department."
},
{
"code": null,
"e": 421549,
"s": 421367,
"text": "Inventory - Once the raw materials have been delivered, they are checked for quality and accuracy and then stored in a warehouse till they are required by the production department."
},
{
"code": null,
"e": 421912,
"s": 421549,
"text": "Production - Raw materials are moved to the production site, according to the specifics laid out in the production plan. The products required by the customer are now manufactured using the raw materials supplied by the suppliers. The completed products are then tested and moved back to the warehouse depending on the date of delivery required by the customer. "
},
{
"code": null,
"e": 422275,
"s": 421912,
"text": "Production - Raw materials are moved to the production site, according to the specifics laid out in the production plan. The products required by the customer are now manufactured using the raw materials supplied by the suppliers. The completed products are then tested and moved back to the warehouse depending on the date of delivery required by the customer. "
},
{
"code": null,
"e": 422479,
"s": 422275,
"text": "Transportation - When the finished product is moved into storage, the shipping department or the transportation department determines when the product leaves the warehouse to reach the customer on time. "
},
{
"code": null,
"e": 422683,
"s": 422479,
"text": "Transportation - When the finished product is moved into storage, the shipping department or the transportation department determines when the product leaves the warehouse to reach the customer on time. "
},
{
"code": null,
"e": 422940,
"s": 422683,
"text": "In order to make sure that the above supply chain is running smoothly and also to ensure maximum customer satisfaction at the lowest possible cost, organizations adopt supply chain management processes and various technologies to assist in these processes."
},
{
"code": null,
"e": 423120,
"s": 422940,
"text": "There are three levels of activities Supply Chain Management in that different departments of an organization focus on to achieve the smooth running of the supply chain. They are:"
},
{
"code": null,
"e": 423454,
"s": 423120,
"text": "Strategic - At this level, senior management is involved in the supply chain process and makes decisions that concern the entire organization. Decisions made at this level include the size and site of the production area, the collaborations with suppliers, and the type of that product that is going to be manufactured and so forth. "
},
{
"code": null,
"e": 423788,
"s": 423454,
"text": "Strategic - At this level, senior management is involved in the supply chain process and makes decisions that concern the entire organization. Decisions made at this level include the size and site of the production area, the collaborations with suppliers, and the type of that product that is going to be manufactured and so forth. "
},
{
"code": null,
"e": 424052,
"s": 423788,
"text": "Tactical - Tactical level of activity focuses on achieving lowest costs for running the supply chain. Some of the ways this is done is by creating a purchasing plan with a preferred suppliers and working with transportation companies for cost effective transport."
},
{
"code": null,
"e": 424316,
"s": 424052,
"text": "Tactical - Tactical level of activity focuses on achieving lowest costs for running the supply chain. Some of the ways this is done is by creating a purchasing plan with a preferred suppliers and working with transportation companies for cost effective transport."
},
{
"code": null,
"e": 424628,
"s": 424316,
"text": "Operational - At the operational level, activity decisions are made on a day-to-day basis and these decisions affect how the product shifts along the supply chain. Some of the decisions taken at this level include taking customer orders and the movement of goods from the warehouse to the point of consumption. "
},
{
"code": null,
"e": 424940,
"s": 424628,
"text": "Operational - At the operational level, activity decisions are made on a day-to-day basis and these decisions affect how the product shifts along the supply chain. Some of the decisions taken at this level include taking customer orders and the movement of goods from the warehouse to the point of consumption. "
},
{
"code": null,
"e": 425056,
"s": 424940,
"text": "In order to maximize benefits from the supply chain management process, organizations need to invest in technology."
},
{
"code": null,
"e": 425188,
"s": 425056,
"text": "For the optimal working of the supply chain management process, organizations mainly invest in Enterprise Resource Planning suites."
},
{
"code": null,
"e": 425314,
"s": 425188,
"text": "Also, the advancement of Internet technologies allows organizations to adopt Web-based software and Internet communications. "
},
{
"code": null,
"e": 425497,
"s": 425314,
"text": "A number of experts in the field of supply chain management have tried to provide theoretical foundations for some areas of supply chain management by adopting organizational theory."
},
{
"code": null,
"e": 425525,
"s": 425497,
"text": "Some of these theories are:"
},
{
"code": null,
"e": 425551,
"s": 425525,
"text": "Resource-Based View (RBV)"
},
{
"code": null,
"e": 425583,
"s": 425551,
"text": "Transaction Cost Analysis (TCA)"
},
{
"code": null,
"e": 425610,
"s": 425583,
"text": "Knowledge-Based View (KBV)"
},
{
"code": null,
"e": 425640,
"s": 425610,
"text": "Strategic Choice Theory (SCT)"
},
{
"code": null,
"e": 425659,
"s": 425640,
"text": "Agency Theory (AT)"
},
{
"code": null,
"e": 425686,
"s": 425659,
"text": "Institutional theory (InT)"
},
{
"code": null,
"e": 425706,
"s": 425686,
"text": "Systems Theory (ST)"
},
{
"code": null,
"e": 425731,
"s": 425706,
"text": "Network Perspective (NP)"
},
{
"code": null,
"e": 425878,
"s": 425731,
"text": "Supply Chain Management is a branch of management that involves suppliers, manufacturers, logistic providers, and most importantly, the customers."
},
{
"code": null,
"e": 426082,
"s": 425878,
"text": "The supply chain management process works through the implication of a strategic plan that ensures the desired end product leaving a customer with maximum satisfaction levels at the lowest possible cost."
},
{
"code": null,
"e": 426256,
"s": 426082,
"text": "The activities or the functions involved in this type of management process are divided into three levels: the strategic level, the tactical level and the operational level."
},
{
"code": null,
"e": 426460,
"s": 426256,
"text": "Team building programs can be found everywhere nowadays. Almost all the business organizations send their project teams for team building programs every now and then. But what is a team building program?"
},
{
"code": null,
"e": 426676,
"s": 426460,
"text": "In team building programs, the entire program focuses on improving the group dynamics of the target team. Therefore, first of all, all the team members of the group should be present for such team building programs."
},
{
"code": null,
"e": 426885,
"s": 426676,
"text": "Usually, team building programs take various faces and there are a lot of activities included in such programs. Each activity is focused on improving one or more aspects of teamwork. Take trust as an example."
},
{
"code": null,
"e": 427114,
"s": 426885,
"text": "Trust towards other team members is one of the most important aspects when it comes to teamwork. In a corporate environment, you may not get an opportunity to get to know the other team members in detail and build trust in them."
},
{
"code": null,
"e": 427287,
"s": 427114,
"text": "Therefore, team building programs address this matter during the teamwork activities and improve the trust between the team members. A good example is the blinded guidance."
},
{
"code": null,
"e": 427453,
"s": 427287,
"text": "In this exercise, one person is blind-folded and the other person is supposed to take the blind-folded person through a rough terrain, just by guiding through voice."
},
{
"code": null,
"e": 427666,
"s": 427453,
"text": "If team building programs are very serious, teamwork should also be a serious matter right? Yes, in order to understand the importance of team building programs, one should first understand the value of teamwork."
},
{
"code": null,
"e": 427745,
"s": 427666,
"text": "Following are the benefits gained through team building programs for teamwork:"
},
{
"code": null,
"e": 427794,
"s": 427745,
"text": "Improved communication with the rest of the team"
},
{
"code": null,
"e": 427843,
"s": 427794,
"text": "Improved communication with the rest of the team"
},
{
"code": null,
"e": 427927,
"s": 427843,
"text": "Ease the conflicts and frustrations in the workplace and especially within the team"
},
{
"code": null,
"e": 428011,
"s": 427927,
"text": "Ease the conflicts and frustrations in the workplace and especially within the team"
},
{
"code": null,
"e": 428065,
"s": 428011,
"text": "Enhanced client relationships and conflict resolution"
},
{
"code": null,
"e": 428119,
"s": 428065,
"text": "Enhanced client relationships and conflict resolution"
},
{
"code": null,
"e": 428164,
"s": 428119,
"text": "High team productivity through understanding"
},
{
"code": null,
"e": 428209,
"s": 428164,
"text": "High team productivity through understanding"
},
{
"code": null,
"e": 428245,
"s": 428209,
"text": "Enhanced management and soft skills"
},
{
"code": null,
"e": 428281,
"s": 428245,
"text": "Enhanced management and soft skills"
},
{
"code": null,
"e": 428304,
"s": 428281,
"text": "Enhanced relationships"
},
{
"code": null,
"e": 428327,
"s": 428304,
"text": "Enhanced relationships"
},
{
"code": null,
"e": 428631,
"s": 428327,
"text": "In addition to the above benefits, there can be many other enhancements to the team culture. If the team was a brand new team assembled for a new project, the team members will develop a good relationship with others. After a team building program, usually a change in the team dynamics can be observed."
},
{
"code": null,
"e": 428864,
"s": 428631,
"text": "Sending a team for team building programs is not just enough. The management should track the progress of such programs and should send the team again for similar experiences when the effect of the first program is reduced overtime."
},
{
"code": null,
"e": 428996,
"s": 428864,
"text": "The work pressure of the workplace and new comers to the team are two of key reasons for reduced effectiveness that occur overtime."
},
{
"code": null,
"e": 429242,
"s": 428996,
"text": "There are many types of team building programs in use. Each type is suitable for addressing certain types of team building requirements. As an example, sending middle-aged employees to a program designed for youth will not create a great result."
},
{
"code": null,
"e": 429313,
"s": 429242,
"text": "Following are some of the most common types of team building programs:"
},
{
"code": null,
"e": 429335,
"s": 429313,
"text": "Corporate conferences"
},
{
"code": null,
"e": 429357,
"s": 429335,
"text": "Corporate conferences"
},
{
"code": null,
"e": 429403,
"s": 429357,
"text": "Executive team building and guidance programs"
},
{
"code": null,
"e": 429449,
"s": 429403,
"text": "Executive team building and guidance programs"
},
{
"code": null,
"e": 429468,
"s": 429449,
"text": "Adventure programs"
},
{
"code": null,
"e": 429487,
"s": 429468,
"text": "Adventure programs"
},
{
"code": null,
"e": 429502,
"s": 429487,
"text": "Outdoor sports"
},
{
"code": null,
"e": 429517,
"s": 429502,
"text": "Outdoor sports"
},
{
"code": null,
"e": 429528,
"s": 429517,
"text": "Game shows"
},
{
"code": null,
"e": 429539,
"s": 429528,
"text": "Game shows"
},
{
"code": null,
"e": 429554,
"s": 429539,
"text": "Youth programs"
},
{
"code": null,
"e": 429569,
"s": 429554,
"text": "Youth programs"
},
{
"code": null,
"e": 429629,
"s": 429569,
"text": "Religious or charity programs sponsored by the organization"
},
{
"code": null,
"e": 429689,
"s": 429629,
"text": "Religious or charity programs sponsored by the organization"
},
{
"code": null,
"e": 429718,
"s": 429689,
"text": "Management training programs"
},
{
"code": null,
"e": 429747,
"s": 429718,
"text": "Management training programs"
},
{
"code": null,
"e": 429767,
"s": 429747,
"text": "White-water rafting"
},
{
"code": null,
"e": 429787,
"s": 429767,
"text": "White-water rafting"
},
{
"code": null,
"e": 429809,
"s": 429787,
"text": "Residential workshops"
},
{
"code": null,
"e": 429831,
"s": 429809,
"text": "Residential workshops"
},
{
"code": null,
"e": 430190,
"s": 429831,
"text": "There are two main categories of team building programs; internal and external. Internal team building programs are designed usually by the training and development department of the organization. The events may take place in the workplace or at a location outside of the workplace. In these programs, someone from the organization will conduct the training."
},
{
"code": null,
"e": 430354,
"s": 430190,
"text": "For the next category, an external party is invited to do the team building program. This event may also take place inside the workplace or at an outside location."
},
{
"code": null,
"e": 430513,
"s": 430354,
"text": "When it comes to the effectiveness of the team building programs, usually the programs conducted by outside parties at a remote location are quite successful."
},
{
"code": null,
"e": 430660,
"s": 430513,
"text": "The very feeling of being away from the workplace gives the team a fresh state of mind and they are freer to engage with team building activities."
},
{
"code": null,
"e": 430855,
"s": 430660,
"text": "For any team, regardless of what they should be collectively achieved, team building is a key strength. In order to get the best out of a team, the team should go through team building programs."
},
{
"code": null,
"e": 431057,
"s": 430855,
"text": "Although most of the companies try to conduct indoor programs for this purpose, they deliver less effective results compared to team building events done by 3rd party professionals at remote locations."
},
{
"code": null,
"e": 431375,
"s": 431057,
"text": "Motivation plays an impeccably valuable role in any organization. It is a trait that should be instilled in every employee of an organization, despite their designation or responsibilities. Having stated that, it is imperative that senior management looks at ways of increasing team motivation within an organization."
},
{
"code": null,
"e": 431551,
"s": 431375,
"text": "Team structures may vary depending on the function in an organization that is assigned to a group of people to the mere fact of a group of people belonging to an organization."
},
{
"code": null,
"e": 431737,
"s": 431551,
"text": "Whatever the nature of the team formation is, it is important that such groups of people falling into one or more teams act in harmony and in line with an organization's ultimate goals."
},
{
"code": null,
"e": 431852,
"s": 431737,
"text": "On the outset you may feel that some managers really enjoy belittling employees and shouting at them all the time."
},
{
"code": null,
"e": 432135,
"s": 431852,
"text": "Such approach to motivation is guided by the fear factor principal and is a very primary approach; one that we know from our childhood. Therefore, the effects of such negative motivational techniques will surely be effective in short term as against the desired result of long term."
},
{
"code": null,
"e": 432273,
"s": 432135,
"text": "Some managers also tend to set unrealistic goals before their teams in hopes of getting team members to work harder and more effectively."
},
{
"code": null,
"e": 432484,
"s": 432273,
"text": "However, as this delusion takes its stance, employees will become understanding of the unrealistic nature of the goals and also will feel demotivated at the same time due to the lack of achievement orientation."
},
{
"code": null,
"e": 432663,
"s": 432484,
"text": "Since the primary approach of negative motivation techniques have not brought about effective results, more and more managers have now turned to positive motivational techniques."
},
{
"code": null,
"e": 432746,
"s": 432663,
"text": "Guiding a team's motivation based on positive reinforcement involves a few steps: "
},
{
"code": null,
"e": 432914,
"s": 432746,
"text": "You will need to understand individual strengths and weaknesses and how these strengths and weaknesses affect the person and his/her team when operating within a team."
},
{
"code": null,
"e": 433082,
"s": 432914,
"text": "You will need to understand individual strengths and weaknesses and how these strengths and weaknesses affect the person and his/her team when operating within a team."
},
{
"code": null,
"e": 433137,
"s": 433082,
"text": "Building self-esteem of both the team and individuals."
},
{
"code": null,
"e": 433192,
"s": 433137,
"text": "Building self-esteem of both the team and individuals."
},
{
"code": null,
"e": 433345,
"s": 433192,
"text": "Assigning value to each team member (e.g., seeking their opinion, sharing information and allowing their contribution to play a role in team decisions)."
},
{
"code": null,
"e": 433498,
"s": 433345,
"text": "Assigning value to each team member (e.g., seeking their opinion, sharing information and allowing their contribution to play a role in team decisions)."
},
{
"code": null,
"e": 433677,
"s": 433498,
"text": "So you may evaluate an individual's strengths and weaknesses and may falsely conclude that this person will not function effectively within a team due to his/her personal traits."
},
{
"code": null,
"e": 433937,
"s": 433677,
"text": "But unless otherwise you put this person in a team environment and observe the team dynamics, you wouldn't definitely know the outcome. Therefore, the rule of the thumb for any manager is not to isolate their team members due to assumptions that you may hold."
},
{
"code": null,
"e": 434125,
"s": 433937,
"text": "Secondly, it should be noted that people differ from one another. Therefore, when it comes to team motivation, the managers will need to do certain things to balance out negative effects."
},
{
"code": null,
"e": 434353,
"s": 434125,
"text": "You will be dealing with different personalities therefore, although there are set of rules by which a team operates, your diplomacy and flexibility in operation too will contribute to successful team motivation to be retained."
},
{
"code": null,
"e": 434512,
"s": 434353,
"text": "The third factor is not to isolate black sheep. Any family or any organization will have black sheep. These are radical individuals, who seek extra attention."
},
{
"code": null,
"e": 434777,
"s": 434512,
"text": "Therefore, rather than isolating these characters, you will need to be skillful enough to reassure a sense of belonging to such individuals. The truth of the matter is that once such individuals feel secured and important, they will become very loyal to his clan. "
},
{
"code": null,
"e": 434927,
"s": 434777,
"text": "A little bit of psychology goes a long way in motivating teams. You do not need to have studied psychology formally to understand the basic concepts."
},
{
"code": null,
"e": 435177,
"s": 434927,
"text": "However, it would come in handy if you have read about a couple of motivational theories and motivational factors that contribute to human dynamics. When you know underlying factors of a certain concept, you will be better able to address the issue."
},
{
"code": null,
"e": 435429,
"s": 435177,
"text": "If you are mentoring a team and if you are trying to build team spirit among the individuals, but if you are not a good spirited individual yourself, it will become extremely difficult for you to get your team to achieve a sense of identity as a team."
},
{
"code": null,
"e": 435528,
"s": 435429,
"text": "So a team should always have someone leading by example in order to become motivated sufficiently."
},
{
"code": null,
"e": 435705,
"s": 435528,
"text": "And lastly but not in the very least, try to strike a balance between work and fun. Every team needs to engage in work and non-work related activities to build up their spirit."
},
{
"code": null,
"e": 435980,
"s": 435705,
"text": "Therefore, make sure that your team received plenty of opportunities to mingle with one another and share a good laughter. Little things go a long way in human dynamics and such spirits built over a cup of coffee will take your organization a long way at the end of the day."
},
{
"code": null,
"e": 436202,
"s": 435980,
"text": "The balance scorecard is used as a strategic planning and a management technique. This is widely used in many organizations, regardless of their scale, to align the organization's performance to its vision and objectives."
},
{
"code": null,
"e": 436392,
"s": 436202,
"text": "The scorecard is also used as a tool, which improves the communication and feedback process between the employees and management and to monitor performance of the organizational objectives."
},
{
"code": null,
"e": 436653,
"s": 436392,
"text": "As the name depicts, the balanced scorecard concept was developed not only to evaluate the financial performance of a business organization, but also to address customer concerns, business process optimization, and enhancement of learning tools and mechanisms."
},
{
"code": null,
"e": 436912,
"s": 436653,
"text": "Following is the simplest illustration of the concept of balanced scorecard. The four boxes represent the main areas of consideration under balanced scorecard. All four main areas of consideration are bound by the business organization's vision and strategy."
},
{
"code": null,
"e": 437054,
"s": 436912,
"text": "The balanced scorecard is divided into four main areas and a successful organization is one that finds the right balance between these areas."
},
{
"code": null,
"e": 437178,
"s": 437054,
"text": "Each area (perspective) represents a different aspect of the business organization in order to operate at optimal capacity."
},
{
"code": null,
"e": 437345,
"s": 437178,
"text": "Financial Perspective - This consists of costs or measurement involved, in terms of rate of return on capital (ROI) employed and operating income of the organization."
},
{
"code": null,
"e": 437512,
"s": 437345,
"text": "Financial Perspective - This consists of costs or measurement involved, in terms of rate of return on capital (ROI) employed and operating income of the organization."
},
{
"code": null,
"e": 437642,
"s": 437512,
"text": "Customer Perspective - Measures the level of customer satisfaction, customer retention and market share held by the organization."
},
{
"code": null,
"e": 437772,
"s": 437642,
"text": "Customer Perspective - Measures the level of customer satisfaction, customer retention and market share held by the organization."
},
{
"code": null,
"e": 437889,
"s": 437772,
"text": "Business Process Perspective - This consists of measures such as cost and quality related to the business processes."
},
{
"code": null,
"e": 438006,
"s": 437889,
"text": "Business Process Perspective - This consists of measures such as cost and quality related to the business processes."
},
{
"code": null,
"e": 438137,
"s": 438006,
"text": "Learning and Growth Perspective - Consists of measures such as employee satisfaction, employee retention and knowledge management."
},
{
"code": null,
"e": 438268,
"s": 438137,
"text": "Learning and Growth Perspective - Consists of measures such as employee satisfaction, employee retention and knowledge management."
},
{
"code": null,
"e": 438479,
"s": 438268,
"text": "The four perspectives are interrelated. Therefore, they do not function independently. In real-world situations, organizations need one or more perspectives combined together to achieve its business objectives."
},
{
"code": null,
"e": 438637,
"s": 438479,
"text": "For example, Customer Perspective is needed to determine the Financial Perspective, which in turn can be used to improve the Learning and Growth Perspective."
},
{
"code": null,
"e": 438824,
"s": 438637,
"text": "From the above diagram, you will see that there are four perspectives on a balanced scorecard. Each of these four perspectives should be considered with respect to the following factors."
},
{
"code": null,
"e": 438915,
"s": 438824,
"text": "When it comes to defining and assessing the four perspectives, following factors are used:"
},
{
"code": null,
"e": 439011,
"s": 438915,
"text": "Objectives - This reflects the organization's objectives such as profitability or market share."
},
{
"code": null,
"e": 439107,
"s": 439011,
"text": "Objectives - This reflects the organization's objectives such as profitability or market share."
},
{
"code": null,
"e": 439220,
"s": 439107,
"text": "Measures - Based on the objectives, measures will be put in place to gauge the progress of achieving objectives."
},
{
"code": null,
"e": 439333,
"s": 439220,
"text": "Measures - Based on the objectives, measures will be put in place to gauge the progress of achieving objectives."
},
{
"code": null,
"e": 439474,
"s": 439333,
"text": "Targets - This could be department based or overall as a company. There will be specific targets that have been set to achieve the measures."
},
{
"code": null,
"e": 439615,
"s": 439474,
"text": "Targets - This could be department based or overall as a company. There will be specific targets that have been set to achieve the measures."
},
{
"code": null,
"e": 439705,
"s": 439615,
"text": "Initiatives - These could be classified as actions that are taken to meet the objectives."
},
{
"code": null,
"e": 439795,
"s": 439705,
"text": "Initiatives - These could be classified as actions that are taken to meet the objectives."
},
{
"code": null,
"e": 439955,
"s": 439795,
"text": "The objective of the balanced scorecard was to create a system, which could measure the performance of an organization and to improve any back lags that occur."
},
{
"code": null,
"e": 440165,
"s": 439955,
"text": "The popularity of the balanced scorecard increased over time due to its logical process and methods. Hence, it became a management strategy, which could be used across various functions within an organization."
},
{
"code": null,
"e": 440351,
"s": 440165,
"text": "The balanced scorecard helped the management to understand its objectives and roles in the bigger picture. It also helps management team to measure the performance in terms of quantity."
},
{
"code": null,
"e": 440454,
"s": 440351,
"text": "The balanced scorecard also plays a vital role when it comes to communication of strategic objectives."
},
{
"code": null,
"e": 440622,
"s": 440454,
"text": "One of the main reasons for many organizations to be unsuccessful is that they fail to understand and adhere to the objectives that have been set for the organization."
},
{
"code": null,
"e": 440767,
"s": 440622,
"text": "The balanced scorecard provides a solution for this by breaking down objectives and making it easier for management and employees to understand."
},
{
"code": null,
"e": 440973,
"s": 440767,
"text": "Planning, setting targets and aligning strategy are two of the key areas where the balanced scorecard can contribute. Targets are set out for each of the four perspectives in terms of long-term objectives."
},
{
"code": null,
"e": 441097,
"s": 440973,
"text": "However, these targets are mostly achievable even in the short run. Measures are taken in align with achieving the targets."
},
{
"code": null,
"e": 441336,
"s": 441097,
"text": "Strategic feedback and learning is the next area, where the balanced scorecard plays a role. In strategic feedback and learning, the management gets up-to-date reviews regarding the success of the plan and the performance of the strategy."
},
{
"code": null,
"e": 441431,
"s": 441336,
"text": "Following are some of the points that describe the need for implementing a balanced scorecard:"
},
{
"code": null,
"e": 441494,
"s": 441431,
"text": "Increases the focus on the business strategy and its outcomes."
},
{
"code": null,
"e": 441557,
"s": 441494,
"text": "Increases the focus on the business strategy and its outcomes."
},
{
"code": null,
"e": 441626,
"s": 441557,
"text": "Leads to improvised organizational performance through measurements."
},
{
"code": null,
"e": 441695,
"s": 441626,
"text": "Leads to improvised organizational performance through measurements."
},
{
"code": null,
"e": 441774,
"s": 441695,
"text": "Align the workforce to meet the organization's strategy on a day-to-day basis."
},
{
"code": null,
"e": 441853,
"s": 441774,
"text": "Align the workforce to meet the organization's strategy on a day-to-day basis."
},
{
"code": null,
"e": 441918,
"s": 441853,
"text": "Targeting the key determinants or drivers of future performance."
},
{
"code": null,
"e": 441983,
"s": 441918,
"text": "Targeting the key determinants or drivers of future performance."
},
{
"code": null,
"e": 442074,
"s": 441983,
"text": "Improves the level of communication in relation to the organization's strategy and vision."
},
{
"code": null,
"e": 442165,
"s": 442074,
"text": "Improves the level of communication in relation to the organization's strategy and vision."
},
{
"code": null,
"e": 442249,
"s": 442165,
"text": "Helps to prioritize projects according to the timeframe and other priority factors."
},
{
"code": null,
"e": 442333,
"s": 442249,
"text": "Helps to prioritize projects according to the timeframe and other priority factors."
},
{
"code": null,
"e": 442461,
"s": 442333,
"text": "As the name denotes, balanced scorecard creates a right balance between the components of organization's objectives and vision."
},
{
"code": null,
"e": 442596,
"s": 442461,
"text": "It's a mechanism that helps the management to track down the performance of the organization and can be used as a management strategy."
},
{
"code": null,
"e": 442710,
"s": 442596,
"text": "It provides an extensive overview of a company's objectives rather than limiting itself only to financial values."
},
{
"code": null,
"e": 442843,
"s": 442710,
"text": "This creates a strong brand name amongst its existing and potential customers and a reputation amongst the organization's workforce."
},
{
"code": null,
"e": 442974,
"s": 442843,
"text": "The halo effect has a close relationship with marketing. Marketing is the number one field where halo effect is successfully used."
},
{
"code": null,
"e": 443186,
"s": 442974,
"text": "Halo effect simply explains the biasness showed by customers to certain products or services based on some favourable or pleasant experience with some other products or services offered by the same manufacturer."
},
{
"code": null,
"e": 443403,
"s": 443186,
"text": "Let's take an example. Apple introduced the iPod some years ago and it was creative in its functions and design. Apple iPod introduced a gateway to novel thinking and extremely eye-pleasing experience for iPod users."
},
{
"code": null,
"e": 443605,
"s": 443403,
"text": "The positive perception about Apple's iPod then had a positive effect on other Apple products. With the introduction of iPod, Apple noticed a high demand and increased sales for rest of their products."
},
{
"code": null,
"e": 443947,
"s": 443605,
"text": "This is again common in the automotive industry. An automaker may introduce a halo vehicle in order to create positive perception of their products in the hope of increasing sales of their other vehicle models as well. The halo cars are mostly sports cars that are mostly related to eye-pleasing designs, superior performance and technology."
},
{
"code": null,
"e": 444152,
"s": 443947,
"text": "Halo effect has its drawbacks as well. Although one halo product can make a huge difference in sales, one bad product can also ruin the reputation of an entire company. This is the reverse of halo effect."
},
{
"code": null,
"e": 444330,
"s": 444152,
"text": "Toyoto Prius, the hybrid car, is one of the best examples of reverse halo effect in the recent times. Toyota is usually considered as the best quality car manufacturer in Japan."
},
{
"code": null,
"e": 444649,
"s": 444330,
"text": "But recently, an issue cropped up with the latest Prius model where, it had a faulty accelerator pad. Due to this issue, Prius gas pedal could jam once pressed hard and could lead to accidents as well. Once this was uncovered by a few customers, Toyota recalled thousands of Prius cars to replace the faulty gas pedal."
},
{
"code": null,
"e": 444952,
"s": 444649,
"text": "The issue did not stop there. Customers then started noticing similar problems, not essentially related to the gas pedals, in other, more established models, where there were no issues reported earlier. This is an incident describing reverse halo effect. Sometimes, this is also called cannibalization."
},
{
"code": null,
"e": 445166,
"s": 444952,
"text": "Halo effect is best described using the concept of unconscious judgement. When we judge something, we may run through an analysis and critical thinking. But, there is part of judgement which is done unconsciously."
},
{
"code": null,
"e": 445366,
"s": 445166,
"text": "We are not consciously aware of this judgement process. This is why we cannot explain why we are attracted to certain products from certain companies more than the same products from other companies."
},
{
"code": null,
"e": 445562,
"s": 445366,
"text": "The halo effect is one of the best tools for marketing. Marketing concepts and strategies employ the halo effect in order to get the best results when it comes to promoting products and services."
},
{
"code": null,
"e": 445876,
"s": 445562,
"text": "Although a halo product or a service is used for making a positive impact on a customer's mind in order to sell rest of the goods or services, sometimes other techniques are also used. One of the popular tricks is to use 'go green' or 'save environment' themes to create a positive perception among the customers."
},
{
"code": null,
"e": 446004,
"s": 445876,
"text": "The pleasant experience the customer may have with such campaigns may be useful for selling more products and services to them."
},
{
"code": null,
"e": 446249,
"s": 446004,
"text": "Although halo effect is useful and advantageous for businesses, it is not quite beneficial for the end customers. Judging a product or service by some other product or service from the same manufacturer may mislead them in their buying process."
},
{
"code": null,
"e": 446422,
"s": 446249,
"text": "In such cases, people do not assess the pros and cons of the product or the service they want to buy. Instead they allow the perceptions to influence their buying decision."
},
{
"code": null,
"e": 446653,
"s": 446422,
"text": "Are you outsourcing enough? This was one of the main questions asked by management consultants during the outsourcing boom. Outsourcing was viewed as one of the best ways of getting things done for a fraction of the original cost."
},
{
"code": null,
"e": 446838,
"s": 446653,
"text": "Outsourcing is closely related to make or buy decision. The corporations made decisions on what to make internally and what to buy from outside in order to maximize the profit margins."
},
{
"code": null,
"e": 447024,
"s": 446838,
"text": "As a result of this, the organizational functions were divided into segments and some of those functions were outsourced to expert companies, who can do the same job for much less cost."
},
{
"code": null,
"e": 447216,
"s": 447024,
"text": "Make or buy decision is always a valid concept in business. No organization should attempt to make something by their own, when they stand the opportunity to buy the same for much less price."
},
{
"code": null,
"e": 447368,
"s": 447216,
"text": "This is why most of the electronic items manufactured and software systems developed in the Asia, on behalf of the organizations in the USA and Europe."
},
{
"code": null,
"e": 447606,
"s": 447368,
"text": "When you are supposed to make a make-or-buy decision, there are four numbers you need to be aware of. Your decision will be based on the values of these four numbers. Let's have a look at the numbers now. They are quite self-explanatory."
},
{
"code": null,
"e": 447617,
"s": 447606,
"text": "The volume"
},
{
"code": null,
"e": 447642,
"s": 447617,
"text": "The fixed cost of making"
},
{
"code": null,
"e": 447675,
"s": 447642,
"text": "Per-unit direct cost when making"
},
{
"code": null,
"e": 447701,
"s": 447675,
"text": "Per-unit cost when buying"
},
{
"code": null,
"e": 447890,
"s": 447701,
"text": "Now, there are two formulas that use the above numbers. They are 'Cost to Buy' and 'Cost to Make'. The higher value loses and the decision maker can go ahead with the less costly solution."
},
{
"code": null,
"e": 448012,
"s": 447890,
"text": "Cost to Buy (CTB) = Volume x Per-unit cost when buying\nCost to Make (CTM) = Fixed costs + (Per-unit direct cost x volume)"
},
{
"code": null,
"e": 448120,
"s": 448012,
"text": "There are number of reasons a company would consider when it comes to making in-house. Following are a few:"
},
{
"code": null,
"e": 448134,
"s": 448120,
"text": "Cost concerns"
},
{
"code": null,
"e": 448175,
"s": 448134,
"text": "Desire to expand the manufacturing focus"
},
{
"code": null,
"e": 448215,
"s": 448175,
"text": "Need of direct control over the product"
},
{
"code": null,
"e": 448246,
"s": 448215,
"text": "Intellectual property concerns"
},
{
"code": null,
"e": 448271,
"s": 448246,
"text": "Quality control concerns"
},
{
"code": null,
"e": 448294,
"s": 448271,
"text": "Supplier unreliability"
},
{
"code": null,
"e": 448322,
"s": 448294,
"text": "Lack of competent suppliers"
},
{
"code": null,
"e": 448367,
"s": 448322,
"text": "Volume too small to get a supplier attracted"
},
{
"code": null,
"e": 448411,
"s": 448367,
"text": "Reduction of logistic costs (shipping etc.)"
},
{
"code": null,
"e": 448439,
"s": 448411,
"text": "To maintain a backup source"
},
{
"code": null,
"e": 448473,
"s": 448439,
"text": "Political and environment reasons"
},
{
"code": null,
"e": 448494,
"s": 448473,
"text": "Organizational pride"
},
{
"code": null,
"e": 448592,
"s": 448494,
"text": "Following are some of the reasons companies may consider when it comes to buying from a supplier:"
},
{
"code": null,
"e": 448621,
"s": 448592,
"text": "Lack of technical experience"
},
{
"code": null,
"e": 448650,
"s": 448621,
"text": "Lack of technical experience"
},
{
"code": null,
"e": 448709,
"s": 448650,
"text": "Supplier's expertise on the technical areas and the domain"
},
{
"code": null,
"e": 448768,
"s": 448709,
"text": "Supplier's expertise on the technical areas and the domain"
},
{
"code": null,
"e": 448788,
"s": 448768,
"text": "Cost considerations"
},
{
"code": null,
"e": 448808,
"s": 448788,
"text": "Cost considerations"
},
{
"code": null,
"e": 448829,
"s": 448808,
"text": "Need of small volume"
},
{
"code": null,
"e": 448850,
"s": 448829,
"text": "Need of small volume"
},
{
"code": null,
"e": 448892,
"s": 448850,
"text": "Insufficient capacity to produce in-house"
},
{
"code": null,
"e": 448934,
"s": 448892,
"text": "Insufficient capacity to produce in-house"
},
{
"code": null,
"e": 448952,
"s": 448934,
"text": "Brand preferences"
},
{
"code": null,
"e": 448970,
"s": 448952,
"text": "Brand preferences"
},
{
"code": null,
"e": 448993,
"s": 448970,
"text": "Strategic partnerships"
},
{
"code": null,
"e": 449016,
"s": 448993,
"text": "Strategic partnerships"
},
{
"code": null,
"e": 449282,
"s": 449016,
"text": "The make or buy decision can be in many scales. If the decision is small in nature and has less impact on the business, then even one person can make the decision. The person can consider the pros and cons between making and buying and finally arrive at a decision."
},
{
"code": null,
"e": 449464,
"s": 449282,
"text": "When it comes to larger and high impact decisions, usually organizations follow a standard method to arrive at a decision. This method can be divided into four main stages as below."
},
{
"code": null,
"e": 449513,
"s": 449464,
"text": "Team creation and appointment of the team leader"
},
{
"code": null,
"e": 449562,
"s": 449513,
"text": "Team creation and appointment of the team leader"
},
{
"code": null,
"e": 449612,
"s": 449562,
"text": "Identifying the product requirements and analysis"
},
{
"code": null,
"e": 449662,
"s": 449612,
"text": "Identifying the product requirements and analysis"
},
{
"code": null,
"e": 449704,
"s": 449662,
"text": "Team briefing and aspect/area destitution"
},
{
"code": null,
"e": 449746,
"s": 449704,
"text": "Team briefing and aspect/area destitution"
},
{
"code": null,
"e": 449812,
"s": 449746,
"text": "Collecting information on various aspects of make-or-buy decision"
},
{
"code": null,
"e": 449878,
"s": 449812,
"text": "Collecting information on various aspects of make-or-buy decision"
},
{
"code": null,
"e": 449942,
"s": 449878,
"text": "Workshops on weightings, ratings, and cost for both make-or-buy"
},
{
"code": null,
"e": 450006,
"s": 449942,
"text": "Workshops on weightings, ratings, and cost for both make-or-buy"
},
{
"code": null,
"e": 450032,
"s": 450006,
"text": "Analysis of data gathered"
},
{
"code": null,
"e": 450058,
"s": 450032,
"text": "Analysis of data gathered"
},
{
"code": null,
"e": 450088,
"s": 450058,
"text": "Feedback on the decision made"
},
{
"code": null,
"e": 450118,
"s": 450088,
"text": "Feedback on the decision made"
},
{
"code": null,
"e": 450345,
"s": 450118,
"text": "By following the above structured process, the organization can make an informed decision on make-or-buy. Although this is a standard process for making the make-or-buy decision, the organizations can have their own varieties."
},
{
"code": null,
"e": 450512,
"s": 450345,
"text": "Make-or-buy decision is one of the key techniques for management practice. Due to the global outsourcing, make-or-buy decision making has become popular and frequent."
},
{
"code": null,
"e": 450805,
"s": 450512,
"text": "Since the manufacturing and services industries have been diversified across the globe, there are a number of suppliers offering products and services for a fraction of the original price. This has enhanced the global product and service markets by giving the consumer the eventual advantage."
},
{
"code": null,
"e": 451037,
"s": 450805,
"text": "If you make a make-or-buy decision that can create a high impact, always use a process for doing that. When such a process is followed, the activities are transparent and the decisions are made for the best interest of the company."
},
{
"code": null,
"e": 451394,
"s": 451037,
"text": "The rule of seven is one of the oldest concepts in marketing. Although it is old, it doesn't mean that it is outdated. The rule of seven simply says that the prospective buyer should hear or see the marketing message at least seven times before they buy it from you. There may be many reasons why number seven is used. Why not rule of six or rule of eight?"
},
{
"code": null,
"e": 451551,
"s": 451394,
"text": "Traditionally, number seven have been given precedence over other numbers by many cultures. Therefore, you may notice various things coming in number seven."
},
{
"code": null,
"e": 451903,
"s": 451551,
"text": "The important thing in the rule of seven is not the number, but the message. This simply tells you that you need to let the prospect hear and see your marketing message so many times before they buy it. There are many reasons for the need of repetition. Buyers just can't trust you and make the buying decision at the first time you show your message."
},
{
"code": null,
"e": 452203,
"s": 451903,
"text": "So, this simply means that your marketing effort should be repetitive and consistent. You cannot just run a couple of advertisements one time and expect the customers to buy the product. The hidden message of rule of seven is the continuous and repetitive effort that should be put in for marketing."
},
{
"code": null,
"e": 452307,
"s": 452203,
"text": "In order to enhance your marketing through the message of rule of seven, consider the following points:"
},
{
"code": null,
"e": 452482,
"s": 452307,
"text": "Today's world is an information world. People are overloaded with information. People have access to the best information source at all times, so you cannot fool them at all."
},
{
"code": null,
"e": 452759,
"s": 452482,
"text": "If you want to convey your marketing message to the people, who have been bombarded with information, you are having tough luck. It is never easy for a person or a company to be heard by the prospective buyers. For this, you may want to use some special tricks and strategies."
},
{
"code": null,
"e": 453035,
"s": 452759,
"text": "Due to the above reason, one should repeat their marketing message. In the first few times, a person will not notice the message. People are usually resistant to marketing messages by nature. Otherwise, people will be overwhelmed by the noise made by the marketing companies."
},
{
"code": null,
"e": 453138,
"s": 453035,
"text": "You have to compete in this noisy market. So, you need to repeat your message until they hear you out."
},
{
"code": null,
"e": 453520,
"s": 453138,
"text": "You may be targeting the exact type of customers for your product or service. But there are chances that they may not need your product yet. In case if they see your marketing message once, they may not remember you when they want to buy the product by next week or next month. Therefore, you need to keep your marketing message in sight. Out of sight for marketing is out of mind."
},
{
"code": null,
"e": 453836,
"s": 453520,
"text": "Let me take an example. Most people do see and hear about great products or service and they make a mental note that they will buy those when they need it. But in reality, when they buy the actual product, they go with the latest marketing message they heard or saw. That's why you need to keep playing your record."
},
{
"code": null,
"e": 454070,
"s": 453836,
"text": "Sometimes, people do not buy things due to the price. This is nothing to do with the price of the product or the service. This simply means that you have not been able to convince the customers fully about the value of your offering."
},
{
"code": null,
"e": 454223,
"s": 454070,
"text": "If someone sees the value of your product or the service, they find a way to buy it. They never worry about the price if it's the right thing they want."
},
{
"code": null,
"e": 454409,
"s": 454223,
"text": "Therefore, through your message, convince them about the value you offer. Through rule of seven, they will hear about the value you offer many times, so the money will not be a problem."
},
{
"code": null,
"e": 454586,
"s": 454409,
"text": "This is the main reason why people do not buy your products or services. Let them know who you are through rule of seven. More they hear about you, higher they will accept you."
},
{
"code": null,
"e": 454827,
"s": 454586,
"text": "Rule of seven is one of the oldest, but practical concepts in marketing. Similarly, rule of seven can be applied to many other areas, where the consumers are concerned. The main learning from rule of seven is the need to repeat what you do."
},
{
"code": null,
"e": 455022,
"s": 454827,
"text": "A virtual team is a team where the primary method of interaction is done through electronic mediums. When it comes to the medium, it could range from e-mail communications to video conferencing."
},
{
"code": null,
"e": 455179,
"s": 455022,
"text": "Some virtual teams do not interact face-to-face (when team members reside in different demographics) and some virtual teams physically meet up occasionally."
},
{
"code": null,
"e": 455366,
"s": 455179,
"text": "Think of an online business for web development. Someone can start such a business and hire developers, QA engineers, UI engineers and project managers from different parts of the globe."
},
{
"code": null,
"e": 455525,
"s": 455366,
"text": "Since web development does not involve in physical delivery of goods and all the deliveries are done electronically, such a company can exist on the Internet."
},
{
"code": null,
"e": 455703,
"s": 455525,
"text": "Team meetings can be held through conference voice calls or video calls. This virtual team can work towards their company goals and act as a single entity just by telecommuting."
},
{
"code": null,
"e": 455789,
"s": 455703,
"text": "There are many reasons for having a virtual team. First of all, it is the technology."
},
{
"code": null,
"e": 456037,
"s": 455789,
"text": "The Internet and related technologies helped enhancing the communication across the globe, where certain industries that do not require the person to be present in physical sense could make much use of it. A good example is a web development team."
},
{
"code": null,
"e": 456101,
"s": 456037,
"text": "Following are some of the top reasons for having virtual teams:"
},
{
"code": null,
"e": 456154,
"s": 456101,
"text": "Team members are not located in the same demography."
},
{
"code": null,
"e": 456207,
"s": 456154,
"text": "Team members are not located in the same demography."
},
{
"code": null,
"e": 456262,
"s": 456207,
"text": "The transportation cost and time is quite an overhead."
},
{
"code": null,
"e": 456317,
"s": 456262,
"text": "The transportation cost and time is quite an overhead."
},
{
"code": null,
"e": 456359,
"s": 456317,
"text": "Team members may work in different times."
},
{
"code": null,
"e": 456401,
"s": 456359,
"text": "Team members may work in different times."
},
{
"code": null,
"e": 456497,
"s": 456401,
"text": "The company does not require a physical office, so the logistics and related costs are minimum."
},
{
"code": null,
"e": 456593,
"s": 456497,
"text": "The company does not require a physical office, so the logistics and related costs are minimum."
},
{
"code": null,
"e": 456760,
"s": 456593,
"text": "The type of work done may require high level of creativity, so the employees will have better creativity when they work from a place they are comfortable with (home)."
},
{
"code": null,
"e": 456927,
"s": 456760,
"text": "The type of work done may require high level of creativity, so the employees will have better creativity when they work from a place they are comfortable with (home)."
},
{
"code": null,
"e": 457023,
"s": 456927,
"text": "There are many types of virtual teams operating at present. Following are a few of those teams:"
},
{
"code": null,
"e": 457063,
"s": 457023,
"text": "Entire companies that operate virtually"
},
{
"code": null,
"e": 457103,
"s": 457063,
"text": "Entire companies that operate virtually"
},
{
"code": null,
"e": 457160,
"s": 457103,
"text": "Tasks teams, responsible of carrying out a specific task"
},
{
"code": null,
"e": 457217,
"s": 457160,
"text": "Tasks teams, responsible of carrying out a specific task"
},
{
"code": null,
"e": 457289,
"s": 457217,
"text": "Friendship teams such as groups in Facebook or any other social network"
},
{
"code": null,
"e": 457361,
"s": 457289,
"text": "Friendship teams such as groups in Facebook or any other social network"
},
{
"code": null,
"e": 457440,
"s": 457361,
"text": "Command teams, such as a sales team of a company distributed throughout the US"
},
{
"code": null,
"e": 457519,
"s": 457440,
"text": "Command teams, such as a sales team of a company distributed throughout the US"
},
{
"code": null,
"e": 457576,
"s": 457519,
"text": "Interest teams where the members share a common interest"
},
{
"code": null,
"e": 457633,
"s": 457576,
"text": "Interest teams where the members share a common interest"
},
{
"code": null,
"e": 457761,
"s": 457633,
"text": "The technology plays a vital role for virtual teams. Without the use of advanced technology, virtual teams cannot be effective."
},
{
"code": null,
"e": 457904,
"s": 457761,
"text": "The Internet is the primary technology used by the virtual teams. The Internet offers many facilities for the virtual teams. Some of them are:"
},
{
"code": null,
"e": 457911,
"s": 457904,
"text": "E-mail"
},
{
"code": null,
"e": 457918,
"s": 457911,
"text": "E-mail"
},
{
"code": null,
"e": 457960,
"s": 457918,
"text": "VoIP (Voice Over IP) - voice conferencing"
},
{
"code": null,
"e": 458002,
"s": 457960,
"text": "VoIP (Voice Over IP) - voice conferencing"
},
{
"code": null,
"e": 458021,
"s": 458002,
"text": "Video conferencing"
},
{
"code": null,
"e": 458040,
"s": 458021,
"text": "Video conferencing"
},
{
"code": null,
"e": 458126,
"s": 458040,
"text": "Groupware software programs such as Google Docs where teams can work collaboratively."
},
{
"code": null,
"e": 458212,
"s": 458126,
"text": "Groupware software programs such as Google Docs where teams can work collaboratively."
},
{
"code": null,
"e": 458307,
"s": 458212,
"text": "Software for conducting demonstrations and trainings such as Microsoft Live Meeting and WebEx."
},
{
"code": null,
"e": 458402,
"s": 458307,
"text": "Software for conducting demonstrations and trainings such as Microsoft Live Meeting and WebEx."
},
{
"code": null,
"e": 458536,
"s": 458402,
"text": "When it comes to the technology, not only the software matters, the virtual teams should be equipped with necessary hardware as well."
},
{
"code": null,
"e": 458647,
"s": 458536,
"text": "As an example, for a video conference, the team members should be equipped with a web camera and a microphone."
},
{
"code": null,
"e": 458722,
"s": 458647,
"text": "First of all, let's look at the advantages of operating as a virtual team."
},
{
"code": null,
"e": 458854,
"s": 458722,
"text": "Team members can work from anywhere and any time of the day. They can choose the place they work based on the mood and the comfort."
},
{
"code": null,
"e": 458986,
"s": 458854,
"text": "Team members can work from anywhere and any time of the day. They can choose the place they work based on the mood and the comfort."
},
{
"code": null,
"e": 459084,
"s": 458986,
"text": "You can recruit people for their skills and suitability to the job. The location does not matter."
},
{
"code": null,
"e": 459182,
"s": 459084,
"text": "You can recruit people for their skills and suitability to the job. The location does not matter."
},
{
"code": null,
"e": 459244,
"s": 459182,
"text": "There is no time and money wasted for commuting and clothing."
},
{
"code": null,
"e": 459306,
"s": 459244,
"text": "There is no time and money wasted for commuting and clothing."
},
{
"code": null,
"e": 459343,
"s": 459306,
"text": "Physical handicaps are not an issue."
},
{
"code": null,
"e": 459380,
"s": 459343,
"text": "Physical handicaps are not an issue."
},
{
"code": null,
"e": 459559,
"s": 459380,
"text": "The company does not have to have a physical office maintained. This reduces a lot of costs to the company. By saving this money, the company can better compensate the employees."
},
{
"code": null,
"e": 459738,
"s": 459559,
"text": "The company does not have to have a physical office maintained. This reduces a lot of costs to the company. By saving this money, the company can better compensate the employees."
},
{
"code": null,
"e": 459836,
"s": 459738,
"text": "Along with the above-mentioned advantages, following are few disadvantages of using virtual team:"
},
{
"code": null,
"e": 459941,
"s": 459836,
"text": "Since team members do not frequently meet or do not meet at all, the teamwork spirit may not be present."
},
{
"code": null,
"e": 460046,
"s": 459941,
"text": "Since team members do not frequently meet or do not meet at all, the teamwork spirit may not be present."
},
{
"code": null,
"e": 460168,
"s": 460046,
"text": "Some people prefer to be in a physical office when working. These people will be less productive in virtual environments."
},
{
"code": null,
"e": 460290,
"s": 460168,
"text": "Some people prefer to be in a physical office when working. These people will be less productive in virtual environments."
},
{
"code": null,
"e": 460440,
"s": 460290,
"text": "To work for virtual teams, individuals need to have a lot of self-discipline. If the individual is not disciplined, he or she may be less productive."
},
{
"code": null,
"e": 460590,
"s": 460440,
"text": "To work for virtual teams, individuals need to have a lot of self-discipline. If the individual is not disciplined, he or she may be less productive."
},
{
"code": null,
"e": 460758,
"s": 460590,
"text": "Virtual teams are rising in numbers nowadays. Small technology companies are now adapting virtual team practice for recruiting the best people from all over the globe."
},
{
"code": null,
"e": 461010,
"s": 460758,
"text": "In addition, these companies minimize their operating costs and maximize the profit margins. Additionally, the employees working in virtual teams are at advantages when it comes to working in their own home, own time, and reduction of commuting costs."
},
{
"code": null,
"e": 461116,
"s": 461010,
"text": "Therefore, organizations should look into setting up virtual teams for different tasks whenever possible."
},
{
"code": null,
"e": 461386,
"s": 461116,
"text": "The total productive maintenance (TPM) is a concept for maintenance activities. In the structure, total productive maintenance resembles many aspects of Total Quality Management (TQM), such as employee empowerment, management's commitment, long-term goal settings, etc."
},
{
"code": null,
"e": 461525,
"s": 461386,
"text": "In addition, changes in the staff mindset towards their assignments and responsibilities is one of the other similarities between the two."
},
{
"code": null,
"e": 461688,
"s": 461525,
"text": "Maintenance is one of the key aspects of any organization. When it comes to maintenance, it could represent many domains and areas within a business organization."
},
{
"code": null,
"e": 461879,
"s": 461688,
"text": "In order for an organization to function properly, every running process, activity and resource should be properly maintained for their quality, effectiveness and other productivity factors."
},
{
"code": null,
"e": 462103,
"s": 461879,
"text": "TPM is the process which brings the maintenance aspect of the organization under the spotlight. Although maintenance was regarded as a non-profit activity by the traditional management methodologies, TPM puts a brake on it."
},
{
"code": null,
"e": 462319,
"s": 462103,
"text": "With the emphasis on TPM, downtime for maintenance has become an integral part of the manufacturing or production process itself. Now, the maintenance events are properly scheduled and executed with organized plans."
},
{
"code": null,
"e": 462452,
"s": 462319,
"text": "Maintenance events are no longer squeezed in when there is low production requirements or low material flow in the production lines."
},
{
"code": null,
"e": 462574,
"s": 462452,
"text": "By practicing TPM, the organizations can avoid unexpected interrupts to the production and avoid unscheduled maintenance."
},
{
"code": null,
"e": 462685,
"s": 462574,
"text": "The parent of TPM is TQM. TQM was evolved after the quality concerns the Japan had after the Second World War."
},
{
"code": null,
"e": 462894,
"s": 462685,
"text": "As a part of TQM, the plant maintenance was examined. Although TQM is one of the best quality methodologies for organizations, some of the TQM concepts did not fit or work properly in the area of maintenance."
},
{
"code": null,
"e": 463084,
"s": 462894,
"text": "Therefore, there was a need to develop a separate branch of practices in order to address unique conditions and issues related maintenance. This is how TPM was introduced as a child of TQM."
},
{
"code": null,
"e": 463183,
"s": 463084,
"text": "Although there is a story behind the origin on TPM, the origin itself is disputed by many parties."
},
{
"code": null,
"e": 463451,
"s": 463183,
"text": "Some believe that the concepts of TPM were introduced by American manufacturers about forty years ago and other believe TPM been introduced by the Japanese manufacturers of automotive electrical devices. Regardless of the origin, TPM can now be used across the globe."
},
{
"code": null,
"e": 463619,
"s": 463451,
"text": "Before start implementing TPM concepts for the organization, the employees of the organization should be convinced about the upper management's commitment towards TPM."
},
{
"code": null,
"e": 463718,
"s": 463619,
"text": "This is the first step towards establishing good TPM practices in the organization as shown below."
},
{
"code": null,
"e": 463893,
"s": 463718,
"text": "To emphasize the upper management's commitment, the organization can appoint a TPM coordinator. ,Then it is coordinator's responsibility to educate the staff on TPM concepts."
},
{
"code": null,
"e": 464108,
"s": 463893,
"text": "For this, the TPM coordinator can come up with an education program designed in-house or hired from outside of the organization. Usually, in order to establish TPM concepts in an organization, it takes a long time."
},
{
"code": null,
"e": 464309,
"s": 464108,
"text": "Once the coordinator is convinced about the staff readiness, 'study and action' team are performed. These action teams usually include the people, who directly interface with the maintenance problems."
},
{
"code": null,
"e": 464520,
"s": 464309,
"text": "Machine operators, shift supervisors, mechanics and representatives from the upper management can also be included in these teams. Usually, the coordinator should head each team until the team leads are chosen."
},
{
"code": null,
"e": 464724,
"s": 464520,
"text": "Then, the 'study and action' teams are given the responsibilities of the respective areas. The team are supposed to analyze the problem areas and come up with a set of suggestions and possible solutions."
},
{
"code": null,
"e": 464964,
"s": 464724,
"text": "When it comes to studying the problems at hand, there is a benchmarking process going on in parallel. In benchmarking, the organization identifies certain productivity thresholds defined for certain machinery and processes in the industry."
},
{
"code": null,
"e": 465174,
"s": 464964,
"text": "Once the suitable measure for rectifying the issues are identifies, it is time to apply them in practice. As a safety measure, these measures are only applied to one area or one machine in the production line."
},
{
"code": null,
"e": 465482,
"s": 465174,
"text": "This serves as a pilot program and the TPM team can measure the outcome without jeopardizing the productivity of the entire company. If the outcome is successful, then the same measures are applied to the next set of machines or areas. By following an incremental process, TPM minimizes any potential risks."
},
{
"code": null,
"e": 465663,
"s": 465482,
"text": "Majority of world's first class manufacturing companies follow TPM as an integrated practice in their organizations. Ford, Harley Davidson and Dana Corp. are just a few to mention."
},
{
"code": null,
"e": 465910,
"s": 465663,
"text": "All these first class corporate citizens have reported high rates of productivity enhancements after implementing TPM. As baseline, almost all the companies, who have adopted TPM have reported productivity enhancements close to 50% in many areas."
},
{
"code": null,
"e": 466160,
"s": 465910,
"text": "Today, with increasing competition and tough markets, TPM may decide the success or the failure of a company. TPM has been a proven program for many years and organizations, especially into manufacturing, can adopt this methodology without any risk."
},
{
"code": null,
"e": 466310,
"s": 466160,
"text": "Employees and the upper management should be educated in TPM by the time it is rolled out. The organization should have long-term objectives for TPM."
},
{
"code": null,
"e": 466431,
"s": 466310,
"text": "There are many approaches in the business domain in order to achieve and exceed the quality expectations of the clients."
},
{
"code": null,
"e": 466556,
"s": 466431,
"text": "For this, most companies integrate all quality-related processes and functions together and control it from a central point."
},
{
"code": null,
"e": 466755,
"s": 466556,
"text": "As the name suggests, Total Quality Management takes everything related to quality into consideration, including the company processes, process outcomes (usually products or services) and employees."
},
{
"code": null,
"e": 466980,
"s": 466755,
"text": "The origin of the TQM goes back to the time of the First World War. During the World War I, there have been a number of quality assurance initiatives taken place due to the large-scale manufacturing required for war efforts."
},
{
"code": null,
"e": 467191,
"s": 466980,
"text": "The military fronts could not afford poor quality products and suffered heavy losses due to the poor quality. Therefore, different stakeholders of the war initiated efforts to enhance the manufacturing quality."
},
{
"code": null,
"e": 467362,
"s": 467191,
"text": "First of all, quality inspectors were introduced to the assembly lines in order to inspect the quality. Products below certain quality standard were sent back for fixing."
},
{
"code": null,
"e": 467552,
"s": 467362,
"text": "Even after World War I ended, the practice of using quality inspectors continued in manufacturing plants. By this time, quality inspectors had more time in their hands to perform their job."
},
{
"code": null,
"e": 467746,
"s": 467552,
"text": "Therefore, they came up with different ideas of assuring the quality. These efforts led to the origin of Statistical Quality Control (SQC). Sampling was used in this method for quality control."
},
{
"code": null,
"e": 467877,
"s": 467746,
"text": "As a result, quality assurance and quality control cost reduced, as inspection of every production item was need in this approach."
},
{
"code": null,
"e": 468086,
"s": 467877,
"text": "During the post World War II era, Japanese manufacturers produced poor quality products. As a result of this, Japanese government invited Dr. Deming to train Japanese engineers in quality assurance processes."
},
{
"code": null,
"e": 468270,
"s": 468086,
"text": "By 1950, quality control and quality assurance were core components of Japanese manufacturing processes and employees of all levels within the company adopted these quality processes."
},
{
"code": null,
"e": 468496,
"s": 468270,
"text": "By 1970s, the idea of total quality started surfacing. In this approach, all the employees (from CEO to the lowest level) were supposed to take responsibility of implementing quality processes for their respective work areas."
},
{
"code": null,
"e": 468573,
"s": 468496,
"text": "In addition, it was their responsibility to quality control, their own work."
},
{
"code": null,
"e": 468801,
"s": 468573,
"text": "In TQM, the processes and initiatives that produce products or services are thoroughly managed. By this way of managing, process variations are minimized, so the end product or the service will have a predictable quality level."
},
{
"code": null,
"e": 468847,
"s": 468801,
"text": "Following are the key principles used in TQM:"
},
{
"code": null,
"e": 469030,
"s": 468847,
"text": "Top management - The upper management is the driving force behind TQM. The upper management bears the responsibility of creating an environment to rollout TQM concepts and practices."
},
{
"code": null,
"e": 469213,
"s": 469030,
"text": "Top management - The upper management is the driving force behind TQM. The upper management bears the responsibility of creating an environment to rollout TQM concepts and practices."
},
{
"code": null,
"e": 469450,
"s": 469213,
"text": "Training needs - When a TQM rollout is due, all the employees of the company need to go through a proper cycle of training. Once the TQM implementation starts, the employees should go through regular trainings and certification process."
},
{
"code": null,
"e": 469687,
"s": 469450,
"text": "Training needs - When a TQM rollout is due, all the employees of the company need to go through a proper cycle of training. Once the TQM implementation starts, the employees should go through regular trainings and certification process."
},
{
"code": null,
"e": 469921,
"s": 469687,
"text": "Customer orientation - The quality improvements should ultimately target improving the customer satisfaction. For this, the company can conduct surveys and feedback forums for gathering customer satisfaction and feedback information."
},
{
"code": null,
"e": 470155,
"s": 469921,
"text": "Customer orientation - The quality improvements should ultimately target improving the customer satisfaction. For this, the company can conduct surveys and feedback forums for gathering customer satisfaction and feedback information."
},
{
"code": null,
"e": 470353,
"s": 470155,
"text": "Involvement of employees - Pro-activeness of employees is the main contribution from the staff. The TQM environment should make sure that the employees who are proactive are rewarded appropriately."
},
{
"code": null,
"e": 470551,
"s": 470353,
"text": "Involvement of employees - Pro-activeness of employees is the main contribution from the staff. The TQM environment should make sure that the employees who are proactive are rewarded appropriately."
},
{
"code": null,
"e": 470662,
"s": 470551,
"text": "Techniques and tools - Use of techniques and tools suitable for the company is one of the main factors of TQM."
},
{
"code": null,
"e": 470773,
"s": 470662,
"text": "Techniques and tools - Use of techniques and tools suitable for the company is one of the main factors of TQM."
},
{
"code": null,
"e": 470957,
"s": 470773,
"text": "Corporate culture - The corporate culture should be such that it facilitates the employees with the tools and techniques where the employees can work towards achieving higher quality."
},
{
"code": null,
"e": 471141,
"s": 470957,
"text": "Corporate culture - The corporate culture should be such that it facilitates the employees with the tools and techniques where the employees can work towards achieving higher quality."
},
{
"code": null,
"e": 471300,
"s": 471141,
"text": "Continues improvements - TQM implementation is not a one time exercise. As long as the company practices TQM, the TQM process should be improved continuously."
},
{
"code": null,
"e": 471459,
"s": 471300,
"text": "Continues improvements - TQM implementation is not a one time exercise. As long as the company practices TQM, the TQM process should be improved continuously."
},
{
"code": null,
"e": 471658,
"s": 471459,
"text": "Some companies are under the impression that the cost of TQM is higher than the benefits it offers. This might be true for the companies in small scale, trying to do everything that comes under TQM."
},
{
"code": null,
"e": 471796,
"s": 471658,
"text": "According to a number of industrial researches, the total cost of poor quality for a company always exceeds the cost of implementing TQM."
},
{
"code": null,
"e": 471963,
"s": 471796,
"text": "In addition, there is a hidden cost for the companies with poor quality products such as handling customer complaints, re-shipping, and the overall brand name damage."
},
{
"code": null,
"e": 472179,
"s": 471963,
"text": "Total Quality Management is practiced by many business organizations around the world. It is a proven method for implementing a quality conscious culture across all the vertical and horizontal layers of the company."
},
{
"code": null,
"e": 472278,
"s": 472179,
"text": "Although there are many benefits, one should take the cost into the account when implementing TQM."
},
{
"code": null,
"e": 472368,
"s": 472278,
"text": "For small-scale companies, the cost could be higher than the short and mid term benefits."
},
{
"code": null,
"e": 472570,
"s": 472368,
"text": "Project management is a practice that can be found everywhere. Project management does not belong to any specific domain or a field. It is a universal practice with a few basic concepts and objectives."
},
{
"code": null,
"e": 472667,
"s": 472570,
"text": "Regardless of the size of the activities or effort, every 'project' requires project management."
},
{
"code": null,
"e": 472939,
"s": 472667,
"text": "There are many variations of project management that have been customized for different domains. Although the basic principles are the same among any of these variations, there are unique features present to address unique problems and conditions specific to each domain."
},
{
"code": null,
"e": 472987,
"s": 472939,
"text": "There are two main types of project management:"
},
{
"code": null,
"e": 473018,
"s": 472987,
"text": "Traditional Project management"
},
{
"code": null,
"e": 473044,
"s": 473018,
"text": "Modern Project management"
},
{
"code": null,
"e": 473348,
"s": 473044,
"text": "The traditional project management uses orthodox methods and techniques in the management process. These methods and techniques have been evolved for decades and are applicable for most of the domains. But for some domains, such as software development, traditional project management is not a 100% fit."
},
{
"code": null,
"e": 473547,
"s": 473348,
"text": "Therefore, there have been a few modern project management practices introduced to address the shortcomings of the traditional method. Agile and Scrum are two such modern project management methods."
},
{
"code": null,
"e": 473747,
"s": 473547,
"text": "First of all, having an idea of the project management definition is required when it comes to discussing traditional project management. Following is a definition for traditional project management."
},
{
"code": null,
"e": 473917,
"s": 473747,
"text": "PMBOK defines the traditional project management as 'a set of techniques and tools that can be applied to an activity that seeks an end product, outcomes or a service'. "
},
{
"code": null,
"e": 474129,
"s": 473917,
"text": "If you Google, you will find hundreds of definitions given by many project management 'gurus' on traditional project management. But, it is always a great idea to stick to the standard definitions such as PMBOK."
},
{
"code": null,
"e": 474302,
"s": 474129,
"text": "You are working for a company where everyone has a desktop or a laptop computer. Currently, the company uses Windows XP as the standard operating system across the company."
},
{
"code": null,
"e": 474527,
"s": 474302,
"text": "Since Windows XP is somewhat outdated and there is a newer version called Windows 7, the management decides on upgrading the OS. The objective of the upgrade is to enhance the productivity and reduce the OS security threats."
},
{
"code": null,
"e": 474918,
"s": 474527,
"text": "If you have one office with about 100 computers, it could be considered as a medium scale project. In case if your company has 10-15 branches, then the project is a large scale one with high complexity. In such case, you will be overwhelmed by the tasks at hand and will feel confused. You may have no clue of how to start and proceed. This is where traditional project management comes in."
},
{
"code": null,
"e": 475150,
"s": 474918,
"text": "Traditional project management has everything required for managing and successfully executing a project like this. Since this type of project does not require any customizations, modern project management methods are not required."
},
{
"code": null,
"e": 475346,
"s": 475150,
"text": "The company can hire or use an existing project manager to manage the OS upgrade project. The project manager will plan the entire project, derive a schedule, and indicate the required resources."
},
{
"code": null,
"e": 475649,
"s": 475346,
"text": "The cost will be elaborated to the higher management, so everyone knows what to expect in the project. Usually, a competent project manager knows what processes and artifacts are required in order to execute a project. There will be frequent updates coming from the project manager to all stakeholders."
},
{
"code": null,
"e": 475874,
"s": 475649,
"text": "In addition to the regular project activities, project manager will attend to risk management as well. If certain risks have an impact on the business processes, the project manager will suggest suitable mitigation criteria."
},
{
"code": null,
"e": 476074,
"s": 475874,
"text": "Traditional project management is a project management approach that will work for most domains and environments. This approach uses orthodox tools and techniques for management and solving problems."
},
{
"code": null,
"e": 476204,
"s": 476074,
"text": "These tools and techniques have been proven for decades, so the outcome of such tools and techniques can be accurately predicted."
},
{
"code": null,
"e": 476436,
"s": 476204,
"text": "When it comes to special environments and conditions, one should move away from traditional project management approach and should look into modern methods that have been specifically developed for such environments and conditions."
},
{
"code": null,
"e": 476555,
"s": 476436,
"text": "Dividing complex projects to simpler and manageable tasks is the process identified as Work Breakdown Structure (WBS)."
},
{
"code": null,
"e": 476765,
"s": 476555,
"text": "Usually, the project managers use this method for simplifying the project execution. In WBS, much larger tasks are broken down to manageable chunks of work. These chunks can be easily supervised and estimated."
},
{
"code": null,
"e": 476902,
"s": 476765,
"text": "WBS is not restricted to a specific field when it comes to application. This methodology can be used for any type of project management."
},
{
"code": null,
"e": 476963,
"s": 476902,
"text": "Following are a few reasons for creating a WBS in a project:"
},
{
"code": null,
"e": 477007,
"s": 476963,
"text": "Accurate and readable project organization."
},
{
"code": null,
"e": 477051,
"s": 477007,
"text": "Accurate and readable project organization."
},
{
"code": null,
"e": 477112,
"s": 477051,
"text": "Accurate assignment of responsibilities to the project team."
},
{
"code": null,
"e": 477173,
"s": 477112,
"text": "Accurate assignment of responsibilities to the project team."
},
{
"code": null,
"e": 477226,
"s": 477173,
"text": "Indicates the project milestones and control points."
},
{
"code": null,
"e": 477279,
"s": 477226,
"text": "Indicates the project milestones and control points."
},
{
"code": null,
"e": 477322,
"s": 477279,
"text": "Helps to estimate the cost, time and risk."
},
{
"code": null,
"e": 477365,
"s": 477322,
"text": "Helps to estimate the cost, time and risk."
},
{
"code": null,
"e": 477460,
"s": 477365,
"text": "Illustrate the project scope, so the stakeholders can have a better understanding of the same."
},
{
"code": null,
"e": 477555,
"s": 477460,
"text": "Illustrate the project scope, so the stakeholders can have a better understanding of the same."
},
{
"code": null,
"e": 477665,
"s": 477555,
"text": "Identifying the main deliverables of a project is the starting point for deriving a work breakdown structure."
},
{
"code": null,
"e": 477914,
"s": 477665,
"text": "This important step is usually done by the project managers and the subject matter experts (SMEs) involved in the project. Once this step is completed, the subject matter experts start breaking down the high-level tasks into smaller chunks of work."
},
{
"code": null,
"e": 478135,
"s": 477914,
"text": "In the process of breaking down the tasks, one can break them down into different levels of detail. One can detail a high-level task into ten sub-tasks while another can detail the same high-level task into 20 sub-tasks."
},
{
"code": null,
"e": 478334,
"s": 478135,
"text": "Therefore, there is no hard and fast rule on how you should breakdown a task in WBS. Rather, the level of breakdown is a matter of the project type and the management style followed for the project."
},
{
"code": null,
"e": 478498,
"s": 478334,
"text": "In general, there are a few \"rules\" used for determining the smallest task chunk. In \"two weeks\" rule, nothing is broken down smaller than two weeks worth of work."
},
{
"code": null,
"e": 478731,
"s": 478498,
"text": "This means, the smallest task of the WBS is at least two-week long. 8/80 is another rule used when creating a WBS. This rule implies that no task should be smaller than 8 hours of work and should not be larger than 80 hours of work."
},
{
"code": null,
"e": 478918,
"s": 478731,
"text": "One can use many forms to display their WBS. Some use tree structure to illustrate the WBS, while others use lists and tables. Outlining is one of the easiest ways of representing a WBS."
},
{
"code": null,
"e": 478956,
"s": 478918,
"text": "Following example is an outlined WBS:"
},
{
"code": null,
"e": 479030,
"s": 478956,
"text": "There are many design goals for WBS. Some important goals are as follows:"
},
{
"code": null,
"e": 479075,
"s": 479030,
"text": "Giving visibility to important work efforts."
},
{
"code": null,
"e": 479120,
"s": 479075,
"text": "Giving visibility to important work efforts."
},
{
"code": null,
"e": 479161,
"s": 479120,
"text": "Giving visibility to risky work efforts."
},
{
"code": null,
"e": 479202,
"s": 479161,
"text": "Giving visibility to risky work efforts."
},
{
"code": null,
"e": 479270,
"s": 479202,
"text": "Illustrate the correlation between the activities and deliverables."
},
{
"code": null,
"e": 479338,
"s": 479270,
"text": "Illustrate the correlation between the activities and deliverables."
},
{
"code": null,
"e": 479376,
"s": 479338,
"text": "Show clear ownership by task leaders."
},
{
"code": null,
"e": 479414,
"s": 479376,
"text": "Show clear ownership by task leaders."
},
{
"code": null,
"e": 479629,
"s": 479414,
"text": "In a WBS diagram, the project scope is graphically expressed. Usually the diagram starts with a graphic object or a box at the top, which represents the entire project. Then, there are sub-components under the box."
},
{
"code": null,
"e": 479840,
"s": 479629,
"text": "These boxes represent the deliverables of the project. Under each deliverable, there are sub-elements listed. These sub-elements are the activities that should be performed in order to achieve the deliverables."
},
{
"code": null,
"e": 480037,
"s": 479840,
"text": "Although most of the WBS diagrams are designed based on the deliveries, some WBS are created based on the project phases. Usually, information technology projects are perfectly fit into WBS model."
},
{
"code": null,
"e": 480108,
"s": 480037,
"text": "Therefore, almost all information technology projects make use of WBS."
},
{
"code": null,
"e": 480290,
"s": 480108,
"text": "In addition to the general use of WBS, there is specific objective for deriving a WBS as well. WBS is the input for Gantt charts, a tool that is used for project management purpose."
},
{
"code": null,
"e": 480368,
"s": 480290,
"text": "Gantt chart is used for tracking the progression of the tasks derived by WBS."
},
{
"code": null,
"e": 480403,
"s": 480368,
"text": "Following is a sample WBS diagram:"
},
{
"code": null,
"e": 480488,
"s": 480403,
"text": "The efficiency of a work breakdown structure can determine the success of a project."
},
{
"code": null,
"e": 480639,
"s": 480488,
"text": "The WBS provides the foundation for all project management work, including, planning, cost and effort estimation, resource allocation, and scheduling."
},
{
"code": null,
"e": 480736,
"s": 480639,
"text": "Therefore, one should take creating WBS as a critical step in the process of project management."
},
{
"code": null,
"e": 480771,
"s": 480736,
"text": "\n 20 Lectures \n 3.5 hours \n"
},
{
"code": null,
"e": 480789,
"s": 480771,
"text": " Richa Maheshwari"
},
{
"code": null,
"e": 480822,
"s": 480789,
"text": "\n 15 Lectures \n 1 hours \n"
},
{
"code": null,
"e": 480828,
"s": 480822,
"text": " Ajay"
},
{
"code": null,
"e": 480861,
"s": 480828,
"text": "\n 15 Lectures \n 1 hours \n"
},
{
"code": null,
"e": 480867,
"s": 480861,
"text": " Ajay"
},
{
"code": null,
"e": 480900,
"s": 480867,
"text": "\n 12 Lectures \n 2 hours \n"
},
{
"code": null,
"e": 480918,
"s": 480900,
"text": " Richa Maheshwari"
},
{
"code": null,
"e": 480953,
"s": 480918,
"text": "\n 12 Lectures \n 1.5 hours \n"
},
{
"code": null,
"e": 480971,
"s": 480953,
"text": " Richa Maheshwari"
},
{
"code": null,
"e": 481004,
"s": 480971,
"text": "\n 15 Lectures \n 1 hours \n"
},
{
"code": null,
"e": 481010,
"s": 481004,
"text": " Ajay"
},
{
"code": null,
"e": 481017,
"s": 481010,
"text": " Print"
},
{
"code": null,
"e": 481028,
"s": 481017,
"text": " Add Notes"
}
] |
Priority of process in Linux | nice value - GeeksforGeeks | 01 Apr, 2018
The running instance of program is process, and each process needs space in RAM and CPU time to be executed, each process has its priority in which it is executed.
Now observe the below image and see column NI
top
Output:
top command output
The column NI represents nice value of a process. It’s value ranges from -20 to 20(on most unix like operating systems).
-20 20
most priority least priority
process process
One important thing to note is nice value only controls CPU time assigned to process and not utilisation of memory and I/O devices.
nice and renice commandnice command is used to start a process with specified nice value, which renice command is used to alter priority of running process.
Usage of nice command :Now let’s assume the case that system has only 1GB of RAM and it’s working really slow, i.e. programs running on it(processes) are not responding quickly, in that case if you want to kill some of the processes, you need to start a terminal, if you start your bash shell normally, it will also produce lag but you can avoid this by starting the bash shell with high priority.
For example:
nice -n -5 bash
First observe output of top without setting nice value of any process in below image
nice value of top is 0
Now start a bash shell with nice value -5, if you see the highlighted line, the top command which is running on bash shell has nice value set to -5
nice value of bash shell is -5
Usage of renice command :To alter priority of running process, we use renice command.
renice value PID
value is new priority to be assignedPID is PID of process whose priority is to be changed
One thing to note is you can’t set high priority to any process without having root permissions though any normal user can set high priority to low priority of a process.
We will see one example of how you alter priority of process.
nice value of gnome terminal is 0
You can observe that nice value of process(PID = 2371) is 0, now let’s try to set the new priority of 5 to this process.
renice 5 2371
Output:
2371 (process ID) old priority 0, new priority 5
You can also see this priority using top command(see highlighted line in image).
process 2371 has nice value 5
linux-command
Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
ZIP command in Linux with examples
TCP Server-Client implementation in C
SORT command in Linux/Unix with examples
tar command in Linux with examples
curl command in Linux with Examples
Conditional Statements | Shell Script
'crontab' in Linux with Examples
diff command in Linux with examples
Tail command in Linux with examples
UDP Server-Client implementation in C | [
{
"code": null,
"e": 25873,
"s": 25845,
"text": "\n01 Apr, 2018"
},
{
"code": null,
"e": 26037,
"s": 25873,
"text": "The running instance of program is process, and each process needs space in RAM and CPU time to be executed, each process has its priority in which it is executed."
},
{
"code": null,
"e": 26083,
"s": 26037,
"text": "Now observe the below image and see column NI"
},
{
"code": null,
"e": 26088,
"s": 26083,
"text": "top\n"
},
{
"code": null,
"e": 26096,
"s": 26088,
"text": "Output:"
},
{
"code": null,
"e": 26115,
"s": 26096,
"text": "top command output"
},
{
"code": null,
"e": 26236,
"s": 26115,
"text": "The column NI represents nice value of a process. It’s value ranges from -20 to 20(on most unix like operating systems)."
},
{
"code": null,
"e": 26348,
"s": 26236,
"text": " -20 20\nmost priority least priority \n process process\n"
},
{
"code": null,
"e": 26480,
"s": 26348,
"text": "One important thing to note is nice value only controls CPU time assigned to process and not utilisation of memory and I/O devices."
},
{
"code": null,
"e": 26637,
"s": 26480,
"text": "nice and renice commandnice command is used to start a process with specified nice value, which renice command is used to alter priority of running process."
},
{
"code": null,
"e": 27035,
"s": 26637,
"text": "Usage of nice command :Now let’s assume the case that system has only 1GB of RAM and it’s working really slow, i.e. programs running on it(processes) are not responding quickly, in that case if you want to kill some of the processes, you need to start a terminal, if you start your bash shell normally, it will also produce lag but you can avoid this by starting the bash shell with high priority."
},
{
"code": null,
"e": 27048,
"s": 27035,
"text": "For example:"
},
{
"code": null,
"e": 27065,
"s": 27048,
"text": "nice -n -5 bash\n"
},
{
"code": null,
"e": 27150,
"s": 27065,
"text": "First observe output of top without setting nice value of any process in below image"
},
{
"code": null,
"e": 27173,
"s": 27150,
"text": "nice value of top is 0"
},
{
"code": null,
"e": 27321,
"s": 27173,
"text": "Now start a bash shell with nice value -5, if you see the highlighted line, the top command which is running on bash shell has nice value set to -5"
},
{
"code": null,
"e": 27352,
"s": 27321,
"text": "nice value of bash shell is -5"
},
{
"code": null,
"e": 27438,
"s": 27352,
"text": "Usage of renice command :To alter priority of running process, we use renice command."
},
{
"code": null,
"e": 27456,
"s": 27438,
"text": "renice value PID\n"
},
{
"code": null,
"e": 27546,
"s": 27456,
"text": "value is new priority to be assignedPID is PID of process whose priority is to be changed"
},
{
"code": null,
"e": 27717,
"s": 27546,
"text": "One thing to note is you can’t set high priority to any process without having root permissions though any normal user can set high priority to low priority of a process."
},
{
"code": null,
"e": 27779,
"s": 27717,
"text": "We will see one example of how you alter priority of process."
},
{
"code": null,
"e": 27813,
"s": 27779,
"text": "nice value of gnome terminal is 0"
},
{
"code": null,
"e": 27934,
"s": 27813,
"text": "You can observe that nice value of process(PID = 2371) is 0, now let’s try to set the new priority of 5 to this process."
},
{
"code": null,
"e": 27949,
"s": 27934,
"text": "renice 5 2371\n"
},
{
"code": null,
"e": 27957,
"s": 27949,
"text": "Output:"
},
{
"code": null,
"e": 28007,
"s": 27957,
"text": "2371 (process ID) old priority 0, new priority 5\n"
},
{
"code": null,
"e": 28088,
"s": 28007,
"text": "You can also see this priority using top command(see highlighted line in image)."
},
{
"code": null,
"e": 28118,
"s": 28088,
"text": "process 2371 has nice value 5"
},
{
"code": null,
"e": 28132,
"s": 28118,
"text": "linux-command"
},
{
"code": null,
"e": 28143,
"s": 28132,
"text": "Linux-Unix"
},
{
"code": null,
"e": 28241,
"s": 28143,
"text": "Writing code in comment?\nPlease use ide.geeksforgeeks.org,\ngenerate link and share the link here."
},
{
"code": null,
"e": 28276,
"s": 28241,
"text": "ZIP command in Linux with examples"
},
{
"code": null,
"e": 28314,
"s": 28276,
"text": "TCP Server-Client implementation in C"
},
{
"code": null,
"e": 28355,
"s": 28314,
"text": "SORT command in Linux/Unix with examples"
},
{
"code": null,
"e": 28390,
"s": 28355,
"text": "tar command in Linux with examples"
},
{
"code": null,
"e": 28426,
"s": 28390,
"text": "curl command in Linux with Examples"
},
{
"code": null,
"e": 28464,
"s": 28426,
"text": "Conditional Statements | Shell Script"
},
{
"code": null,
"e": 28497,
"s": 28464,
"text": "'crontab' in Linux with Examples"
},
{
"code": null,
"e": 28533,
"s": 28497,
"text": "diff command in Linux with examples"
},
{
"code": null,
"e": 28569,
"s": 28533,
"text": "Tail command in Linux with examples"
}
] |
Subsets and Splits