code-rag-bench/online-tutorials huggingface dataset:
fmt.Println() Function in Golang With Examples

05 May, 2020
In Go language, fmt package implements formatted I/O with functions analogous to C’s printf() and scanf() function. The fmt.Println() function in Go language formats using the default formats for its operands and writes to standard output. Here spaces are always added between operands and a newline is appended at the end. Moreover, this function is defined under the fmt package. Here, you need to import the “fmt” package in order to use these functions.
Syntax:
func Println(a ...interface{}) (n int, err error)

Here, “a ...interface{}” contains some strings including specified constant variables.
Return Value: It returns the number of bytes written and any write error encountered.
Example 1:
// Golang program to illustrate the usage of// fmt.Println() function  // Including the main packagepackage main  // Importing fmtimport (    "fmt")  // Calling mainfunc main() {      // Declaring some const variables    const name, dept = "GeeksforGeeks", "CS"      // Calling Println() function    fmt.Println(name, "is", "a", dept, "Portal.")      // It is conventional not to worry about any    // error returned by Println.  }
Output:
GeeksforGeeks is a CS Portal.

In the above code, it can be seen that the function Println() is not containing any space within the specified strings still in output is print space that can be seen from the above output.
Example 2:
// Golang program to illustrate the usage of// fmt.Println() function  // Including the main packagepackage main  // Importing fmtimport (    "fmt")  // Calling mainfunc main() {      // Declaring some const variables    const num1, num2, num3, num4 = 5, 10, 15, 50      // Calling Println() function    fmt.Println(num1, "+", num2, "=", num3)    fmt.Println(num1, "*", num2, "=", num4)      // It is conventional not to worry about any    // error returned by Println.  }
Output:
5 + 10 = 15
5 * 10 = 50

In the above code, it can be seen that the function Println() is not using any newline (\n) still in the output it prints new line that can be seen from above shown output.
Golang-fmt
Go Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Java Swing | JTable

12 Oct, 2021
The JTable class is a part of Java Swing Package and is generally used to display or edit two-dimensional data that is having both rows and columns. It is similar to a spreadsheet. This arranges data in a tabular form.Constructors in JTable: 
JTable(): A table is created with empty cells.JTable(int rows, int cols): Creates a table of size rows * cols.JTable(Object[][] data, Object []Column): A table is created with the specified name where []Column defines the column names.
JTable(): A table is created with empty cells.
JTable(int rows, int cols): Creates a table of size rows * cols.
JTable(Object[][] data, Object []Column): A table is created with the specified name where []Column defines the column names.
Functions in JTable: 
addColumn(TableColumn []column) : adds a column at the end of the JTable.clearSelection() : Selects all the selected rows and columns.editCellAt(int row, int col) : edits the intersecting cell of the column number col and row number row programmatically, if the given indices are valid and the corresponding cell is editable.setValueAt(Object value, int row, int col) : Sets the cell value as ‘value’ for the position row, col in the JTable.
addColumn(TableColumn []column) : adds a column at the end of the JTable.
clearSelection() : Selects all the selected rows and columns.
editCellAt(int row, int col) : edits the intersecting cell of the column number col and row number row programmatically, if the given indices are valid and the corresponding cell is editable.
setValueAt(Object value, int row, int col) : Sets the cell value as ‘value’ for the position row, col in the JTable.
Below is the program to illustrate the various methods of JTable: 
Java
// Packages to importimport javax.swing.JFrame;import javax.swing.JScrollPane;import javax.swing.JTable; public class JTableExamples {    // frame    JFrame f;    // Table    JTable j;     // Constructor    JTableExamples()    {        // Frame initialization        f = new JFrame();         // Frame Title        f.setTitle("JTable Example");         // Data to be displayed in the JTable        String[][] data = {            { "Kundan Kumar Jha", "4031", "CSE" },            { "Anand Jha", "6014", "IT" }        };         // Column Names        String[] columnNames = { "Name", "Roll Number", "Department" };         // Initializing the JTable        j = new JTable(data, columnNames);        j.setBounds(30, 40, 200, 300);         // adding it to JScrollPane        JScrollPane sp = new JScrollPane(j);        f.add(sp);        // Frame Size        f.setSize(500, 200);        // Frame Visible = true        f.setVisible(true);    }     // Driver  method    public static void main(String[] args)    {        new JTableExamples();    }}
Output: 
surindertarika1234
java-swing
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
p5.js | keyReleased() Function

