code-rag-bench/online-tutorials huggingface dataset:
Iterate over words of a String in Python

23 Jan, 2020
Given a String comprising of many words separated by space, write a Python program to iterate over these words of the string.
Examples:
Input: str = “GeeksforGeeks is a computer science portal for Geeks”Output:GeeksforGeeksisacomputerscienceportalforGeeks
Input: str = “Geeks for Geeks”Output:GeeksforGeeks
Method 1: Using split()
Using split() function, we can split the string into a list of words and is the most generic and recommended method if one wished to accomplish this particular task. But the drawback is that it fails in the cases in string contains punctuation marks.
# Python3 code to demonstrate  # to extract words from string  # using split()     # initializing string   test_string = "GeeksforGeeks is a computer science portal for Geeks"    # printing original string print ("The original string is : " +  test_string)     # using split() # to extract words from string res = test_string.split()     # printing result print ("\nThe words of string are")for i in res:    print(i)
Output:
The original string is : GeeksforGeeks is a computer science portal for Geeks

The words of string are
GeeksforGeeks
is
a
computer
science
portal
for
Geeks

Method 2: Using re.findall()
In the cases which contain all the special characters and punctuation marks, as discussed above, the conventional method of finding words in a string using split can fail and hence requires regular expressions to perform this task. findall() function returns the list after filtering the string and extracting words ignoring punctuation marks.
# Python3 code to demonstrate  # to extract words from string  # using regex( findall() ) import re     # initializing string   test_string = "GeeksforGeeks is a computer science portal for Geeks !!!"    # printing original string print ("The original string is : " +  test_string)     # using regex( findall() ) # to extract words from string res = re.findall(r'\w+', test_string)     # printing result print ("\nThe words of string are")for i in res:    print(i)
Output:
The original string is : GeeksforGeeks is a computer science portal for Geeks!!!

The words of string are
GeeksforGeeks
is
a
computer
science
portal
for
Geeks

Python string-programs
python-string
Python
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Python Classes and Objects
Python OOPs Concepts
Introduction To PYTHON
How to drop one or multiple columns in Pandas Dataframe
Defaultdict in Python
Python | Get dictionary keys as a list
Python | Convert a list to dictionary
Python Program for Fibonacci numbers
Python | Convert string dictionary to dictionary
How to change browser theme-color using HTML ?

16 Dec, 2021
In this article, we will know how to change the browser theme-color in HTML. Suppose that if we want our website to appear in green color along with changing the browser theme color which will be the same as our website, then we can use a meta tag with name and content attribute.
Meta Tag: The <meta> tag is used in the <head> element of HTML Document. It defines meta-data about the HTML document.
theme-color: The theme-color is the value used in the name attribute of the meta tag. The theme-color provides color to the browser to display as a theme, that color is provided by color code or color name in the content attribute of the meta tag.
 
Syntax:
<meta name="theme-color" content="#1bb566">
Approach: We will declare the name attribute that has value as theme-color and, the content attribute will have any color Hex-code or a color name that we want.
Example 1: Using Color hex-code:
HTML
<!DOCTYPE html><html>  <head>    <title>Change Browser theme-color</title>    <meta name="theme-color" content="#1bb566"> </head>  <body>    <h1>Welcome To GFG</h1></body>  </html>
Output:
CHROME ANDROID
Example 2: Using Color Name:
HTML
<!DOCTYPE html><html>  <head>    <title>Change Browser theme-color</title>    <meta name="theme-color" content="blue" /></head>  <body>    <h1>Welcome To GFG</h1></body>  </html>
Output:
CHROME ANDROID
Note: The theme-color value will not work in Android Chrome with dark mode. In order to see the result, disable the dark mode of the browser.
HTML-Questions
HTML-Tags
HTML5
HTML
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
SQL Query to Find All Employees Who Are Also Managers

13 Apr, 2021
Structured Query Language or SQL is a standard Database language that is used to create, maintain and retrieve the data from relational databases like MySQL, Oracle, etc. 
Here, we are going to see how to find the details of all the employees who are also managers in SQL. We will first create a database named “geeks” then we will create a table “employees” in that database. After that, we will execute our query on that table.
Use the below SQL statement to create a database called geeks:
CREATE DATABASE geeks;
USE geeks;
We have the following Employee table in our geeks database :
CREATE TABLE employees(
    EMPLOYEE_ID int,
    NAME Varchar(20),
    PHONE_NUMBER int,
    HIRE_DATE date,
    MANAGER_ID int);
You can use the below statement to query the description of the created table:
EXEC SP_COLUMNS employees;
Use the below statement to add data to the Employee table:
INSERT INTO EMPLOYEES VALUES (100, "ANURAG", 9889269997, "1987-06-17", 100);
INSERT INTO EMPLOYEES VALUES (101, "harsh", 8789269986, "1987-06-20", 100);
INSERT INTO EMPLOYEES VALUES (102, "SUMIT", 7689269975, "1987-07-07", 103);
INSERT INTO EMPLOYEES VALUES (103, "RUHI", 9589269964, "1987-07-12", 102);
INSERT INTO EMPLOYEES VALUES (104, "KAE", 8489269953, "1987-07-23", 103);
To verify the contents of the table use the below statement:
SELECT * FROM EMPLOYEES;
Now to get the details of all the employees who are also managers, we make use of the EMPLOYEE_ID  field and the MANAGER_ID, and we will find out the details of employees who are also managers. The query would have the following syntax:
Syntax:
SELECT *
FROM table_name  
WHERE (column_name IN (SELECT column_name FROM table_name));
Now run the same query with on the table we created as shown below:
SELECT * FROM EMPLOYEES WHERE (EMPLOYEE_ID IN (SELECT MANAGER_ID FROM EMPLOYEES));
Output:
Picked
SQL-Query
SQL
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Ruby | Array transpose() function

