code-rag-bench/online-tutorials huggingface dataset:
Does main() method accept arguments other than string array, in java?

The public static void main() method accepts an array of values of the type String Java from the user.
public class{
   public static void main(String[] args){
   }
}
You can pass them at the time of execution right after the class name separated with spaces as −
java ClassName 10 20 30
And, in the program (from the main method) you can extract these values from the String array and use.
For example, you can use command line arguments to pass a and b in the above program as −
public class Sample {
   public static void main(String[] args){
      int a = Integer.parseInt(args[0]);
      int b = Integer.parseInt(args[1]);
      int c = a+b;
      System.out.println("Sum of the two numbers is "+c);
   }
}
You can compile and, run the program by passing the values at execution line through command prompt as shown below −
You can write the public static void main() method with arguments other than String the program gets compiled.
Since the main method is the entry point of the Java program, whenever you execute one the JVM searches for the main method, which is public, static, with return type void, and a String array as an argument.
Public static void main(String args[]){
}
If anything is missing the JVM raises an error. Therefore, if you write a method with other data types (except String array) as arguments, at the time of execution, JVM does not consider this new method as the entry point of Java and generates an error.
In the following Java program, we are trying to use an integer array as arguments of the main method.
 Live Demo
public class MainExample {
   public static void main(int args[]) {
      System.out.println("Hello how are you");
   }
}
On executing, this program generates the following error −
Error: Main method not found in class MainMethodExample, please define the main
method as:
public static void main(String[] args)
or a JavaFX application class must extend javafx.application.Application
reStructuredText | .rst file to HTML file using Python for Documentations - GeeksforGeeks

21 Jan, 2019
Introduction to .rst file (reStructuredText):
reStructuredText is a file format for Textual data majorly used by Python based communities to develop documentation in an easy way similar to other tools like Javadoc for Java. Most of the docs of Python-based software and libraries are written using reStructuredText and hence it’s important to learn it when contributing to any organization.
Like Python, RST syntax is also sensitive to Indentation.
Example code of reStructuredText:Some basic syntax and their HTML rendering are given below.
Some text or code
restructured.rst
******************************This is example of rst on GFG******************************  *GeeksforGeeks in italic*  **GeeksforGeeks in bold**  `Gfg website<www.geeksforgeeks.org>`  ``GeeksforGeeks in vebatim``
Save the file with .rst extension.
Python Code :
Following is the Python code to convert .rst files to HTML files. docutils is a predefined library downloaded while Python is installed. publish_file method is used to convert rst to html by passing file names as parameters.
import docutils.core  docutils.core.publish_file(    source_path ="restructured.rst",    destination_path ="Output.html",    writer_name ="html")
Output.htmlAfter running the python code, a HTML file would be made in the same directory as of rst file. The code of HTML is complicated than normal HTML code written by a person since it’s auto generated. The following image shows HTML rendering of reStructuredText shown above.
python-utility
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
How to Install PIP on Windows ?
How to drop one or multiple columns in Pandas Dataframe
Python OOPs Concepts
Python | Get unique values from a list
Check if element exists in list in Python
Python Classes and Objects
Python | os.path.join() method
How To Convert Python Dictionary To JSON?
Python | Pandas dataframe.groupby()
Create a directory in Python
How to get current state of activity in android?

This example demonstrates How to get current state of activity in android.
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:app = "http://schemas.android.com/apk/res-auto"
   xmlns:tools = "http://schemas.android.com/tools"
   android:layout_width = "match_parent"
   android:gravity = "center"
   android:layout_height = "match_parent"
   tools:context = ".MainActivity">
   <TextView
      android:id = "@+id/text"
      android:textSize = "30sp"
      android:layout_width = "match_parent"
      android:layout_height = "match_parent" />
</LinearLayout>
In the above code, we have taken text view to show activity state.
Step 3 − Add the following code to src/MainActivity.java
package com.example.myapplication;
import android.app.ActivityManager;
import android.app.admin.DevicePolicyManager;
import android.content.ComponentName;
import android.content.Context;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.RequiresApi;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
   TextView textView;
   @RequiresApi(api = Build.VERSION_CODES.N)
   @Override
   protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      textView = findViewById(R.id.text);
      textView.setText(" "+getLifecycle().getCurrentState());
   }
}
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 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 –
Click here to download the project code
How to Use Nano Text Editor