27 Mar, 2020
The keyReleased() function is invoked whenever a key is called every time when a key is pressed. The most recently typed ASCII key is stored into the ‘key’ variable, however, it does not distinguish between uppercase and lowercase characters. The non-ASCII characters can be accessed in the ‘keyCode’ variable with their respective codes.
Different browsers may have their own default behavior attached to some of the keys. This can be prevented by adding “return false” to the end of the function.
Syntax:
keyReleased()
Parameters: This method does not accept any parameters.
Below examples illustrate the keyReleased() function in p5.js:
Example:
function setup() {  createCanvas(600, 200);  textSize(20);  text("Press any key to check if "        + "it is being pressed or "        + "released", 10, 20);}   function keyPressed() {  clear();  textSize(20);  text("Press any key to check if "        + "it is being pressed or "        + "released", 10, 20);  textSize(30);      text("You are pressing: "         + key, 20, 100);}   function keyReleased() {  clear();  textSize(20);  text("Press any key to check if "        + "it is being pressed or "        + "released", 10, 20);  textSize(30);      text("You released: "        + key, 20, 100);}
Output:
Environment Setup: https://www.geeksforgeeks.org/p5-js-soundfile-object-installation-and-methods/
Reference: https://p5js.org/reference/#/p5/keyReleased
JavaScript-p5.js
JavaScript
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to get seconds since epoch in JavaScript?

14 May, 2020
Given a date, we have to find the number of seconds since the epoch (i.e. 1 January 1970, 00:00:00 UTC ). The getTime() method in the JavaScript returns the number of milliseconds since January 1, 1970, or epoch. If we divide these milliseconds by 1000 and then integer part will give us the number of seconds since epoch.
Example:
Input: Date = 27-04-2020, 11:55:55
Output: Seconds since epoch - 1587968755

Syntax:
new Date(year, month, day, hours, minutes, seconds, milliseconds)
Example:
<script type="text/javascript">    function seconds_since_epoch(d){         return Math.floor( d / 1000 );     }          // Driver Code    var d = new Date(2020, 4, 29, 22, 00, 00, 00);    var sec = seconds_since_epoch(d);    document.write("Date " + d + " has "                    + sec+ " seconds till epoch.");</script>                    
Output:
Date Fri May 29 2020 22:00:00 GMT+0530 (India Standard Time) 
has 1590769800 seconds till epoch.
javascript-date
Picked
Web Technologies
Web technologies Questions
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Top 10 Projects For Beginners To Practice HTML and CSS Skills
Installation of Node.js on Linux
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 ?
Installation of Node.js on Linux
How to insert spaces/tabs in text using HTML/CSS?
Remove elements from a JavaScript Array
How to set the default value for an HTML <select> element ?
How to set input type date in dd-mm-yyyy format using HTML ?
How to get current date and time in firebase using ReactJS ?

28 Jun, 2021
The following approach covers how to get the current date and time in firebase using react. We have used the firebase module to achieve so.
Creating React Application and Installing Module:
Step 1: Create a React-app using the following command:npx create-react-app myapp
Step 1: Create a React-app using the following command:
npx create-react-app myapp
Step 2: After creating your project folder i.e. myapp, move to it using the following command:cd myapp
Step 2: After creating your project folder i.e. myapp, move to it using the following command:
cd myapp
 