06 Dec, 2019
Array#transpose() : transpose() is a Array class method which returns the length of elements in the array transposes the rows and columns.
Syntax: Array.transpose()
Parameter: Array
Return: transposes the rows and columns.
Example #1 :
# Ruby code for transpose() method  # declaring arraya = [[18, 22], [33, 3, ], [5, 6]]  # declaring arrayb = [[1, 4, 1, 1, 88, 9]]  # transpose method exampleputs "transpose() method form : #{a.transpose()}\n\n"  puts "transpose() method form : #{b.transpose()}\n\n"
Output :
transpose() method form : [[18, 33, 5], [22, 3, 6]]

transpose() method form : [[1], [4], [1], [1], [88], [9]]


Example #2 :
# Ruby code for transpose() method  # declaring arraya = [["abc", "nil", "dog"]]  # declaring arrayb = [["cow", "go", "dog"]]    # transpose method exampleputs "transpose() method form : #{a.transpose()}\n\n"  puts "transpose() method form : #{b.transpose()}\n\n"
Output :
transpose() method form : [["abc"], ["nil"], ["dog"]]

transpose() method form : [["cow"], ["go"], ["dog"]]


Ruby Array-class
Ruby-Methods
Ruby
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Make a Custom Array of Hashes in Ruby?
Ruby | Array count() operation
Ruby | push() function
Ruby | Array slice() function
Include v/s Extend in Ruby
Global Variable in Ruby
Ruby | Array select() function
Ruby | Data Types
Ruby | Case Statement
Ruby | Enumerator each_with_index function
JavaScript string.normalize() Method

06 Oct, 2021
Below is the example of the string.normalize() method.  
Example:  
javascript
<script>var a = "Geeks For Geeks"; b = a.normalize('NFC')c = a.normalize('NFD')d = a.normalize('NFKC')e = a.normalize('NFKD')     document.write(b,c,d,e);</script>
Output:  
Geeks For GeeksGeeks For GeeksGeeks For GeeksGeeks For Geeks
The string.normalize() is an inbuilt method in javascript which is used to return a Unicode normalisation form of a given input string. If the given input is not a string, then at first it will be converted into a string then this method will work.Syntax:  
string.normalize([form])
Parameters: Here the parameter is form which is of many types-  
NFC: Normalization Form Canonical Composition.
NFD: Normalization Form Canonical Decomposition.
NFKC: Normalization Form Compatibility Composition.
NFKD: Normalization Form Compatibility Decomposition.
These all say the Unicode Normalization Form. Return value: It returns a new string containing the Unicode Normalization Form of the given input string.JavaScript code to show the working of string.normalize() method:  
javascript
<script>   // Taking a string as input.  var a = "GeeksForGeeks";     // calling normalize method.  b = a.normalize('NFC')  c = a.normalize('NFD')  d = a.normalize('NFKC')  e = a.normalize('NFKD')     // Printing normalised form.  document.write(b +"<br>");  document.write(c +"<br>");  document.write(d +"<br>");  document.write(e);   </script>
Output:  
GeeksForGeeks
GeeksForGeeks
GeeksForGeeks
GeeksForGeeks
Supported Browsers:  
Google Chrome 34 and above
Edge 12 and above
Firefox 31 and above
Opera 21 and above
Safari 10 and above
 
ysachin2314
JavaScript-Methods
javascript-string
JavaScript
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Difference between var, let and const keywords in JavaScript
Differences between Functional Components and Class Components in React
Remove elements from a JavaScript Array
Difference Between PUT and PATCH Request
How to append HTML code to a div using JavaScript ?
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 ?
Lodash _.property() Method

09 Sep, 2020
The Lodash _.property() method is used to return a function that will return the specified property of any passed-in object.
Syntax: 
_.property(path)

Parameters: This method accepts one parameter as mentioned above and described below:
path: This parameter holds the path of the property to get.
Return Value: This method returns a new accessor function.
Example 1 :
Javascript
// Requiring the lodash library  const _ = require("lodash");                var info = {             Company: 'GeeksforGeeks',             Address: 'Noida'        };           // Use of _.property() method         let gfg = _.property('Company')        (info) === 'GeeksforGeeks'   // Printing the output  console.log(gfg);
Output:
true

Example 2 :
Javascript
// Requiring the lodash library  const _ = require("lodash");                  var info = {             Company: { name: 'GeeksforGeeks' },             Contact: { Address:                  {                      AddressInfo: 'Noida'                  }              }         };     // Use of _.property() method   var propInfo = _.property(['Contact',          'Address', 'AddressInfo', ]);     // Printing the output  console.log(propInfo(info));
Output:
Noida