Are you confused by all of the other text editors? then, this article is for you! Linux amateurs are often put off by other advanced text editors such as Vim and Emacs. While they are decent programs, they does require a bit of learning curve. Nano offers a perfect solution if you are looking for a small and friendly text editor. It offers many useful and productive features.
Nano is a text editor for Unix-like systems or any other environments using a command line interface. It emulates the Pico text editor, a part of the Pine email client, which also provides additional functionality. In contrast to Pico, Nano is licensed under the GNU General Public License (GPL).
Nano follows the path and opens the file if it exists. However, If it does not exist, it’ll start a new buffer with that filename in a directory. To run Nano Text editor, use the following command –
To run Nano Text editor, use the following command –
$ nano text_files/testfile
The output should be like this −
Nano text editor “commands” are commonly referred to as “shortcuts” such as read file, save file, close file etc. The most common commands are placed at the bottom of the screen, but there are many more. Note that, nano text editor does not use the Shiftkey. All shortcuts use lowercase letters and unmodified number keys.
To see a list of valid shortcuts hitCtrl+G (in your Keyboard), the output should be like this –
When you’re done looking at shortcuts, hit theCTRL+X to exit the help window.
Suppose, if you’re working on a new text file and you want to save it, then call it as “writing out”(Ctrl+O). The output window should be like this –
To move the cursor forward or backward, you can hit Ctrl+F andCtrl+B  respectively.
To move up and down one line at a time, then you can hit Ctrl+P andCtrl+N. In other words, you can use Right, Left, Up, and Down arrow keys (in your keyboard) respectively.
If you want to mark any text hit CTRL+^ shortcut key.
The output window should be like this-
In the above image, we have marked “their drawing rooms.”
To cut the marked text hitCtrl+K shortcut.
If you want to paste your marked text, hitCtrl+U shortcut.
The below are a list of shortcuts which can ease your work –
Congratulations! Hope you perfect these basics of Nano text editor. In our next articles, we will come up with more such Linux based tricks and tips. Keep reading!
How to remove a particular character from a String.

Following example shows how to remove a character from a particular position from a string with the help of removeCharAt(string, position) method.
Live Demo
public class Sample {
   public static void main(String args[]) {
      String str = "this is Java";
      System.out.println(removeCharAt(str, 3));
   }
   public static String removeCharAt(String s, int pos) {
      return s.substring(0, pos) + s.substring(pos + 1);
   }
}
this is Java
Teradata - Logical and Conditional Operators

Teradata supports the following logical and conditional operators. These operators are used to perform comparison and combine multiple conditions.
BETWEEN command is used to check if a value is within a range of values.
Consider the following employee table.
The following example fetches records with employee numbers in the range between 101,102 and 103.
SELECT EmployeeNo, FirstName FROM  
Employee 
WHERE EmployeeNo BETWEEN 101 AND 103;
When the above query is executed, it returns the employee records with employee no between 101 and 103.
*** Query completed. 3 rows found. 2 columns returned. 
*** Total elapsed time was 1 second. 
 EmployeeNo            FirstName 
-----------  ------------------------------ 
   101                   Mike 
   102                   Robert 
   103                   Peter

IN command is used to check the value against a given list of values.
The following example fetches records with employee numbers in 101, 102 and 103.
SELECT EmployeeNo, FirstName FROM  
Employee 
WHERE EmployeeNo in (101,102,103);
The above query returns the following records.
*** Query completed. 3 rows found. 2 columns returned. 
*** Total elapsed time was 1 second.  
 EmployeeNo            FirstName 
-----------  ------------------------------ 
   101                   Mike 
   102                   Robert 
   103                   Peter

NOT IN command reverses the result of IN command. It fetches records with values that don’t match with the given list.
The following example fetches records with employee numbers not in 101, 102 and 103.
SELECT * FROM  
Employee 
WHERE EmployeeNo not in (101,102,103);
The above query returns the following records.
*** Query completed. 2 rows found. 6 columns returned. 
*** Total elapsed time was 1 second. 
 EmployeeNo          FirstName                      LastName 
----------- ------------------------------ -----------------------------    
    104                Alex                          Stuart 
    105                Robert                        James
Multi-Messenger : A python project, messaging via Terminal

30 May, 2018
The aim of this program is to let users mail/message on FB/SMS anyone using Terminal. The full project can be found here.
So, first of all, why Multi-Messenger ?
This is the first question which anyone will think about. The answer is simple, Terminal! Many of our work, now a days, lies in Terminal, talking about Programmers here in specific. So who wouldn’t like to message or mail or SMS someone quickly through Terminal?
Requirements :
For Linux Users:
In order to compile the program successfully, installation of the following modules is necessaryTwilio Client: Run this code from Terminalpip install twilio
pip install twilio
fbchat Module: Run this code from Terminalpip install fbchat
pip install fbchat
Preferred Method using pip [See installation manual for installing pip in Linux]
Code:The project is open sourced, and the code can be found in Github. Twilio Client can be used to SMS someone, fbchat is used to send a message to your Facebook friend and gmtp library has been used to send mail using Python. Python AutoGUI has also been used here, to give the user an option of a dialog based option. It will help the user if he’s not in love with Terminal.These screenshots show how it looks like:
Message Received:
 