Step 3: After creating the ReactJS application, Install the firebase module using the following command:npm install firebase@8.3.1 --save
Step 3: After creating the ReactJS application, Install the firebase module using the following command:
npm install firebase@8.3.1 --save
Project structure: Our project structure will look like this.
Example: Now implement the time and date part. Here, We are going to use a method called Timestamp which helps us to get the current date and time.
App.js
import React from 'react';import firebase from 'firebase';import {useState} from 'react';  function App() {  // Current state  const [curr , setCurr] = useState('');      // Function to get time and date  const getDate = () => {      const a = firebase.firestore          .Timestamp.now().toDate().toString();      setCurr(a);  }      return (    <div>      <center>        <h1>{curr}</h1>        <button onClick={getDate}>Show Date</button>      </center>    </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:
Firebase
React-Questions
ReactJS
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Axios in React: A Guide for Beginners
ReactJS useNavigate() Hook
How to do crud operations in ReactJS ?
How to install bootstrap in React.js ?
How to Use Bootstrap with React?
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?
Differences between Functional Components and Class Components in React
jQuery UI Tooltips destroy() Method

05 Feb, 2021
jQuery UI consists of GUI widgets, visual effects, and themes implemented using jQuery, CSS, and HTML. jQuery UI is great for building UI interfaces for the webpages. jQuery UI tooltip widget helps us to add new themes and allows for customization. In this article, we will see how to use destroy option in jQuery UI tooltips. The destroy option is used to destroy the tooltips in jQuery UI.
Syntax:
$(".selector").tooltip("destroy");
Parameters: This method does not accept any parameters.
CDN Link: First, add jQuery UI scripts needed for your project.
<link href = “https://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css” rel = “stylesheet”><script src = “https://code.jquery.com/jquery-1.10.2.js”></script><script src = “https://code.jquery.com/ui/1.10.4/jquery-ui.js”></script>
Example : The following example demonstrates the destroy option for the tooltip. Once the ‘click to destroy!’ option is clicked, it destroys the 
HTML
<!DOCTYPE html><html lang="en">  <head>    <meta charset="utf-8" />    <link      href="https://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css"      rel="stylesheet"    />    <script src="https://code.jquery.com/jquery-1.10.2.js">    </script>    <script src="https://code.jquery.com/ui/1.10.4/jquery-ui.js">    </script>      <h1 style="color: green">GeeksforGeeks</h1>    <h3>jQuery UI | Tooltip destroy method</h3>      <script>      $(function () {        $("#gfgtt").tooltip({          track: true,        });        $("#gfg").click(function () {          $("#gfgtt").tooltip("destroy");        });      });    </script>  </head>    <body>    <input      id="gfg"      type="submit"      name="GeeksforGeeks"      value="click to destroy!"    />    <button id="gfgtt" title="GeeksforGeeks">Click here!</button>  </body></html>
Output:
Reference: https://api.jqueryui.com/tooltip/#method-destroy
jQuery-UI
JQuery
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
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 add options to a select element using jQuery?
jQuery | children() with Examples
Top 10 Projects For Beginners To Practice HTML and CSS Skills
Installation of Node.js on Linux
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 ?
Tags vs Elements vs Attributes in HTML

11 Jun, 2021
HTML Tags: Tags are the starting and ending parts of an HTML element. They begin with < symbol and end with > symbol. Whatever written inside < and > are called tags.Example:  
html
<b> </b>
HTML elements: Elements enclose the contents in between the tags. They consist of some kind of structure or expression. It generally consists of a start tag, content and an end tag.Example:  
html
<b>This is the content.</b>
This is the content.
Where, <b> is the starting tag and </b> is the ending tag.HTML Attributes: It is used to define the character of an HTML element. It always placed in the opening tag of an element. It generally provides additional styling (attribute) to the element.Example:  
html
<p align="center">This is paragraph.</p>
This is paragraph.
What are Tags and Attributes?
Tags and attributes are the basis of HTML.
They work together but perform different functions – it is worth investing 2 minutes in differentiating the two.
What Are HTML Tags?
Tags are used to mark up the start of an HTML element and they are usually enclosed in angle brackets. An example of a tag is: <h1>.
Most tags must be opened <h1> and closed </h1> in order to function.
What are HTML Attributes?
Attributes contain additional pieces of information. Attributes take the form of an opening tag and additional info is placed inside.
An example of an attribute is:
<img src="mydog.jpg" alt="A photo of my dog.">
In this instance, the image source (src) and the alt text (alt) are attributes of the <img> tag.
Golden Rules To Remember
The vast majority of tags must be opened (<tag>) and closed (</tag>) with the element information such as a title or text resting between the tags.
When using multiple tags, the tags must be closed in the order in which they were opened. For example:
           Example: <strong><em>This is really important!</em></strong>
rahulkumarmr360
HTML-Misc
HTML
Technical Scripter
Web Technologies
Web technologies Questions
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
DAX Filter - KEEPFILTERS function

Modifies how filters are applied while evaluating a CALCULATE or CALCULATETABLE function.
KEEPFILTERS (<expression>) 

Expression
Any DAX expression.
DAX KEEPFILTERS function does not return any value.
You can use DAX KEEPFILTERS function within the context CALCULATE and CALCULATETABLE functions, to override the standard behavior of those functions.
When you use KEEPFILTERS, any existing filters in the current context are compared with the columns in the filter arguments, and the intersection of those arguments is used as the context for evaluating the expression.
The net effect over any one column is that both sets of arguments apply −
The filter arguments used in CALCULATE function.
The filters in the arguments of the KEEPFILTER function.
In other words, while CALCULATE filters replace the current context, KEEPFILTERS adds filters to the current context.
= SUMX ( 
   CALCULATETABLE (East_Sales, 
   FILTER(East_Sales,East_Sales[Product] = [Product]),
Program to print multiplication table of any number in PHP - GeeksforGeeks

27 Oct, 2021
In this article, we will see how to print the multiplication table of any given number using PHP. To make the multiplication table, first, we get a number input from the user and then use for loop to display the multiplication table.
We use HTML and PHP to display the multiplication table. The HTML part is used to design a form to get the input from the user and the PHP part is used to execute the multiplication and display the results in table format.
Example:
PHP
<!DOCTYPE html><html>  <body>    <center>        <h1 style="color: green;">            GeeksforGeeks        </h1>          <h3>            Program to print multiplication<br>            table of any number in PHP        </h3>          <form method="POST">            Enter a number:             <input type="text" name="number">                          <input type="Submit"                 value="Get Multiplication Table">        </form>    </center></body>  </html>  <?phpif($_POST) {    $num = $_POST["number"];      echo nl2br("<p style='text-align: center;'>        Multiplication Table of $num: </p>    ");              for ($i = 1; $i <= 10; $i++) {        echo ("<p style='text-align: center;'>$num"            . " X " . "$i" . " = "             . $num * $i . "</p>        ");    }}?>
Output:
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.
HTML-Questions
loop
PHP-math
PHP-Questions
HTML
PHP
Web Technologies
HTML
PHP
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 ?
How to Insert Form Data into Database using PHP ?
REST API (Introduction)
CSS to put icon inside an input element in a form
Types of CSS (Cascading Style Sheet)
Advantages and Disadvantages of PHP
How to Upload Image into Database and Display it using PHP ?
PHP | Converting string to Date and DateTime
How to check whether an array is empty using PHP?
Best way to initialize empty array in PHP
Python PIL | ImageChops.screen() and ImageChops.offset() method - GeeksforGeeks

22 Jun, 2021
PIL is the Python Imaging Library which provides the python interpreter with image editing capabilities. 
This method is used to superimpose two inverted images on top of each other. 
Syntax: ImageChops.screen(image1, image2)

Parameters:
image1 first image
image2 second image

Return Value: An Image
 
Python3
# This will import Image and ImageChops modulesfrom PIL import Image, ImageChops # Opening Imagesim = Image.open(r"C:\Users\Admin\Pictures\images.png")im2 = Image.open(r"C:\Users\Admin\Pictures\download.PNG") # superimposing images im and im2im3 = ImageChops.screen(im, im2) # showing resultant imageim3.show()
Output:  
 
This method returns a copy of the image where data has been offset by the given distances. Data wraps around the edges. If yoffset is omitted, it is assumed to be equal to xoffset. 
Syntax: ImageChops.offset(image1, xoffset, yoffset = None)Parameters: image: It is the image on which offset is provided xoffset: the horizontal distance yoffset: it is the vertical distance, if omitted both distance are set to same.Return value: Copy of the original image  
 
Python3
# This will import Image and ImageChops modulesfrom PIL import Image, ImageChops # Opening Imagesim = Image.open(r"C:\Users\Admin\Pictures\images.png")im2 = Image.open(r"C:\Users\Admin\Pictures\download.PNG") # Here, xoffset is given 100# yoffset wil automatically set to 100im3 = ImageChops.offset(im, 140) # showing resultant imageim3.show()
Output:  
 
simranarora5sos
Image-Processing
python-utility
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
Prefix matching in Python using pytrie module - GeeksforGeeks

23 Nov, 2020
Given a list of strings and a prefix value sub-string, find all strings from given list of strings which contains given value as prefix ?
Examples:
Input : arr = ['geeksforgeeks', 'forgeeks', 
               'geeks', 'eeksfor'], 
       prefix = 'geek'
Output : ['geeksforgeeks','geeks']

A Simple approach to solve this problem is to traverse through complete list and match given prefix with each string one by one, print all strings which contains given value as prefix.
We have existing solution to solve this problem using Trie Data Structure. We can implement Trie in python using pytrie.StringTrie() module.
Create : trie=pytrie.StringTrie() creates a empty trie data structure.
Insert : trie[key]=value, key is the data we want to insert in trie and value is similar to bucket which gets appended just after the last node of inserted key and this bucket contains the actual value of key inserted.
Search : trie.values(prefix), returns list of all keys which contains given prefix.
Delete : del trie[key], removes specified key from trie data structure.
Note : To install pytrie package use this pip install pytrie –user command from terminal in linux.
# Function which returns all strings # that contains given prefix from pytrie import StringTrie   def prefixSearch(arr,prefix):           # create empty trie     trie=StringTrie()       # traverse through list of strings     # to insert it in trie. Here value of     # key is itself key because at last     # we need to return     for key in arr:         trie[key] = key       # values(search) method returns list     # of values of keys which contains     # search pattern as prefix     return trie.values(prefix)   # Driver program if __name__ == "__main__":     arr = ['geeksforgeeks','forgeeks','geeks','eeksfor']     prefix = 'geek'    output = prefixSearch(arr,prefix)     if len(output) > 0:         print (output)     else:         print ('Pattern not found')
Output:
['geeksforgeeks','geeks']
This article is contributed by Shashank Mishra (Gullu). 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.
Python
Strings
Strings
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
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
Longest Common Subsequence | DP-4
Multiplication Table Generator using Python - GeeksforGeeks

25 Feb, 2021
Prerequisites: Python GUI- Tkinter
We all know that Tkinter is the standard GUI library for Python. Python when combined with Tkinter provides a fast and easy way to create GUI applications. In this article, we will learn How to create a Times-table using Tkinter.
Approach:
Import Tkinter Library
Create Function of Multiplication Table
Create the main window (container)
Create Variabletext field that store value of Number
Call the function By Generate Table Button
Execute code
Program:
Python
#import libraryimport sysfrom tkinter import *    def MultiTable():      print("\n:Multiplication Table:\n")    print("\nTimes-Table of Number", (EnterTable.get()), '\n')      for x in range(1, 13):        number = int(EnterTable.get())        print('\t\t', (number), 'x', (x), '=', (x*number),)    # Create Main windowTable = Tk()Table.geometry('250x250+700+200')Table.title('Multiplication Table')  # Variable DeclarationEnterTable = StringVar()  label1 = Label(Table, text='Enter Your Times-table Number:',               font=30, fg='Black').grid(row=1, column=6)label1 = Label(Table, text='                     ').grid(row=2, column=6)  # Store Number in Textvariableentry = Entry(Table, textvariable=EnterTable,              justify='center').grid(row=3, column=6)label1 = Label(Table, text='                     ').grid(row=4, column=6)  # Call the functionbutton1 = Button(Table, text="Generate Table", fg="Blue",                 command=MultiTable).grid(row=5, column=6)label1 = Label(Table, text='                     ').grid(row=6, column=6)  # ExitEXIT = Button(Table, text="Quit", fg="red",              command=Table.destroy).grid(row=7, column=6)  Table.mainloop()
Output:
Python Tkinter-exercises
Python-tkinter
Technical Scripter 2020
Python
Technical Scripter
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Defaultdict in Python
How to Install PIP on Windows ?
Deque in Python
Python math function | sqrt()
Bar Plot in Matplotlib
Check if element exists in list in Python
How to drop one or multiple columns in Pandas Dataframe
Python Classes and Objects
Python | Output Formatting
Class method vs Static method in Python
How to detect user pressing Home Key in an Activity on Android?

This example demonstrates how do I detect user pressing home key in an activity on 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"
   android:orientation = "vertical"
   android:layout_width = "match_parent"
   android:gravity = "center"
   android:layout_height = "match_parent">
   <TextView
      android:id = "@+id/textView"
      android:layout_width = "fill_parent"
      android:gravity = "center"
      android:textSize = "30sp"
      android:layout_height = "wrap_content"
      android:text = "Click here" />
</LinearLayout>
Step 3 − Add the following code to src/MainActivity.java
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
   TextView textView;
   @Override
   protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      textView = (TextView)findViewById(R.id.textView);
      textView.setOnClickListener(new View.OnClickListener() {
         @Override
         public void onClick(View v) {
            onUserLeaveHint();
         }
      });
   }
   @Override
   protected void onUserLeaveHint(){
      textView.setText("Home Button Pressed");
      Toast.makeText(MainActivity.this, "Home Button pressed", Toast.LENGTH_SHORT).show();
      super.onUserLeaveHint();
   }
}
Step 4 − Add the following code to androidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="app.com.sample">
   <application
      android:allowBackup="true"
      android:icon="@mipmap/ic_launcher"
      android:label="@string/app_name"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:supportsRtl="true"
      android:theme="@style/AppTheme">
      <activity android:name=".MainActivity">
         <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
         </intent-filter>
      </activity>
   </application>
</manifest>
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.
wprintf() and wscanf in C Library

Here we will see the wprintf() and wscanf() functions in C. These are the printf() and scanf() functions for wide characters. These functions are present in the wchar.h
The wprintf() function is used to print the wide character to the standard output. The wide string format may contain the format specifiers which is starting with % sign, these are replaced by the values of variables which are passed to the wprintf().
The syntax is like below −
int wprintf (const wchar_t* format, ...);
This function takes the format. This format is a pointer to a null terminated wide string, that will be written in the console. It will hold wide characters and some format specifiers starting with %. Then the (...) is indicating the additional arguments. These are the data that will be printed, they occur in a sequence according to the format specifiers.
This function returns the number of printed characters. On failure, this may return negative values.
#include <stdio.h>
#include <wchar.h>
main() {
   wint_t my_int = 10;
   wchar_t string[] = L"Hello World";
   wprintf(L"The my_int is: %d \n", my_int);
   wprintf(L"The string is: %ls \n", string);
}
The my_int is: 10
The string is: Hello World
The wscanf() function is used to take the data from console, and store them into proper variable. The additional arguments should point to already allocated objects of the type specified by their corresponding format specifier inside the format string.
#include <stdio.h>
#include <wchar.h>
main() {
   wint_t my_int = 10;
   wprintf(L"Enter a number: ");
   wscanf(L"%d", &my_int);
   wprintf(L"The given integer is: %d \n", my_int);
}
Enter a number: 40
The given integer is: 40
Lodash _.isNaN() Method - GeeksforGeeks

16 Sep, 2020
The Lodash _.isNaN() Method checks the given value is NaN or not. This method is not the same as the JavaScript isNaN() method which returns true for undefined and other non-number values.
Syntax:
_.isNaN( value )

Parameters: This method accepts a single parameter as mentioned above and described below:
value: This parameter holds the value that need to be checked for NaN.
Return Value: This method returns a Boolean value (Returns true if the value is NaN, else false).
Example 1: 
Javascript
// Defining Lodash variable const _ = require('lodash');   // Checkingconsole.log(_.isNaN(NaN));
Output:
true

Example 2: For checking with an empty source this method returns true.
Javascript
// Defining Lodash variable const _ = require('lodash');   // Checkingconsole.log(_.isNaN(new Number(NaN)));
Output:
true

Example 3: This method also works for arrays.
Javascript
// Defining Lodash variable const _ = require('lodash');   // Checkingconsole.log(_.isNaN(undefined));   // Checkingconsole.log(_.isNaN(10));
Output:
false
false

JavaScript-Lodash
JavaScript
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Difference between var, let and const keywords in JavaScript
Convert a string to an integer in JavaScript
Differences between Functional Components and Class Components in React
How to append HTML code to a div using JavaScript ?
How to Open URL in New Tab using JavaScript ?
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?
Python List count() Method

Python list method count() returns count of how many times obj occurs in list.
Following is the syntax for count() method −
list.count(obj)

obj − This is the object to be counted in the list.
obj − This is the object to be counted in the list.
This method returns count of how many times obj occurs in list.
The following example shows the usage of count() method.
#!/usr/bin/python

aList = [123, 'xyz', 'zara', 'abc', 123];
print "Count for 123 : ", aList.count(123)
print "Count for zara : ", aList.count('zara')
When we run above program, it produces following result −
Count for 123 :  2
Count for zara :  1


    187 Lectures 
     17.5 hours 

 Malhar Lathkar

    55 Lectures 
     8 hours 

 Arnab Chakraborty

    136 Lectures 
     11 hours 

 In28Minutes Official

    75 Lectures 
     13 hours 

 Eduonix Learning Solutions

    70 Lectures 
     8.5 hours 

 Lets Kode It

    63 Lectures 
     6 hours 

 Abhilash Nelson
 Print
 Add Notes
 Bookmark this page
Resolve MySQL ERROR 1064 (42000): You have an error in your syntax?

This error occurs if let’s say you used var_char instead of varchar type. To remove this type of error, use, for example, varchar(100) instead of var_char(100).
Let us now see how this error occurs −
mysql> create table removeErrorDemo
   -> (
   -> StudentId int,
   -> StudentName var_char(50)
   -> );
The following is the output displaying the error −
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'var_char(50)
)' at line 4
Now let us remove the error. Here is the query to remove error 1064 (42000) −
mysql> create table removeErrorDemo
   -> (
   -> StudentId int,
   -> StudentName varchar(100)
   -> );