JavaScript-Lodash
JavaScript
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Difference between var, let and const keywords in JavaScript
Remove elements from a JavaScript Array
Difference Between PUT and PATCH Request
Roadmap to Learn JavaScript For Beginners
JavaScript | Promises
Installation of Node.js on Linux
Top 10 Projects For Beginners To Practice HTML and CSS Skills
Difference between var, let and const keywords in JavaScript
How to insert spaces/tabs in text using HTML/CSS?
How to fetch data from an API in ReactJS ?
Python DateTime astimezone() Method

02 Sep, 2021
The astimezone() function is used to return a DateTime instance according to the specified time zone parameter tz. 
Note: The returned DateTime instance is having the new UTC offset value as per the tz parameter. And If this function does not take parameter tz, then the returned DateTime object will have the local date, time, and time zone.
Syntax: astimezone(tz=None)
Parameters: This function accepts an optional parameter that is illustrated below:
tz: This is the specified timezone.
Return values: This function returns a datetime instance according to the specified time zone parameter tz. If the parameter tz is not specified then this function returns the local date, time and the time zone.
Example 1: In the below example, astimezone() function is taking the Singapore time zone object as its parameter. The Singapore timedelta() function is taking 5 hours as its parameter and its returned value is taken as the parameter of timezone() function. In this way, a DateTime along with Singapore timezone object is initialized for the function astimezone() to return its corresponding datetime instance.
Python3
# Python3 code for getting# a datetime instance according# to the specified time zone parameter tz # Importing datetime moduleimport datetime # Specifying Singapore timedelta and timezone# objectsgtTimeDelta = datetime.timedelta(hours=5)sgtTZObject = datetime.timezone(sgtTimeDelta,                                name="SGT") # Specifying a datetime along with Singapore# timezone objectd1 = datetime.datetime(2021, 8, 4, 10,                       00, 00, 00, sgtTZObject) # Calling the astimezone() function over the above# specified Singapore timezoned2 = d1.astimezone(sgtTZObject) # Printing a datetime instance as per the above# specified Singapore timezoneprint("Singapore time from a datetime instance:{}".format(d2))
Output:
Singapore time from a datetime instance:2021-08-04 10:00:00+05:00
Example 2: In the below example, the astimezone() function does not accept any parameter, so this function returns the DateTime object having the local current date, time and the time zone. Here current date, time, and time zone are returned because of the datetime.now() function.
Python3
# Python3 code for getting# a datetime instance according# to the specified time zone parameter tz # Importing datetime moduleimport datetime # Calling now() function to return# current datetimed1 = datetime.datetime.now() # Calling the astimezone() function without# any timezone parameterd2 = d1.astimezone() # Printing the local current date, time and# timezoneprint(format(d2))
Output:
2021-08-04 06:41:15.128046+00:00
simmytarika5
Picked
Python-datetime
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Bootstrap shown.bs.tab event

The shown.bs.event fires when the tab is completely displayed. After that the alert generates as shown below −
$('.nav-tabs a').on('shown.bs.tab', function(){
  alert('New tab is now visible!');
});
The tabs are displayed using the show() method −
$(".nav-tabs a").click(function(){
  $(this).tab('show');
});
You can try to run the following code to implement the shown.bs.tab event −
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>Topic</h2>
      <ul class="nav nav-tabs">
        <li class="active"><a href="#home">Home</a></li>
        <li><a href="#two">Ruby</a></li>
        <li><a href="#three">JSP</a></li>
        <li><a href="#four">Servlet</a></li>
        <li><a href="#five">CSS</a></li>
      </ul>

      <div class="tab-content">
        <div id="home" class="tab-pane fade in active">
          <h3>Home</h3>
          <p>This is demo text!</p>
        </div>
     
      <div id="two" class="tab-pane fade">
        <h3>Ruby</h3>
        <p>This is demo text!</p>
      </div>
      <div id="three" class="tab-pane fade">
        <h3>JSP</h3>
        <p>This is demo text!</p>
      </div>
      <div id="four" class="tab-pane fade">
        <h3>Servlet</h3>
        <p>This is demo text!</p>
      </div>
      <div id="five" class="tab-pane fade">
        <h3>CSS</h3>
        <p>This is demo text!</p>
      </div>
    </div>
  </div>

  <script>
  $(document).ready(function(){
    $(".nav-tabs a").click(function(){
      $(this).tab('show');
    });
    $('.nav-tabs a').on('show.bs.tab', function(){
      alert('New tab will be visible now!');
    });
    $('.nav-tabs a').on('shown.bs.tab', function(){
      alert('New tab is now visible!');
    });
    $('.nav-tabs a').on('hide.bs.tab', function(e){
      alert('Previous tab will hide now!');
    });
    $('.nav-tabs a').on('hidden.bs.tab', function(){
      alert('Previous Tab is hidden now!');
    });
  });

  </script>

  </body>
</html>
Assertion in Selenium WebDriver using TestNg - GeeksforGeeks