This article is contributed by Kushashwa Ravi Shrimali and Krutika Bapat. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. 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.
Project
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
10 Best Web Development Projects For Your Resume
E-commerce Website using Django
Banking Transaction System using Java
Voting System Project Using Django Framework
Browser Automation Using Selenium
Student record management system using linked list
Handling Ajax request in Django
Setup Sending Email in Django Project
How to Build Portfolio Website And Host It on GitHub Pages?
College Management System using Django - Python Project
Python | Create an empty text file with current date as its name

02 Aug, 2019
In this article, we will learn how to create a text file names as the current date in it. For this, we can use now() method of datetime module.
The datetime module supplies classes for manipulating dates and times in both simple and complex ways. While date and time arithmetic is supported, the focus of the implementation is on efficient attribute extraction for output formatting and manipulation.
Let’s see a code example and try to understand it better.
# Python script to create an empty file# with current date as name.  # importing datetime moduleimport datetime  # datetime.datetime.now() to get # current date as filename.filename = datetime.datetime.now()  # create empty filedef create_file():    # Function creates an empty file    # %d - date, %B - month, %Y - Year    with open(filename.strftime("%d %B %Y")+".txt", "w") as file:        file.write("")  # Driver Codecreate_file()
Output:
01 August 2019.txt
Python
Python Programs
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
Python String | replace()
How to Install PIP on Windows ?
Python program to convert a list to string
Defaultdict in Python
Python | Get dictionary keys as a list
Python | Convert a list to dictionary
Python Program for Fibonacci numbers
VB.Net - While... End While Loop

It executes a series of statements as long as a given condition is True.
The syntax for this loop construct is −
While condition
   [ statements ]
   [ Continue While ]
   [ statements ]
   [ Exit While ]
   [ statements ]
End While

Here, statement(s) may be a single statement or a block of statements. The condition may be any expression, and true is logical true. The loop iterates while the condition is true.
When the condition becomes false, program control passes to the line immediately following the loop.
Here, key point of the While loop is that the loop might not ever run. When the condition is tested and the result is false, the loop body will be skipped and the first statement after the while loop will be executed.
Module loops
   Sub Main()
      Dim a As Integer = 10
      ' while loop execution '
      
      While a < 20
         Console.WriteLine("value of a: {0}", a)
         a = a + 1
      End While
      Console.ReadLine()
   End Sub
End Module
When the above code is compiled and executed, it produces the following result −
value of a: 10
value of a: 11
value of a: 12
value of a: 13
value of a: 14
value of a: 15
value of a: 16
value of a: 17
value of a: 18
value of a: 19
How to Remove HTML element from DOM using AngularJS ?

15 Oct, 2020
Here the task is to remove a particular element from the DOM with the help of AngularJS.
Approach: Here first we select the element that we want to remove. Then we use remove() method to remove that particular element.
Example 1: Here the element of class(‘p’) has been removed.
<!DOCTYPE HTML><html>  <head>    <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.min.js">    </script>  <script>        var myApp = angular.module("app", []);        myApp.controller("controller", function ($scope) {            $scope.removeEl = function () {                var el = angular.element(                    document.querySelector('.p'));                el.remove();            };        });    </script>    <style>        .p {            border: 1px solid black;        }    </style></head>  <body style="text-align:center;">    <h1 style="color:green;">        GeeksForGeeks    </h1>    <p>        Remove a HTML element from DOM    </p>    <div ng-app="app">        <div ng-controller="controller">            <p class="p">This is paragraph</p>            <input type="button"                 value="Click here"                 ng-click="removeEl()">        </div>    </div></body>  </html>        
Output:
Example 2: Here the element of Id(‘p’) has been removed by remove() method.
<!DOCTYPE HTML><html>  <head>    <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.min.js">    </script>  <script>        var myApp = angular.module("app", []);        myApp.controller("controller", function ($scope) {            $scope.removeEl = function () {                var el = angular.element(                    document.querySelector('#div'));                el.remove();            };        });    </script>    <style>        #div {            height: 50px;            width: 100px;            margin: 0 auto;            background: green;            color: white;        }    </style></head>  <body style="text-align:center;">    <h1 style="color:green;">        GeeksForGeeks    </h1>    <p>        Remove a HTML element from DOM    </p>    <div ng-app="app">        <div ng-controller="controller">            <div id="div">Element</div>            <br>            <input type="button"                 value="Click here"                 ng-click="removeEl()">        </div>    </div></body>  </html>       
Output:
AngularJS-Misc
CSS-Misc
HTML-Misc
AngularJS
CSS
HTML
Web Technologies
Web technologies Questions
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Auth Guards in Angular 9/10/11
Routing in Angular 9/10
What is AOT and JIT Compiler in Angular ?
Angular PrimeNG Dropdown Component
How to set focus on input field automatically on page load in AngularJS ?
How to update Node.js and NPM to next version ?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to insert spaces/tabs in text using HTML/CSS?
How to create footer to stay at the bottom of a Web page?
CSS to put icon inside an input element in a form
Time complexities of different data structures