Query OK, 0 rows affected (1.72 sec)
Above, we have set varchar correctly, therefore no error will occur.
SQL Server Identity

21 Mar, 2018
Identity column of a table is a column whose value increases automatically. The value in an identity column is created by the server. A user generally cannot insert a value into an identity column. Identity column can be used to uniquely identify the rows in the table.
Syntax:
IDENTITY [( seed, increment)]


Seed: Starting value of a column. 
      Default value is 1.

Increment: Incremental value that is 
added to the identity value of the previous 
row that was loaded. The default value 1.

The ‘ID’ column of the table starts from 1 as the seed value provided is 1 and is incremented by 1 at each row.
The ‘ID’ column of the table starts from 1 but is incremented by 2 as the increment value is passed as 2 while creating the ‘IDENTITY’ Column.
SQL-Server
SQL
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Turing Machine as Comparator

23 Aug, 2021
Prerequisite – Turing Machine
Problem : Draw a turing machine which compare two numbers. Using unary format to represent the number. For example, 4 is represented by  
4 = 1 1 1 1  or 0 0 0 0 
Lets use one’s for representation. 
Example: 
 
Approach:  
Comparing two numbers by comparing number of ‘1’s.Comparing ‘1’s by marking them ‘X’.If ‘1’s are remaining in left of ‘0’, then first number is greater.If ‘1’s are remaining in right of ‘0’, then second number is greater.If both ‘1’ are finished then both numbers are equal.
Comparing two numbers by comparing number of ‘1’s.
Comparing ‘1’s by marking them ‘X’.
If ‘1’s are remaining in left of ‘0’, then first number is greater.
If ‘1’s are remaining in right of ‘0’, then second number is greater.
If both ‘1’ are finished then both numbers are equal.
Steps:  
Step-1: Convert 1 into X and move right and goto step 2. If symbol is 0 ignore it and move right and goto step-6.  
Step-2: Keep ignoring 1 and move towards right. Ignore 0 move right and goto step-3.
Step-3: Keep ignoring X and move towards right. Ignore 1 move left and goto step-4. If B is found ignore it and move left and goto step-9.
Step-4: Keep ignoring X and move towards left. Ignore 0 move left and goto step-5.
Step-5: Keep ignoring 1 and move towards left. Ignore X move right and goto step-1.
Step-6: Keep ignoring X and move towards right. If B is found ignore it and move left and goto step-8. If 1 is found ignore it and move right and goto step-7.
Step-7: Stop the Machine (A < B)
Step-8: Stop the Machine (A > B)
Step-9: Stop the Machine (A = B)
State transition diagram :  
Comparator for A < B
Comparator for A = B
Comparator for A > B
Universal Comparator for A < B, A = B, A > B  
Here, Q0 shows the initial state and Q2, Q3, Q4, Q5 shows the transition state and (A < B), (A = B)and (A > B) shows the final state. 0, 1 are the variables used and R, L shows right and left. 
Explanation:  
Using Q0, when 1 is found make it X and go to leftand to state Q1. and if 0 found move to right to Q5 state.
On the state Q1, ignore all 1 and goto right.If 0 found ignore it and goto right into next state Q2.
In Q2, ignore all X and move right.If B found stop the execution and you will goto the state showing A > B, If 1 found make it X move left and to Q3.
In Q3 state, ignore all X and move left.If 0 found ignore it move left to Q4.
In Q4, ignore all 1 and move left.If X found ignore it move right.
In Q5 state, ignore all X and move right.If 1 found ignore it move right and stop the machine it will give the result that A < B.And if, B found move left to stop the machine it will give the result that A = B
 