06 Oct, 2021
Prerequisite – Selenium Actual result is compared with expected result with the help of Assertion. It means verification is done to check if the state of the application is the same to what we are expecting or not. For creating assertion we are going to use the Assert class provided by TestNG. 
There are two types of Assertion:- 
Hard Assertions. Soft assertions. 
Hard Assertions. 
Soft assertions. 
These are explained as following below. 
1. Hard Assertions : When any assert statement fails this type of assertion throws an exception immediately and continues with the next test in the test suite. 
Hard Assertion can be of following types:- 
1. assertEquals – This is used to compare expected and actual values in the selenium webdriver. The assertion passes with no exception whenever the expected and actual values are same. But, if the actual and expected values are not same then assert fails with an exception and the test is marked as failed. 
Syntax : 
Assert.assertEquals(actual, expected); 
2. assertNotEquals – This is just the opposite of assertEquals. The assertion passes with no exception whenever the expected and actual values are not same. But, if the actual and expected values are same then assert fails with an exception and the test is marked as failed. 
Syntax : 
Assert.assertNotEquals(actual, expected, message); 
3. assertTrue – This type of assertion is used when you are checking if condition is true. That is when we are dealing with boolean values this assertion is used. Whenever test case passes it returns true and if condition is false then it skips the current method and jumps to next. 
Syntax : 
Assert.assertTrue(condition); 
4. assertFalse – It checks if value returned is false or not. Whenever test case passes it aborts the method and gives an exception. 
Syntax : 
Assert.assertFalse(condition); 
5. assertNull – This assertion checks if the object is null or not. It aborts the test if object is null and gives an exception. 
Syntax : 
Assert.assertNull(object);
6. assertNotNull – This assertion checks if object is null or not. It aborts the test if object is not null that is if object is having any value and gives an exception. 
Syntax : 
Assert.assertNotNull(object); 
2. Soft Assertion : These types of Assertions are the type of assertions do not throw an exception when an assertion fails and continues with the next step after the assert statement. 
surinderdawra388
selenium
Software Engineering
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Software Engineering | Requirements Engineering Process
Software Requirement Specification (SRS) Format
DFD for Library Management System
Levels in Data Flow Diagrams (DFD)
Software Testing | Basics
Software Engineering | White box Testing
Software Engineering | SDLC V-Model
What is DFD(Data Flow Diagram)?
Software Engineering | Iterative Waterfall Model
Difference between IAAS, PAAS and SAAS
What is the relation between 'null' and '0' in JavaScript?

There is a lot of curiosity arises when we are dealing with false values and it is even more especially when dealing with "null" and "0" because of their properties. When we try to compare "null" and "0", we will come across typical scenarios. For greater than(>), less than(<) and equal to(=) we will get Boolean false as output. But when there is greater than or equal(>=)  Boolean true will be executed as output. 
Here the question that arises is how can a value is not greater than 0, not equal to 0, but greater than and equal to 0?
In the following example, three conditions such as greater than, less than and equal to were checked in between null and 0. In all three cases, the result obtained is false.
 Live Demo
<html>
<body>
   <script>
      if(null > 0){
         document.write("null is greater than 0");
      }
      else if(null < 0) {
         document.write("null is less than 0");
      }
      else if(null == 0){
         document.write("null is equal to 0");
      }
      else {
         document.write("It is a typical relationship");
      }
   </script>
</body>
</html>
It is a typical relationship
In the following example, null is not greater than 0 and not equal to 0, but greater than or equal to 0. It looks very odd to hear. Because in mathematics if we have two numbers i.e a, b and if a is not less than the b then the possible scenarios are either a is greater than b or a is equal to b.
Coming to 'null' and '0', the mathematical expectations won't hold. This is a typical case to deal with in javascript.
Live Demo
<html>
<body>
   <script>
      if(null > 0){
         document.write("null is greater than 0");
      }
      else if(null == 0){
         document.write("null is equal to 0");
      }
      else if(null>=0) {
         document.write("null is greater than or equal to 0 ");
      }
   </script>
</body>
</html>
null is greater than or equal to 0
GATE | GATE-CS-2014-(Set-1) | Question 65 - GeeksforGeeks

15 Oct, 2019
Given the following schema:
     employees(emp-id, first-name, last-name, hire-date, dept-id, salary)
     departments(dept-id, dept-name, manager-id, location-id) 
You want to display the last names and hire dates of all latest hires in their respective departments in the location ID 1700. You issue the following query:
SQL> SELECT last-name, hire-date
     FROM employees
     WHERE (dept-id, hire-date) IN ( SELECT dept-id, MAX(hire-date)
                                     FROM employees JOIN departments USING(dept-id)
                                     WHERE location-id = 1700
                                     GROUP BY dept-id); 
What is the outcome?(A) It executes but does not give the correct result.(B) It executes and gives the correct result.(C) It generates an error because of pairwise comparison.(D) It generates an error because the GROUP BY clause cannot be used with table joins in a subqueryAnswer: (B)Explanation: The given query uses below inner query.
SELECT dept-id, MAX(hire-date)
     FROM employees JOIN departments USING(dept-id)
     WHERE location-id = 1700
     GROUP BY dept-id

The inner query produces last max hire-date in every department located at location id 1700.
The outer query simply picks all pairs of inner query. Therefore, the query produces correct result.
SELECT last-name, hire-date
     FROM employees
     WHERE (dept-id, hire-date) IN
     (Inner-Query); 

Quiz of this Question
GATE-CS-2014-(Set-1)
GATE-GATE-CS-2014-(Set-1)
GATE
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
GATE | GATE CS 2019 | Question 27
GATE | GATE-IT-2004 | Question 66
GATE | GATE-CS-2014-(Set-3) | Question 65
GATE | GATE-CS-2006 | Question 49
GATE | GATE-CS-2004 | Question 3
GATE | GATE-CS-2000 | Question 43
GATE | GATE-CS-2017 (Set 2) | Question 42
GATE | GATE CS 2021 | Set 1 | Question 47
GATE | GATE CS 2011 | Question 65
GATE | Gate IT 2007 | Question 30
C library function - raise()