13 Jun, 2022
Time Complexity is a concept in computer science that deals with the quantification of the amount of time taken by a set of code or algorithm to process or run as a function of the amount of input. In other words, the time complexity is how long a program takes to process a given input. The efficiency of an algorithm depends on two parameters:
Time Complexity
Space Complexity
Time Complexity: It is defined as the number of times a particular instruction set is executed rather than the total time is taken. It is because the total time took also depends on some external factors like the compiler used, processor’s speed, etc.
Space Complexity: It is the total memory space required by the program for its execution.
meetgandhi3
pallavimahajan1102
time complexity
Analysis
Articles
Data Structures
Difference Between
Data Structures
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Time Complexity and Space Complexity
Analysis of different sorting techniques
Complexity of different operations in Binary tree, Binary Search Tree and AVL tree
Types of Complexity Classes | P, NP, CoNP, NP hard and NP complete
Difference between NP hard and NP complete problem
Tree Traversals (Inorder, Preorder and Postorder)
SQL | Join (Inner, Left, Right and Full Joins)
find command in Linux with examples
Time Complexity and Space Complexity
Understanding "extern" keyword in C
SQL Query to Update All Columns in a Table

14 Nov, 2021
In SQL, sometimes we need to write a single query to update the values of all columns in a table. We will use the UPDATE keyword to achieve this. For this, we use a specific kind of query shown in the below demonstration. For this article, we will be using the Microsoft SQL Server as our database and Select keyword. 
Step 1: Create a Database. For this use the below command to create a database named GeeksForGeeks.
Query:
CREATE DATABASE GeeksForGeeks
Output:
Step 2: Use the GeeksForGeeks database. For this use the below command.
Query:
USE GeeksForGeeks
Output:
Step 3: Create a table of SALARY inside the database GeeksForGeeks. This table has 2 columns namely MONTHLY_SALARY and ANNUAL_SALARY containing the monthly and annual salaries of the workers in a factory.
Query:
CREATE TABLE SALARY(
MONTHLY_SALARY INT,
ANNUAL_SALARY INT);
Output:
Step 4: Describe the structure of the table SALARY.
Query:
EXEC SP_COLUMNS SALARY;
Output:
Step 5: Insert 5 rows into the SALARY table.
Query:
INSERT INTO SALARY VALUES(10000,120000);
INSERT INTO SALARY VALUES(20000,240000);
INSERT INTO SALARY VALUES(15000,180000);
INSERT INTO SALARY VALUES(30000,360000);
INSERT INTO SALARY VALUES(25000,300000);
Output:
Step 6: Display all the rows of the SALARY table.
Query:
SELECT * FROM SALARY;
Output:
Step 7: Update all the columns of the table SALARY. Increase the value of all entries of the MONTHLY_SALARY column by 1000, accordingly, increase the value of all entries of the ANNUAL_SALARY column by 12*1000=12000.
Syntax:
UPDATE TABLE_NAME SET COLUMN1=VALUE1,
COLUMN2 = VALUE2;
Query:
UPDATE SALARY SET MONTHLY_SALARY = 
MONTHLY_SALARY+1000,ANNUAL_SALARY=
ANNUAL_SALARY+12000;
Output:
Step 8: Display all the rows of the updated SALARY table.
Query:
SELECT * FROM SALARY;
Output:
Picked
SQL-Query
SQL-Server
SQL
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to create a DataFrame from given vectors in R ?

24 Mar, 2022
In this article we will see how to create a Dataframe from four given vectors in R. To create a data frame in R using the vector, we must first have a series of vectors containing data. The data.frame() function is used to create a data frame from vector in R.
Syntax:
data.frame(vectors)
Example 1. Creating dataframe from given 4 vectors.
R
# creating a vector with some valueid = c(1, 2, 3) # creating another vector with some valuename = c("karthik" , "nikhil" , "sravan") # creating another vector with some valuebranch = c("IT" , "CSE" , "IT") # creating another vector with some value.favourite_subject = c("SE" ,"DAA" , "OS") # passing the vectors into data.frame() function# as parametersdf1=data.frame(id, name, branch, favourite_subject) # printing the data frame.print(df1)
Output:
Example 2:
R
# creating a vector 1 with some valuesfaculty_id = c(247, 143, 01768) # creating a vector 2 with some valuesfaculty_name=c("Subbarao", "praveen kumar", "sujatha") # creating vector 3 with some valuesdesignation=c("accociate professor", "assistant professor",              "accosiate professor") # creating vector 4 with some datasalary = c(60000, 50000, 60000) # passing the vectors to the data.frame() functiondf3 = data.frame(faculty_id, faculty_name, designation,salary) # printing the data frame created with 4 vectorsprint(df3)
Output:
surindertarika1234
surinderdawra388
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
How to Split Column Into Multiple Columns in R DataFrame?
Group by function in R using Dplyr
How to Change Axis Scales in R Plots?
How to filter R DataFrame by values in a column?
How to Split Column Into Multiple Columns in R DataFrame?
How to filter R DataFrame by values in a column?
Replace Specific Characters in String in R
Merge DataFrames by Column Names in R
How to Sort a DataFrame in R ?
Create a Scatter Plot with Multiple Groups using ggplot2 in R - GeeksforGeeks