anikaseth98
GATE CS
Theory of Computation & Automata
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Scala List concatenation with example

29 Jul, 2019
In order to concatenate two lists we need to utilize concat() method in Scala.Syntax:
List.concat(l1, l2)
In above syntax, l1 is list1 and l2 is list2.Below is the example to concat two lists in scala.Example #1:
// Scala program of concat()// method  // Creating objectobject GfG{       // Main method    def main(args:Array[String])    {              // Creating two lists        val m1 = List(1, 2, 3)        val m2 = List(4, 5, 6)                  // Applying concat method        val res = List.concat(m1, m2)                  // Displays output        println(res)          }}
List(1, 2, 3, 4, 5, 6)

Example #2:
// Scala program of concat()// method  // Creating objectobject GfG{       // Main method    def main(args:Array[String])    {              // Creating two lists        val m1 = List(1, 2, 3)        val m2 = List(3, 4, 5)                  // Applying concat method        val res = List.concat(m1, m2)                  // Displays output        println(res)          }}
List(1, 2, 3, 3, 4, 5)

Here, the identical elements are not removed.
Scala
Scala-list
Scala-Method
Scala
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
HTML | Window alert( ) Method

26 Jul, 2019
The Window alert() method is used to display an alert box. It displays a specified message along with an OK button and is generally used to make sure that the information comes through the user.It returns a string which represents the text to display in the alert box.
Syntax:
alert(message)
Below program illustrates the Window alert() Method :
Displaying an alert box.
<!DOCTYPE html><html>  <head>    <title>      Window alert() Method in HTML    </title>    <style>        h1 {            color: green;        }                  h2 {            font-family: Impact;        }                  body {            text-align: center;        }    </style></head>  <body>      <h1>GeeksforGeeks</h1>    <h2>Window alert() Method</h2>      <p>      For displaying the alert message, double      click the "Show Alert Message" button:     </p>      <button ondblclick="myalert()">      Show Alert Message    </button>      <script>        function myalert() {            alert("Welcome to GeeksforGeeks.\n " +                "It is the best portal for computer" +                          "science enthusiasts!");        }    </script>  </body>  </html>
Output:
After clicking the button
Supported Browsers: The browser supported by Window alert( ) Method are listed below:
Google Chrome
Internet Explorer
Firefox
Opera
Safari
HTML-Methods
HTML
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Counter to find the size of largest subset of anagram words