The C library function int raise(int sig) causes signal sig to be generated. The sig argument is compatible with the SIG macros.
Following is the declaration for signal() function.
int raise(int sig)
sig − This is the signal number to send. Following are few important standard signal constants −
sig − This is the signal number to send. Following are few important standard signal constants −
SIGABRT
(Signal Abort) Abnormal termination, such as is initiated by the abort function.
SIGFPE
(Signal Floating-Point Exception) Erroneous arithmetic operation, such as zero divide or an operation resulting in overflow (not necessarily with a floating-point operation).
SIGILL
(Signal Illegal Instruction) Invalid function image, such as an illegal instruction. This is generally due to a corruption in the code or to an attempt to execute data.
SIGINT
(Signal Interrupt) Interactive attention signal. Generally generated by the application user.
SIGSEGV
(Signal Segmentation Violation) Invalid access to storage − When a program tries to read or write outside the memory it is allocated for it.
SIGTERM
(Signal Terminate) Termination request sent to program.
This function returns zero if successful, and non-zero otherwise.
The following example shows the usage of signal() function.
#include <signal.h>
#include <stdio.h>

void signal_catchfunc(int);

int main () {
   int ret;

   ret = signal(SIGINT, signal_catchfunc);

   if( ret == SIG_ERR) {
      printf("Error: unable to set signal handler.\n");
      exit(0);
   }
   printf("Going to raise a signal\n");
   ret = raise(SIGINT);
   
   if( ret !=0 ) {
      printf("Error: unable to raise SIGINT signal.\n");
      exit(0);
   }

   printf("Exiting...\n");
   return(0);
}

void signal_catchfunc(int signal) {
   printf("!! signal caught !!\n");
}
Let us compile and run the above program to will produce the following result −
Going to raise a signal
!! signal caught !!
Exiting...


    12 Lectures 
     2 hours 

 Nishant Malik

    12 Lectures 
     2.5 hours 

 Nishant Malik

    48 Lectures 
     6.5 hours 

 Asif Hussain

    12 Lectures 
     2 hours 

 Richa Maheshwari

    20 Lectures 
     3.5 hours 

 Vandana Annavaram

    44 Lectures 
     1 hours 

 Amit Diwan
 Print
 Add Notes
 Bookmark this page
How do I exclude a specific record in MySQL?

You can exclude a specific record in SQL using not equal to operator(!=). Let us first create a table−
mysql> create table DemoTable
   (
   Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,
   ClientName varchar(20),
   ClientCountryName varchar(10)
   );