24 Oct, 2021
In this article, we will discuss how to create a scatter plot with multiple groups in R Programming Language.
Geoms can be added to the plot to compute various graphical representations of the data in the plot (points, lines, bars). The geom_point() method is used to create scatter plots in R. The geoms may also be specified with the additional mappings, like color to differently color the points pertaining to different groups. 
geom_point(aes(color = ))
R
library("ggplot2")    # creating a data framedf < - data.frame(col1=sample(rep(c(1: 5), each=3)),                  col2=5: 19)print("original dataframe")print(df)  # plotting the dataggplot(df, aes(x=col1, y=col2)) +geom_point(aes(color=factor(col1)))
Output
[1] "original dataframe" 
col1 col2 
1     2    5 
2     3    6 
3     4    7 
4     2    8 
5     4    9 
6     1   10 
7     3   11 
8     5   12 
9     5   13 
10    5   14 
11    4   15 
12    1   16 
13    3   17 
14    2   18 
15    1   19
Explanation: The groups are created according to the differences in values of col1. All the circles, for example, belonging to col1=1 are given the red color. This is also illustrated in the index of the plot. 
The following code snippet indicates the method where one of the data frame columns is a non-integral one : 
Python3
library("ggplot2")  # creating a data framedf < - data.frame(col1=sample(rep(c(1: 5), each=3)),                  col2=letters[5:19])  print("original dataframe")print(df)  # plotting the dataggplot(df, aes(x=col1, y=col2)) +geom_point(aes(color=factor(col1)))
Output
[1] "original dataframe" 
col1 col2 
1     2    e 
2     2    f 
3     4    g 
4     3    h 
5     5    i 
6     1    j 
7     5    k 
8     4    l 
9     1    m 
10    2    n 
11    1    o 
12    3    p 
13    5    q 
14    3    r 
15    4    s
Picked
R-ggplot
R Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Change Color of Bars in Barchart using ggplot2 in R
How to Change Axis Scales in R Plots?
Group by function in R using Dplyr
How to Split Column Into Multiple Columns in R DataFrame?
How to import an Excel File into R ?
How to filter R DataFrame by values in a column?
How to filter R dataframe by multiple conditions?
How to change the order of bars in bar chart in R ?
R - if statement
Replace Specific Characters in String in R
Find maximum element of each row in a matrix in C++

Consider we have a matrix, our task is to find the maximum element of each row of that matrix and print them. This task is simple. For each row, reset the max, and find the max element, and print it. Let us see the code for better understanding.
#include<iostream>
#define MAX 10
using namespace std;
void largestInEachRow(int mat[][MAX], int rows, int cols) {
   for (int i = 0; i < rows; i++) {
      int max_row_element = mat[i][0];
   for (int j = 1; j < cols; j++) {
      if (mat[i][j] > max_row_element)
         max_row_element = mat[i][j];
   }
   cout << max_row_element << endl;
}
}
int main() {
   int row = 4, col = 4;
   int mat[][MAX] = { { 3, 4, 1, 81 },
      { 1, 84, 9, 11 },
      { 23, 7, 21, 1 },
      { 2, 1, 44, 5 }
   };
   largestInEachRow(mat, row, col);
}
81
84
23
44
Bootstrap Event when the modal is fully shown

The shown.bs.modal event in Bootstrap fires when the modal is completely displayed.
The modal is displayed using the modal(show) method −
$("#button1").click(function(){
  $("#newModal").modal("show");
});
Fire shown.bs.modal event and generate the alert as shown below −
$("#newModal").on('shown.bs.modal', function () {
  alert('The modal is displayed completely!');
});
You can try to run the following code to implement the shown.bs.modal event in Bootstrap −
Live Demo
<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Bootstrap Example</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  </head>
<body>
  <div class="container">
    <h2>Entrance Exams</h2>  
    <p>The following is the result of the entrance exams:</p>
    <button type="button" class="btn btn-default btn-lg" id="button1">Result</button>
    <div class="modal fade" id="newModal" role="dialog">
      <div class="modal-dialog">
        <div class="modal-content">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal">×</button>
            <h4 class="modal-title">Selected Students</h4>
          </div>
          <div class="modal-body">
            <p>Rahul, Amit and Shweta cleared the exam.</p>
          </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-primary" data-dismiss="modal">Close</button>
          </div>
        </div>
      </div>
  </div>
</div>

<script>
$(document).ready(function(){
  $("#button1").click(function(){
     $("#newModal").modal("show");
  });
  $("#newModal").on('shown.bs.modal', function () {
     alert('The modal is displayed completely!');
  });
});
</script>

</body>
</html>
string capitalize() in Python - GeeksforGeeks