27 Dec, 2017
Given an array of n string containing lowercase letters. Find the size of largest subset of string which are anagram of each others. An anagram of a string is another string that contains same characters, only the order of characters can be different. For example, “abcd” and “dabc” are anagram of each other.
Examples:
Input: 
ant magenta magnate tan gnamate
Output: 3
Explanation
Anagram strings(1) - ant, tan
Anagram strings(2) - magenta, magnate,
                     gnamate
Thus, only second subset have largest
size i.e., 3

Input: 
cars bikes arcs steer 
Output: 2

We have existing solution for this problem please refer Find the size of largest subset of anagram words link. We can solve this problem quickly in python using Counter() method. Approach is very simple,
Split input string separated by space into words.As we know two strings are anagram to each other if they contain same character set. So to get all those strings together first we will sort each string in given list of strings.Now create a dictionary using Counter method having strings as keys and their frequencies as value.Check for maximum value of frequencies, that will be the largest sub-set of anagram strings.
Split input string separated by space into words.
As we know two strings are anagram to each other if they contain same character set. So to get all those strings together first we will sort each string in given list of strings.
Now create a dictionary using Counter method having strings as keys and their frequencies as value.
Check for maximum value of frequencies, that will be the largest sub-set of anagram strings.
# Function to find the size of largest subset # of anagram wordsfrom collections import Counter  def maxAnagramSize(input):      # split input string separated by space    input = input.split(" ")      # sort each string in given list of strings    for i in range(0,len(input)):         input[i]=''.join(sorted(input[i]))      # now create dictionary using counter method    # which will have strings as key and their     # frequencies as value    freqDict = Counter(input)      # get maximum value of frequency    print (max(freqDict.values()))  # Driver programif __name__ == "__main__":    input = 'ant magenta magnate tan gnamate'    maxAnagramSize(input)
Output:
3