Query OK, 0 rows affected (0.64 sec)
Insert records in the table using insert command −
mysql> insert into DemoTable(ClientName,ClientCountryName) values('John','US');
Query OK, 1 row affected (0.20 sec)
mysql> insert into DemoTable(ClientName,ClientCountryName) values('David','AUS');
Query OK, 1 row affected (0.23 sec)
mysql> insert into DemoTable(ClientName,ClientCountryName) values('Mike','UK');
Query OK, 1 row affected (0.14 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable;
This will produce the following output −
+----+------------+-------------------+
| Id | ClientName | ClientCountryName |
+----+------------+-------------------+
| 1  | John       | US                |
| 2  | David      | AUS               |
| 3  | Mike       | UK                |
+----+------------+-------------------+
3 rows in set (0.00 sec)
Following is the query to exclude a specific record in MySQL i.e. we are excluding records with ClientName David' or ClientCountryName ='AUS'−
mysql> select *from DemoTable where ClientName!='David' or ClientCountryName!='AUS';
This will produce the following output−
+----+------------+-------------------+
| Id | ClientName | ClientCountryName |
+----+------------+-------------------+
| 1  | John       | US                |
| 3  | Mike       | UK                |
+----+------------+-------------------+
2 rows in set (0.00 sec)
Objective-C Data Types

In the Objective-C programming language, data types refer to an extensive system used for declaring variables or functions of different types. The type of a variable determines how much space it occupies in storage and how the bit pattern stored is interpreted.
The types in Objective-C can be classified as follows −
Basic Types −
They are arithmetic types and consist of the two types: (a) integer types and (b) floating-point types.
Enumerated types −
They are again arithmetic types and they are used to define variables that can only be assigned certain discrete integer values throughout the program.
The type void −
The type specifier void indicates that no value is available.
Derived types −
They include (a) Pointer types, (b) Array types, (c) Structure types, (d) Union types and (e) Function types.
The array types and structure types are referred to collectively as the aggregate types. The type of a function specifies the type of the function's return value. We will see basic types in the following section whereas other types will be covered in the upcoming chapters.
Following table gives you details about standard integer types with its storage sizes and value ranges −
To get the exact size of a type or a variable on a particular platform, you can use the sizeof operator. The expression sizeof(type) yields the storage size of the object or type in bytes. Following is an example to get the size of int type on any machine −
#import <Foundation/Foundation.h>

int main() {
   NSLog(@"Storage size for int : %d \n", sizeof(int));
   return 0;
}
When you compile and execute the above program, it produces the following result on Linux −
2013-09-07 22:21:39.155 demo[1340] Storage size for int : 4 

Following table gives you details about standard float-point types with storage sizes and value ranges and their precision −
The header file float.h defines macros that allow you to use these values and other details about the binary representation of real numbers in your programs. Following example will print storage space taken by a float type and its range values −
#import <Foundation/Foundation.h>

int main() {
   NSLog(@"Storage size for float : %d \n", sizeof(float));
   return 0;
}
When you compile and execute the above program, it produces the following result on Linux −
2013-09-07 22:22:21.729 demo[3927] Storage size for float : 4 

The void type specifies that no value is available. It is used in three kinds of situations −
There are various functions in Objective-C which do not return value  or you can say they return void. A function with no return value has the return type as void. For example, void exit (int status);
There are various functions in Objective-C which do not accept any parameter. A function with no parameter can accept as a void. For example, int rand(void);
The void type may not be understood to you at this point, so let us proceed and we will cover  these concepts in upcoming chapters.

    18 Lectures 
     1 hours 

 PARTHA MAJUMDAR

    6 Lectures 
     25 mins

 Ken Burke
 Print
 Add Notes
 Bookmark this page
GATE | GATE-CS-2001 | Question 50 - GeeksforGeeks

19 Nov, 2018
Consider the circuit given below with initial state Q0 =1, Q1 = Q2 = 0. The state of the circuit is given by the value 4Q2 + 2Q1 + Q0
Which one of the following is the correct state sequence of the circuit?(A) 1,3,4,6,7,5,2(B) 1,2,5,3,7,6,4(C) 1,2,7,3,5,6,4(D) 1,6,5,7,2,3,4Answer: (B)Explanation:
So ans is (B) part.Quiz of this Question
GATE-CS-2001
GATE-GATE-CS-2001
GATE
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
GATE | GATE-IT-2004 | Question 71
GATE | GATE CS 2011 | Question 7
GATE | GATE-CS-2015 (Set 3) | Question 65
GATE | GATE-CS-2016 (Set 2) | Question 48
GATE | GATE-CS-2014-(Set-3) | Question 38
GATE | GATE CS 2018 | Question 37
GATE | GATE-IT-2004 | Question 83
GATE | GATE-CS-2016 (Set 1) | Question 63
GATE | GATE-CS-2014-(Set-2) | Question 65
GATE | GATE-CS-2007 | Question 64
jQuery Effects - Animation

With jQuery, you can create custom animations.
The jQuery animate() method is used to create custom animations.
Syntax:
The required params parameter defines the CSS properties to be animated.
The optional speed parameter specifies the duration of the effect. It can take the following values: "slow", "fast", or 
milliseconds.
The optional callback parameter is a function to be executed after the 
animation completes.
The following example demonstrates a simple use of the animate() method; it moves 
a <div> element to the right, until it has reached a left property of 250px:
By default, all HTML elements have a static position, and cannot be moved.
To manipulate the position, remember to first set the CSS position property of the element to relative, fixed, or absolute!
Notice that multiple properties can be animated at the same time:
Is it possible to manipulate ALL CSS properties with the animate() method?
Yes, almost! However, there is one important thing to remember: all property 
names must be camel-cased when used with the animate() method: You will need to 
write paddingLeft instead of padding-left, marginRight instead of margin-right, and so on. 
Also, color animation is not included in the core jQuery library.
If you want to animate color, you need to download the
Color 
Animations plugin from jQuery.com.
It is also possible to define relative values (the value is then relative to 
the element's current value). This is done by putting += or -= in front of the 
value:
You can even specify a property's animation value as "show", "hide", or "toggle":
By default, jQuery comes with queue functionality for animations.
This means that if you write multiple animate() calls after each other, 
jQuery creates an "internal" queue with these method calls. Then it runs the 
animate calls ONE by ONE.
So, if you want to perform different animations after each other, we take 
advantage of the queue functionality:
The example below first moves the <div> element to the right, and then increases the font size of the text:
Use the animate() method to move a <div> element 250 pixels to the right.
$("div").animate({: ''});

Start the Exercise
For a complete overview of all jQuery effects, please go to our jQuery Effect Reference.
We just launchedW3Schools videos
Get certifiedby completinga course today!
If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:
help@w3schools.com
Your message has been sent to W3Schools.
NULL pointer in C

A null pointer is a pointer which points nothing.
Some uses of the null pointer are:
a) To initialize a pointer variable when that pointer variable isn’t assigned any valid memory address yet.
b) To pass a null pointer to a function argument when we don’t want to pass any valid memory address.
c) To check for null pointer before accessing any pointer variable. So that, we can perform error handling in pointer related code e.g. dereference pointer variable only if it’s not NULL.
Begin.
   Declare a pointer p of the integer datatype.
      Initialize *p= NULL.
   Print “The value of pointer is”.
      Print the value of the pointer p.
End.
 Live Demo
#include <stdio.h>
int main() {
   int *p= NULL;//initialize the pointer as null.
   printf("The value of pointer is %u",p);
   return 0;
}
The value of pointer is 0.
Git GitHub Send Pull Request