02 Dec, 2020
In Python, the capitalize() method returns a copy of the original string and converts the first character of the string to a capital (uppercase) letter while making all other characters in the string lowercase letters. 
Syntax: 
string_name.capitalize() 

string_name: It is the name of string of
             whose first character we want
             to capitalize.
Parameter: The capitalize() function does not takes any parameter. Return value: The capitalize() function returns a string with the first character in the capital. Below is the python program to illustrate capitalize() function:  
Python
# Python program to demonstrate the# use of capitalize() function # capitalize() first letter of string# and make other letters lowercasename = "geeks FOR geeks" print(name.capitalize()) # demonstration of individual words# capitalization to generate camel casename1 = "geeks"name2 = "for"name3 = "geeks"print(name1.capitalize() + name2.capitalize()                         + name3.capitalize())
Output:  
Geeks for geeks
GeeksForGeeks
 
tim22
python-string
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
Python Dictionary
Taking input in Python
Read a file line by line in Python
Enumerate() in Python
How to Install PIP on Windows ?
Iterate over a list in Python
Check if a File is Hidden in Java - GeeksforGeeks

18 Apr, 2022
isHidden() method of File class in Java can use be used to check if a file is hidden or not. This method returns a boolean value – true or false.
Syntax:
public static boolean isHidden(Path path) 
throws IOException
Parameters: Path to the file to test.
Return Type: A boolean value, true if file is found hidden else returns false as a file is not found hidden 
Exceptions Thrown:
IOException: If an I/O error occurs
SecurityException: In the case of the default provider, and a security manager is installed, the checkRead() method is invoked to check read access to the file.
Remember: Depending on the implementation the isHidden() method may require to access the file system to determine if the file is considered hidden.
Example:
Java
// Java Program to Check if Given File is Hidden or Not// Using isHidden() Method of File class // Importing required classesimport java.io.File;import java.io.IOException; // Main class// HiddenFileCheckpublic class GFG {     // Main driver method    public static void main(String[] args)        throws IOException, SecurityException    {         // Creating a file by        // creating an object of File class        File file = new File(            "/users/mayanksolanki/Desktop/demo.rtf");         // Checking whether file is hidden or not        // using isHidden() method        if (file.isHidden())             // Print statement as file is found hidden            System.out.println(                "The specified file is hidden");        else             // Print statement as file is found as not            // hidden            System.out.println(                "The specified file is not hidden");    }}
Output: 
Output Explanation: As it can easily be visualized from the background of the output that the ‘demo.rtf’ file popping icon is clearly seen. The code reflects that a specific file is not hidden on the terminal output as seen above.
Note: The precise definition of hidden is a platform or provider-dependent.
UNIX: A file is hidden if its name begins with a period character (‘.’).
Windows: A file is hidden if it is not a directory and the DOS hidden attribute is set. 
This article is contributed by Saket Kumar. If you like GeeksforGeeks and would like to contribute, you can also write an article using write.geeksforgeeks.org or mail your article to review-team@geeksforgeeks.org. 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.
solankimayank
java-file-handling
Java-I/O
Java-Library
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Stream In Java
Different ways of Reading a text file in Java
Constructors in Java
Exceptions in Java
Functional Interfaces in Java
Generics in Java
Comparator Interface in Java with Examples
HashMap get() Method in Java
Introduction to Java
Difference between Abstract Class and Interface in Java
Single dimensional array in Java

Following is a simple example of a single dimensional array.
 Live Demo
public class Tester {
   public static void main(String[] args) {
      double[] myList = {1.9, 2.9, 3.4, 3.5};
      // Print all the array elements
      for (double element: myList) {
         System.out.print(element + " ");
      }
   }
}
1.9 2.9 3.4 3.5
Negative of an image in MATLAB - GeeksforGeeks

28 Jul, 2020
The negative of an image is achieved by replacing the intensity ‘i’ in the original image by ‘i-1’, i.e. the darkest pixels will become the brightest and the brightest pixels will become the darkest. Image negative is produced by subtracting each pixel from the maximum intensity value.For example in an 8-bit grayscale image, the max intensity value is 255, thus each pixel is subtracted from 255 to produce the output image.The transformation function used in image negative is :
s = T(r) = (L – 1) – r

Where L - 1 is the max intensity value,
s is the output pixel value and
r is the input pixel value