anagram
Python
anagram
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Materialize CSS Icons

16 May, 2022
Materialize CSS provides a rich set of material icons of google which can be downloaded from Material Design specs. Icon libraries that are supported by materialize css are Google Material Icons, Font Awesome Icons and Bootstrap Icons. Different icons can be selected from Material Icons.
Library and Usage: To use these icon, the following line is added in the <head> part of the HTML code.
<link href=”https://fonts.googleapis.com/icon?family=Material+Icons” rel=”stylesheet”>
Then to use the icons, name of the icon is provided in the <i> part of HTML element.
<i class="material-icons">add</i>
Material icon sizes:  Materialize CSS provides icons in four sizes: tiny, small, medium, large. The sizes for tiny, small, medium and large are 1 rem, 2 rem, 4 rem and 6 rem respectively.
<i class = "material-icons tiny">add</i>  
<i class = "material-icons small">add</i>  
<i class = "material-icons">add</i>  
<i class = "material-icons medium">add</i>  
<i class = "material-icons large">add</i>
Example: 
HTML
<!DOCTYPE html><html>  <head>    <!--Import Google Icon Font-->    <link href="https://fonts.googleapis.com/icon?family=Material+Icons"        rel="stylesheet">      <!-- Compiled and minified CSS -->    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.5/css/materialize.min.css">      <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js">    </script>      <!--Let browser know website is         optimized for mobile-->    <meta name="viewport" content=    "width=device-width, initial-scale=1.0" /></head>  <body>      <div class="card-panel">        <h3 class="green-text">Icons</h3>        <div class="container">            <div class="row">                <div class="col">                    <i class="material-icons                         tiny">account_circle</i>                </div>                <div class="col">                    <i class="material-icons">                        account_circle</i>                </div>                <div class="col">                    <i class="material-icons                         small">account_circle</i>                </div>                <div class="col">                    <i class="material-icons                         medium">account_circle</i>                </div>                <div class="col">                    <i class="material-icons                         large">account_circle</i>                </div>            </div>        </div>    </div>      <!-- Compiled and minified JavaScript -->    <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.5/js/materialize.min.js">    </script></body>  </html>
Output:
Materialize-CSS
CSS
HTML
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
equals() on String and StringBuffer objects in Java