We have made a lot of changes to our local Git.
Now we push them to our GitHub 
fork:
commit the changes:
git push origin
Enumerating objects: 8, done.
Counting objects: 100% (8/8), done.
Delta compression using up to 16 threads
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 393.96 KiB | 32.83 MiB/s, done.
Total 5 (delta 0), reused 0 (delta 0), pack-reused 0
To https://github.com/kaijim/w3schools-test.github.io.git
   facaeae..ebb1a5c  master -> master
Go to GitHub, and we see that the repository has a new commit. And we can send a Pull Request to the original repository:
Click that and create a pull request:
Remember to add an explanation for the administrators.
Pull Request is sent:
Now any member with access can see the Pull Request when they see the original repository:
And they can see the proposed changes:
Comment on the changes and merge:
Confirm:
And changes have been merged with 
master:
Now you try!
We just launchedW3Schools videos
Get certifiedby completinga course today!
If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:
help@w3schools.com
Your message has been sent to W3Schools.
How to create a list with roman number indexing in HTML ?

18 Aug, 2021
In this article, We are going to create a list with roman number indexing. In HTML, A list is a record of short pieces of information, such as people’s names, usually written or printed with a single thing on each line and ordered in a way that makes a particular thing easy to find. 
Approach: There are different types of lists in HTML. One of them is Ordered list or ol.  Ordered list uses <ol> tag.   To create an ordered list with roman number indexing we will use attribute type. The type attribute of the <ol> tag defines the numbering type of the list items. The default value of the type attribute in the ordered list is number. So for example, if we want the list with alphabets we simply give value “a” to type attribute. Similarly for creating a list with roman number indexing we have to provide the first roman number value to the type attribute. 
Syntax:
<ol type="I">
Below is the implementation of the above approach.
 
Example 1: In this example, we will create a list with uppercase roman number indexing. For that, we will provide attribute type value to “I”.
HTML
<!DOCTYPE html><html>  <head>    <style>        h2 {            color: green;        }    </style></head>  <body>    <h2>Ordered List with Roman Numbers</h2>    <ol type="I">        <li>HTML</li>        <li>CSS</li>        <li>JAVA</li>        <li>SASS</li>    </ol></body>  </html>
Output:
GFG
Example 2: Now we will create a list with lowercase roman number indexing. The entire code will be the same as before we will just change the type attribute value from “I” to “i” now.
HTML
<!DOCTYPE html><html>  <head>    <style>        h2 {            color: green;        }    </style></head>  <body>    <h2>        Ordered List with LowerCase         Roman Numbers    </h2>          <ol type="i">        <li>HTML</li>        <li>CSS</li>        <li>JAVA</li>        <li>SASS</li>    </ol></body>  </html>
Output:
GFG
HTML-Attributes
HTML-Questions
HTML-Tags
Picked
HTML
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Measures of Distance in Data Mining

03 Feb, 2020
Clustering consists of grouping certain objects that are similar to each other, it can be used to decide if two items are similar or dissimilar in their properties.
In a Data Mining sense, the similarity measure is a distance with dimensions describing object features. That means if the distance among two data points is small then there is a high degree of similarity among the objects and vice versa. The similarity is subjective and depends heavily on the context and application. For example, similarity among vegetables can be determined from their taste, size, colour etc.
Most clustering approaches use distance measures to assess the similarities or differences between a pair of objects, the most popular distance measures used are:
1. Euclidean Distance:Euclidean distance is considered the traditional metric for problems with geometry. It can be simply explained as the ordinary distance between two points. It is one of the most used algorithms in the cluster analysis. One of the algorithms that use this formula would be K-mean. Mathematically it computes the root of squared differences between the coordinates between two objects.
2. Manhattan Distance:This determines the absolute difference among the pair of the coordinates.
Suppose we have two points P and Q to determine the distance between these points we simply have to calculate the perpendicular distance of the points from X-Axis and Y-Axis.In a plane with P at coordinate (x1, y1) and Q at (x2, y2).
Manhattan distance between P and Q = |x1 – x2| + |y1 – y2|
Here the total distance of the Red line gives the Manhattan distance between both the points.
3. Jaccard Index:The Jaccard distance measures the similarity of the two data set items as the intersection of those items divided by the union of the data items.
4. Minkowski distance:It is the generalized form of the Euclidean and Manhattan Distance Measure. In an N-dimensional space, a point is represented as,
(x1, x2, ..., xN) 
Consider two points P1 and P2:
P1: (X1, X2, ..., XN)
P2: (Y1, Y2, ..., YN) 
Then, the Minkowski distance between P1 and P2 is given as:
When p = 2, Minkowski distance is same as the Euclidean distance.
When p = 1, Minkowski distance is same as the Manhattan distance.
5. Cosine Index:Cosine distance measure for clustering determines the cosine of the angle between two vectors given by the following formula.
Here (theta) gives the angle between two vectors and A, B are n-dimensional vectors.
data mining
DBMS
DBMS
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
CTE in SQL
Difference between Clustered and Non-clustered index
Introduction of B-Tree
SQL | Views
SQL Interview Questions
Difference between DDL and DML in DBMS
Difference between DELETE, DROP and TRUNCATE
Types of Functional dependencies in DBMS
Difference between Primary Key and Foreign Key
Difference between SQL and NoSQL
base64.urlsafe_b64encode(s) in Python