Algorithm
Read RGB color image into the MATLAB environment using Matlab inbuilt function imread()Calculate the levels of the image, for example an 8-bit image has 256 levelsUse the formula stated above on every pixel of the image to get corresponding negative pixel value.Convert each RGB pixel value at location (i, j) to its negative image values and assign it to the corresponding location (i, j) of another matrixDisplay the negative image using Matlab in-built imshow() function.
Read RGB color image into the MATLAB environment using Matlab inbuilt function imread()
Calculate the levels of the image, for example an 8-bit image has 256 levels
Use the formula stated above on every pixel of the image to get corresponding negative pixel value.
Convert each RGB pixel value at location (i, j) to its negative image values and assign it to the corresponding location (i, j) of another matrix
Display the negative image using Matlab in-built imshow() function.
% reading the RGB file into the Matlab environmentskI = imread("sakura.jpg");   subplot(1, 2, 1),  % displaying the RGB imageimshow(skI);title("Original image");  % levels of the 8-bit imageL = 2 ^ 8;      % finding the negative                   neg = (L - 1) - skI;subplot(1, 2, 2),  % displaying the negative imageimshow(neg);title("Negative Image")
Output :
Image-Processing
MATLAB
Advanced Computer Subject
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
ML | Linear Regression
Decision Tree
Copying Files to and from Docker Containers
System Design Tutorial
Python | Decision tree implementation
Decision Tree Introduction with example
Reinforcement learning
KDD Process in Data Mining
ML | Underfitting and Overfitting
Clustering in Machine Learning
Mahotas – Gaussian filtering

06 May, 2021
In this article we will see how we can do Gaussian filtering in mahotas. For this we are going to use the fluorescent microscopy image from a nuclear segmentation benchmark. We can get the image with the help of command given below  
mhotas.demos.nuclear_image()
A Gaussian filter is a linear filter. It’s usually used to blur the image or to reduce noise. If you use two of them and subtract, you can use them for “unsharp masking” (edge detection). The Gaussian filter alone will blur edges and reduce contrast.Below is the nuclear_image  
In order to do this we will use mahotas.gaussian_filter method  
Syntax : mahotas.gaussian_filter(nuclear, 20)Argument : It takes numpy.ndarray object as argument and a integerReturn : It returns numpy.ndarray object  
Note : The input of the gaussian filter should be the filtered image object In order to filter the image we will take the image object which is numpy.ndarray and filter it with the help of indexing, below is the command to do this  
image = image[:, :, 0]
Example 1 :  
Python3
# importing required librariesimport mahotasimport mahotas.demosimport numpy as npfrom pylab import imshow, show # getting nuclear imagenuclear = mh.demos.nuclear_image()  # filtering the imagenuclear = nuclear[:, :, 0] print("Image with filter")# showing the imageimshow(nuclear)show() # setting gaussian filternuclear = mahotas.gaussian_filter(nuclear, 35) print("Image with gaussian filter")# showing the gaussian filterimshow(nuclear)show()
Output :  
Example 2:  
Python3
# importing required librariesimport numpy as npimport mahotasfrom pylab import imshow, show # loading imageimg = mahotas.imread('dog_image.png') # filtering the imageimg = img[:, :, 0]   print("Image with filter")# showing the imageimshow(img)show()  # setting gaussian filtergaussian = mahotas.gaussian_filter(img, 15) print("Image with gaussian filter")# showing the gaussian filterimshow(gaussian)show()
Output :  
 
sweetyty
arorakashish0911
Image-Processing
Python-Mahotas
Python
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
CSS | :disabled Selector

04 Dec, 2018
The :disabled selector is used to select the disabled element. This property is mostly used on the form elements.
Syntax:
:disabled {
    // CSS property
} 
You can also Set a background color for all disabled input elements of type=”text”:
input[type=text]:disabled {
    background: #dddddd;
}
Example 1:
<!DOCTYPE html><html>    <head>        <title>disable property</title>        <style>             h1 {            color:green;            }            input[type=text]:enabled {                background: green;            }                          input[type=text]:disabled {                background: white;            }            input {                width:150px;                padding-left:10px;                margin-top:10px;                border:1px solid black;            }            body {                text-align:center;            }        </style>    </head>    <body>        <h1>GeeksforGeeks</h1>        <h2>:disabled Selector</h2>        <form action="">            Author Name: <input type="text" value="Geeks"><br>            College Name: <input type="text" value="GFG"><br>            Country: <input type="text" disabled="disabled"             value="India">        </form>    </body></html>                    
Output:
Example 2:
<!DOCTYPE html><html>    <head>        <title>disable selector</title>        <style>             h1 {                color:green;            }            body {                text-align:center;            }        </style>    </head>    <body>        <h1>GeeksForGeeks</h1>        <h2>:disabled Selector</h2>        <select>            <option value="s1">Data Structure</option>            <option value="s2" disabled>Algorithm</option>            <option value="s3">Operating System</option>            <option value="s4" disabled>HTML</option>            <option value="s5">C programming</option>        </select>    </body></html>                    
Output
Supported Browsers: The browser supported by :disabled selector are listed below:
Apple Safari 3.2
Google Chrome 4.0
Firefox 3.5
Opera 9.6
Internet Explorer 9.0
More Selectors:
Advanced Selectors
Checked Selectors
Attribute Selector
CSS-Selectors
CSS
HTML
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
What does the 'tearoff' attribute do in a Tkinter Menu?