08 Jul, 2021
Consider the following codes in java:  
Java
// This program prints falseclass GFG {   public static void main(String[] args) {    StringBuffer sb1 = new StringBuffer("GFG");    StringBuffer sb2 = new StringBuffer("GFG");    System.out.println(sb1.equals(sb2));  }}
false
 
Java
// This program prints trueclass GFG {   public static void main(String[] args) {    String s1 = "GFG";    String s2 = "GFG";    System.out.println(s1.equals(s2));  }}
true
 
The output is false for the first example and true for the second example. In second example, parameter to equals() belongs String class, while in first example it to StringBuffer class. When an object of String is passed, the strings are compared. But when object of StringBuffer is passed references are compared because StringBuffer does not override equals method of Object class.For example, following first program prints false and second prints true. 
Java
// This program prints falseclass GFG {   public static void main(String[] args) {    String s1 = "GFG";    StringBuffer sb1 = new StringBuffer("GFG");    System.out.println(s1.equals(sb1));  }}
false
 
Java
// This program prints trueclass GFG {   public static void main(String[] args) {    String s1 = "GFG";    StringBuffer sb1 = new StringBuffer("GFG");    String s2 = sb1.toString();    System.out.println(s1.equals(s2));  }}
true
 
pp944850
Java-String-Programs
java-StringBuffer
Java-Strings
Java
Java-Strings
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.