26 Mar, 2020
With the help of base64.urlsafe_b64encode(s) method, we can encode the string using url and file system safe alphabets into the binary form.
Syntax : base64.urlsafe_b64encode(s)
Return : Return the encoded string.
Example #1 :In this example we can see that by using base64.urlsafe_b64encode(s) method, we are able to get the encoded string which can be in binary form by using this method.
# import base64from base64 import urlsafe_b64encode  s = b'GeeksForGeeks'# Using base64.urlsafe_b64encode(s) methodgfg = urlsafe_b64encode(s)  print(gfg)
Output :
b’R2Vla3NGb3JHZWVrcw==’
Example #2 :
# import base64from base64 import urlsafe_b64encode  s = b'www.python.org / documentation'# Using base64.urlsafe_b64encode(s) methodgfg = urlsafe_b64encode(s)  print(gfg)
Output :
b’d3d3LnB5dGhvbi5vcmcvZG9jdW1lbnRhdGlvbg==’
Python base64-module
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to know if two arrays have the same values in JavaScript?

Let’s say the following are our arrays −
var firstArray=[100,200,400];
var secondArray=[400,100,200];
You can sort both the arrays using the sort() method and use for loop to compare each value as in the below code −
var firstArray=[100,200,400];
var secondArray=[400,100,200];
function areBothArraysEqual(firstArray, secondArray) {
   if (!Array.isArray(firstArray) || ! Array.isArray(secondArray) ||
   firstArray.length !== secondArray.length)
   return false;
   var tempFirstArray = firstArray.concat().sort();
   var tempSecondArray = secondArray.concat().sort();
   for (var i = 0; i < tempFirstArray.length; i++) {
      if (tempFirstArray[i] !== tempSecondArray[i])
         return false;
   }
   return true;
}
if(areBothArraysEqual(firstArray,secondArray))
console.log("Both are equals");
else
console.log("Both are not equals");
To run the above program, you need to use the following command −
node fileName.js.
Here, my file name is demo156.js.
PS C:\Users\Amit\JavaScript-code> node demo156.js
Both are equals
Tryit Editor v3.7

Tryit: Get current position
Python 3 - Tkinter place() Method

This geometry manager organizes widgets by placing them in a specific position in the parent widget.
widget.place( place_options )

Here is the list of possible options −
anchor − The exact spot of widget other options refer to: may be N, E, S, W, NE, NW, SE, or SW, compass directions indicating the corners and sides of widget; default is NW (the upper left corner of widget)
anchor − The exact spot of widget other options refer to: may be N, E, S, W, NE, NW, SE, or SW, compass directions indicating the corners and sides of widget; default is NW (the upper left corner of widget)
bordermode − INSIDE (the default) to indicate that other options refer to the parent's inside (ignoring the parent's border); OUTSIDE otherwise.
bordermode − INSIDE (the default) to indicate that other options refer to the parent's inside (ignoring the parent's border); OUTSIDE otherwise.
height, width − Height and width in pixels.
height, width − Height and width in pixels.
relheight, relwidth − Height and width as a float between 0.0 and 1.0, as a fraction of the height and width of the parent widget.
relheight, relwidth − Height and width as a float between 0.0 and 1.0, as a fraction of the height and width of the parent widget.
relx, rely − Horizontal and vertical offset as a float between 0.0 and 1.0, as a fraction of the height and width of the parent widget.
relx, rely − Horizontal and vertical offset as a float between 0.0 and 1.0, as a fraction of the height and width of the parent widget.
x, y − Horizontal and vertical offset in pixels.
x, y − Horizontal and vertical offset in pixels.
Try the following example by moving cursor on different buttons −
# !/usr/bin/python3
from tkinter import *

top = Tk()
L1 = Label(top, text = "Physics")
L1.place(x = 10,y = 10)
E1 = Entry(top, bd = 5)
E1.place(x = 60,y = 10)
L2 = Label(top,text = "Maths")
L2.place(x = 10,y = 50)
E2 = Entry(top,bd = 5)
E2.place(x = 60,y = 50)

L3 = Label(top,text = "Total")
L3.place(x = 10,y = 150)
E3 = Entry(top,bd = 5)
E3.place(x = 60,y = 150)

B = Button(top, text = "Add")
B.place(x = 100, y = 100)
top.geometry("250x250+10+10")
top.mainloop()
When the above code is executed, it produces the following result −

    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
ES6 -  Array Method join()

join() method joins all the elements of an array into a string.
array.join(separator);   

separator − Specifies a string to separate each element of the array. If omitted, the array elements are separated with a comma.
separator − Specifies a string to separate each element of the array. If omitted, the array elements are separated with a comma.
Returns a string after joining all the array elements.
var arr = new Array("First","Second","Third"); 
var str = arr.join();console.log("str : " + str );  
var str = arr.join(", "); 
console.log("str : " + str );  

var str = arr.join(" + "); 
console.log("str : " + str );  
str : First,Second,Third 
str : First, Second, Third 
str : First + Second + Third 


    32 Lectures 
     3.5 hours 

 Sharad Kumar

    40 Lectures 
     5 hours 

 Richa Maheshwari

    16 Lectures 
     1 hours 

 Anadi Sharma

    50 Lectures 
     6.5 hours 

 Gowthami Swarna

    14 Lectures 
     1 hours 

 Deepti Trivedi

    31 Lectures 
     1.5 hours 

 Shweta
 Print
 Add Notes
 Bookmark this page