Using Tkinter.Menu, we can create menus and submenus. Also, there are some other properties which are used with tkinter menus.
Tearoff property makes the menus in the window as tearable. tearoff attribute accepts a Boolean value to separate the menu from the main window or the parent window. With tearoff attribute, we have two options,
If tearoff=0, make the menu stick to the Window.
If tearoff=0, make the menu stick to the Window.
If tearoff=1, it display a “----” empty dotted lines on the menus through which we can separate our menu from the window.
If tearoff=1, it display a “----” empty dotted lines on the menus through which we can separate our menu from the window.
#Importing the tkinter library
from tkinter import *
win= Tk()
win.title("Tearoff Example")
win.geometry("600x500")

#Define a Function for Menu Selection Event
def mytext():
   lab= Label(win,text= "You have made a selection", font=('Helvetica',20)).pack(pady=20)

#Create a Menubar
menu_bar = Menu(win)

#Make the menus non-tearable
file_menu = Menu(menu_bar, tearoff=0)

#Tearable Menu
#file_menu= Menu(menu_bar, tearoff=1)
file_menu.add_command(label="New",command=mytext)
# all file menu-items will be added here next
menu_bar.add_cascade(label='File', menu=file_menu)
win.config(menu=menu_bar)

mainloop()
Running the above snippet will generate the output and will show a window which
will have a menu.
Thus, for non-tearable and tearable menus (tearoff=0 and tearoff=1), the output
will be as follows −
Fix Drop table view #1051 unknown table error in MySQL

To correctly drop a view, use the below syntax −
drop view yourViewName;
Let us first create a table −
mysql> create table DemoTable
-> (
-> Id int
-> );
Query OK, 0 rows affected (1.01 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable values(1001);
Query OK, 1 row affected (0.22 sec)

mysql> insert into DemoTable values(1002);
Query OK, 1 row affected (0.34 sec)

mysql> insert into DemoTable values(1003);
Query OK, 1 row affected (0.26 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable;
This will produce the following output −
+------+
| Id   |
+------+
| 1001 |
| 1002 |
| 1003 |
+------+
3 rows in set (0.00 sec)
Let us first create a view −
mysql> create view view_DemoTable as select Id from DemoTable;
Query OK, 0 rows affected (0.23 sec)
We will now display the records of the view −
mysql> select *from view_DemoTable;
This will produce the following output −
+------+
| Id   |
+------+
| 1001 |
| 1002 |
| 1003 |
+------+
3 rows in set (0.05 sec)
Following is the query to drop view −
mysql> drop view view_DemoTable;
Query OK, 0 rows affected (0.18 sec)
Now view is dropped successfully.
Google Guice - Overview

Guice is an open source, Java-based dependency injection framework. It is quiet lightweight and is actively developed/managed by Google.
Every Java-based application has a few objects that work together to present what the end-user sees as a working application. When writing a complex Java application, application classes should be as independent as possible of other Java classes to increase the possibility to reuse these classes and to test them independently of other classes while unit testing. Dependency Injection (or sometime called wiring) helps in gluing these classes together and at the same time keeping them independent.
Consider you have an application which has a text editor component and you want to provide a spell check. Your standard code would look something like this −
public class TextEditor {
   private SpellChecker spellChecker;
   
   public TextEditor() {
      spellChecker = new SpellChecker();
   }
}
What we've done here is, create a dependency between the TextEditor and the SpellChecker. In an inversion of control scenario, we would instead do something like this −
public class TextEditor {
   private SpellChecker spellChecker;
   
   @Inject
   public TextEditor(SpellChecker spellChecker) {
      this.spellChecker = spellChecker;
   }
}
Here, the TextEditor should not worry about SpellChecker implementation. The SpellChecker will be implemented independently and will be provided to the TextEditor at the time of TextEditor instantiation.

Dependency Injection is controlled by the Guice Bindings.  Guice uses bindings to map object types to their actual implementations. These bindings are defined a module. A module is a collection of bindings as shown below:
public class TextEditorModule extends AbstractModule {
   @Override 
   protected void configure() {
      /*
      * Bind SpellChecker binding to WinWordSpellChecker implementation 
      * whenever spellChecker dependency is used.
      */
      bind(SpellChecker.class).to(WinWordSpellChecker.class);
   }
}
The Module is the core building block for an Injector which is Guice's object-graph builder. First step is to create an injector and then we can use the injector to get the objects.
public static void main(String[] args) {
   /*
   * Guice.createInjector() takes Modules, and returns a new Injector
   * instance. This method is to be called once during application startup.
   */
   Injector injector = Guice.createInjector(new TextEditorModule());
   /*
   * Build object using injector
   */
   TextEditor textEditor = injector.getInstance(TextEditor.class);   
}
In above example, TextEditor class object graph is constructed by Guice and this graph contains TextEditor object and its dependency as WinWordSpellChecker object.

    27 Lectures 
     1.5 hours 

 Lemuel Ogbunude
 Print
 Add Notes
 Bookmark this page