code-rag-bench/online-tutorials huggingface dataset:
8086 program to Print a 16 bit Decimal number - GeeksforGeeks

17 Jun, 2021
Problem: Write a 8086 program to Print a 16 bit Decimal number.
Examples: 
Input: d1 = 655
Output: 655

Input: d1 = 234
Output:234 
Explanation: 
load the value stored into registerdivide the value by 10push the remainder into the stackincrease the countrepeat the steps until the value of the register is greater than 0until the count is greater than zeropop the stackadd 48 to the top element to convert it into ASCIIprint the character using interruptdecrements the count
load the value stored into register
divide the value by 10
push the remainder into the stack
increase the count
repeat the steps until the value of the register is greater than 0
until the count is greater than zero
pop the stack
add 48 to the top element to convert it into ASCII
print the character using interrupt
decrements the count
Program: 
ALP
;8086 program to print a 16 bit decimal number.MODEL SMALL.STACK 100H.DATAd1 dw 655.CODEMAIN PROC FAR    MOV AX,@DATA    MOV DS,AX            ;load the value stored    ; in variable d1    mov ax,d1               ;print the value    CALL PRINT                             ;interrupt to exit                  MOV AH,4CH    INT 21H MAIN ENDPPRINT PROC                   ;initialize count    mov cx,0    mov dx,0    label1:        ; if ax is zero        cmp ax,0        je print1                      ;initialize bx to 10        mov bx,10                        ; extract the last digit        div bx                                  ;push it in the stack        push dx                              ;increment the count        inc cx                              ;set dx to 0        xor dx,dx        jmp label1    print1:        ;check if count        ;is greater than zero        cmp cx,0        je exit                 ;pop the top of stack        pop dx                 ;add 48 so that it        ;represents the ASCII        ;value of digits        add dx,48                 ;interrupt to print a        ;character        mov ah,02h        int 21h                 ;decrease the count        dec cx        jmp print1exit:retPRINT ENDPEND MAIN
Output: 
655
Note: The program cannot be run on an online editor , please use MASM to run the program and use dos box to run MASM , you might use any 8086 emulator to run the program 
arorakashish0911
surinderdawra388
Computer Organization and Architecture
microprocessor
system-programming
Computer Organization & Architecture
microprocessor
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Architecture of 8086
Logical and Physical Address in Operating System
Computer Organization and Architecture | Pipelining | Set 1 (Execution, Stages and Throughput)
Computer Organization | RISC and CISC
Architecture of 8085 microprocessor
Interrupts
Memory Hierarchy Design and its Characteristics
Computer Organization | Von Neumann architecture
Difference between Von Neumann and Harvard Architecture
Programmable peripheral interface 8255
Make Selenium wait 10 seconds.

We can make Selenium wait for 10 seconds. This can be done by using the Thread.sleep method. Here, the wait time (10 seconds) is passed as a parameter to the method.
We can also use the synchronization concept in Selenium for waiting. There are two kinds of wait − implicit and explicit. Both these are of dynamic nature, however the implicit wait is applied to every step of automation, the explicit wait is applicable only to a particular element.
Code Implementation with sleep method.
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import java.util.concurrent.TimeUnit;
public class WaitThrd{
   public static void main(String[] args)
   throws InterruptedException{
      System.setProperty("webdriver.chrome.driver",
         "C:\\Users\\ghs6kor\\Desktop\\Java\\chromedriver.exe");
      WebDriver driver = new ChromeDriver();
      driver.get("https://www.tutorialspoint.com/index.htm");
      // wait time added
      Thread.sleep(200);
      // identify element,
      WebElement m=driver.findElement(By.id("gsc−i−id1"));
      m.sendKeys("Java");
      driver.close();
   }
}
Code Implementation with implicit wait.
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import java.util.concurrent.TimeUnit;
public class WaitImplicit{
   public static void main(String[] args)
   throws InterruptedException{
      System.setProperty("webdriver.chrome.driver",
         "C:\\Users\\ghs6kor\\Desktop\\Java\\chromedriver.exe");
      WebDriver driver = new ChromeDriver();
      // implicit wait
      driver.manage().timeouts().implicitlyWait(4, TimeUnit.SECONDS);
      driver.get("https://www.tutorialspoint.com/index.htm");
      // identify element,
      WebElement m=driver.findElement(By.id("gsc−i−id1"));
      m.sendKeys("Python");
      driver.close();
   }
}
Code Implementation with explicit wait.
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
public class WaitExplicit{
   public static void main(String[] args)
   throws InterruptedException{
      System.setProperty("webdriver.chrome.driver",
         "C:\\Users\\ghs6kor\\Desktop\\Java\\chromedriver.exe");
      WebDriver driver = new ChromeDriver();
      driver.get("https://www.tutorialspoint.com/index.htm");
      // identify element,
      WebElement l=driver.findElement(By.xpath("//*[text()='Library']"));
      l.click();
      //explicit wait
      WebDriverWait w = new WebDriverWait(driver,7);
      //expected condition
      w.until(ExpectedConditions.
      invisibilityOfElementLocated(By.xpath("//*[@class='mui−btn']")));
      driver.close();
   }
}
Remove Primary Key in MySQL?

To remove primary key in MySQL, use tje drop primary key command. To understand the concept, let us create a table with column as primary key.
mysql> create table PrimaryKeyDemo
   -> (
   -> id int not null,
   -> Primary key(id)
   -> );
Query OK, 0 rows affected (0.60 sec)
Let us check the description of the table with the help of DESC command. The query is as follows.
mysql> desc PrimaryKeyDemo;
The following is the output.
+-------+---------+------+-----+---------+-------+
| Field | Type    | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| id    | int(11) | NO   | PRI | NULL    |       |
+-------+---------+------+-----+---------+-------+
1 row in set (0.06 sec)

Look at the output above, there is a column ‘Key’ which has the PRI keyword. This itself says that the “id” column is primary key. Now, let us remove the primary key with the help of ALTER and DROP command. The query is as follows.
mysql>  alter table PrimaryKeyDemo drop primary key;
Query OK, 0 rows affected (1.70 sec)
Records: 0  Duplicates: 0  Warnings: 0
Let us now check whether primary key is removed or not successfully.
mysql> DESC PrimaryKeyDemo;
The following is the output that won’t display primary key now, since we have deleted it above.
+-------+---------+------+-----+---------+-------+
| Field | Type    | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| id    | int(11) | NO   |     | NULL    |       |
+-------+---------+------+-----+---------+-------+
1 row in set (0.00 sec)
How to create a timer using tkinter?

In this example, we will create a timer using Python Tkinter. For displaying time, we will use the Time Module in Python.
Initially, we will follow these steps to create the timer,
Create three entry widget each for Hours, Minute and Seconds and set the value ‘00’ by default.
Create a Button for setting the timer. It will call the function countdowntimer().
Define a function countdowntimer() which does update once we click on the button to propagate the time.
#Import the required library
from tkinter import *
import time
#Create an instance of tkinter frame
win = Tk()
win.geometry('750x300')
win.resizable(False,False)
#Configure the background
win.config(bg='burlywood1')
#Create Entry Widgets for HH MM SS
sec = StringVar()
Entry(win, textvariable=sec, width = 2, font = 'Helvetica 14').place(x=220, y=120)
sec.set('00')
mins= StringVar()
Entry(win, textvariable = mins, width =2, font = 'Helvetica
14').place(x=180, y=120)
mins.set('00')
hrs= StringVar()
Entry(win, textvariable = hrs, width =2, font = 'Helvetica 14').place(x=142, y=120)
hrs.set('00')
#Define the function for the timer
def countdowntimer():
   times = int(hrs.get())*3600+ int(mins.get())*60 + int(sec.get())
   while times > -1:
      minute,second = (times // 60 , times % 60)
      hour =0
      if minute > 60:
         hour , minute = (minute // 60 , minute % 60)
      sec.set(second)
      mins.set(minute)
      hrs.set(hour)
      #Update the time
      win.update()
      time.sleep(1)
      if(times == 0):
         sec.set('00')
         mins.set('00')
         hrs.set('00')
      times -= 1
Label(win, font =('Helvetica bold',22), text = 'Set the Timer',bg
='burlywood1').place(x=105,y=70)
Button(win, text='START', bd ='2', bg = 'IndianRed1',font =('Helvetica
bold',10), command = countdowntimer).place(x=167, y=165)
win.mainloop()
The above code will display a clock timer.
Now, set the timer by inserting some value in the box and click the "START" button to start the timer.
Convert number to reversed array of digits JavaScript

Let’s say, we have to write a function that takes in a number and returns an array of numbers
with elements as the digits of the number but in reverse order. We will convert the number into a
string, then split it to get an array of strings of digit, then we will convert the string into numbers,
reverse the array and finally return it.
Following is our function that takes in a number to be reversed −
const reversifyNumber = (num) => {
   const numString = String(num);
   return numString.split("").map(el => {
      return +el;
   }).reverse();
};
const reversifyNumber = (num) => {
   const numString = String(num);
   return numString.split("").map(el => {
      return +el;
   }).reverse();
};
console.log(reversifyNumber(1245));
console.log(reversifyNumber(123));
console.log(reversifyNumber(5645));
console.log(reversifyNumber(645));
The output in the console will be −
[ 5, 4, 2, 1 ]
[ 3, 2, 1 ]
[ 5, 4, 6, 5 ]
[ 5, 4, 6 ]
Set Column Ordering in Bootstrap

Write the columns in an order, and show them in another one. You can easily change the order of built-in grid columns with .col-md-push-* and .col-md-pull-*modifier classes where * range from 1 to 11.
 Live Demo
<!DOCTYPE html>
<html>
   <head>
      <title>Bootstrap Example</title>
      <link href = "/bootstrap/css/bootstrap.min.css" rel = "stylesheet">
      <script src = "/scripts/jquery.min.js"></script>
      <script src = "/bootstrap/js/bootstrap.min.js"></script>
   </head>
   <body>
      <div class = "container">
         <h1>Heading</h1>
         <div class = "row">
            <p>Before Ordering</p>
            <div class = "col-md-4" style = "background-color: #dedef8;
               box-shadow: inset 1px -1px 1px #444, inset -1px 1px 1px #444;">
               I am on left
            </div>
            <div class = "col-md-8" style = "background-color: #dedef8;
               box-shadow: inset 1px -1px 1px #444, inset -1px 1px 1px #444;">
               I am on right
            </div>
         </div>
         <br>
         <div class = "row">
            <p>After Ordering</p>
            <div class = "col-md-4 col-md-push-8" style = "background-color: #dedef8;
               box-shadow: inset 1px -1px 1px #444, inset -1px 1px 1px #444;">
               I was on left
            </div>
            <div class = "col-md-8 col-md-pull-4" style = "background-color: #dedef8;
               box-shadow: inset 1px -1px 1px #444, inset -1px 1px 1px #444;">
               I was on right
            </div>
         </div>
      </div>  
   </body>
</html>
How to catch ValueError using Exception in Python?

A ValueError is used when a function receives a value that has the right type but an invalid value.
The given code can be rewritten as follows to handle the exception and find its type.
import sys
try:
n = int('magnolia')
except Exception as e:
print e
print sys.exc_type
invalid literal for int() with base 10: 'magnolia'
<type 'exceptions.ValueError'>
PhantomJS - Environment Setup

PhantomJS is a free software and is distributed under the BSD License. It is easy to install and it offers multiple features to execute the scripts. PhantomJS can be easily run on multiple platforms such as Windows, Linux, and Mac.
For downloading PhantomJS, you can go to – http://phantomjs.org/ and then click on the download option.
The download page shows you the options for download for different OS. Download the zip file, unpack it and you will get an executable phantom.exe. Set the PATH environment variable to the path of phantom.exe file. Open a new command prompt and type phantomjs –v. It should give you the current version of PhantomJS that is running.
Download the PhantomJS zip file meant for MAC OS and extract the content. Once the content is downloaded, move the PhantomJS to – /usr/local/bin/. Execute PhantomJS command i.e. phantomjs –v at the terminal and it should give you the version description of PhantomJS.
Download the PhantomJS zip file meant for Linux 64 bit and extract the content. Once the content is downloaded, move PhantomJS folder to /usr/local/share/ and create a symlink −
sudo mv $PHANTOM_JS /usr/local/share 
sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin.

Execute phantomjs –v at the terminal and it should give the version of PhantomJS.
Download the PhantomJS zip file meant for Linux 32 bit and extract the content. Once the content is downloaded, move the PhantomJS folder to /usr/local/share/ and create a symlink −
sudo mv $PHANTOM_JS /usr/local/share 
sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin.

Execute phantomjs –v at the terminal and it should give the version of PhantomJS.
The PhantomJS source code can also be taken from the git repository by clicking on the following link – https://github.com/ariya/phantomjs/
To run scripts in PhantomJS, the command is as follows −
phantomjs jsfile arg1 arg2... 

 Print
 Add Notes
 Bookmark this page
SQL - TRUNCATE TABLE Command

The SQL TRUNCATE TABLE command is used to delete complete data from an existing table.
You can also use DROP TABLE command to delete complete table but it would remove complete table structure form the database and you would need to re-create this table once again if you wish you store some data.
The basic syntax of a TRUNCATE TABLE command is as follows.
TRUNCATE TABLE  table_name;

Consider a CUSTOMERS table having the following records −
+----+----------+-----+-----------+----------+
| ID | NAME     | AGE | ADDRESS   | SALARY   |
+----+----------+-----+-----------+----------+
|  1 | Ramesh   |  32 | Ahmedabad |  2000.00 |
|  2 | Khilan   |  25 | Delhi     |  1500.00 |
|  3 | kaushik  |  23 | Kota      |  2000.00 |
|  4 | Chaitali |  25 | Mumbai    |  6500.00 |
|  5 | Hardik   |  27 | Bhopal    |  8500.00 |
|  6 | Komal    |  22 | MP        |  4500.00 |
|  7 | Muffy    |  24 | Indore    | 10000.00 |
+----+----------+-----+-----------+----------+

Following is the example of a Truncate command.
SQL > TRUNCATE TABLE CUSTOMERS;
Now, the CUSTOMERS table is truncated and the output from SELECT statement will be as shown in the code block below −
SQL> SELECT * FROM CUSTOMERS;
Empty set (0.00 sec)


    42 Lectures 
     5 hours 

 Anadi Sharma

    14 Lectures 
     2 hours 

 Anadi Sharma

    44 Lectures 
     4.5 hours 

 Anadi Sharma

    94 Lectures 
     7 hours 

 Abhishek And Pukhraj

    80 Lectures 
     6.5 hours 

 Oracle Master Training | 150,000+ Students Worldwide

    31 Lectures 
     6 hours 

 Eduonix Learning Solutions
 Print
 Add Notes
 Bookmark this page
Java - isLowerCase() Method

The method determines whether the specified char value is lowercase.
boolean isLowerCase(char ch)

Here is the detail of parameters −
ch − Primitive character type.
ch − Primitive character type.
This method returns true, if the passed character is really in lowercase.
public class Test {

   public static void main(String args[]) {
      System.out.println(Character.isLowerCase('c'));
      System.out.println(Character.isLowerCase('C'));
      System.out.println(Character.isLowerCase('\n'));
      System.out.println(Character.isLowerCase('\t'));
   }
}
This will produce the following result −
true
false
false
false


    16 Lectures 
     2 hours 

 Malhar Lathkar

    19 Lectures 
     5 hours 

 Malhar Lathkar

    25 Lectures 
     2.5 hours 

 Anadi Sharma

    126 Lectures 
     7 hours 

  Tushar Kale

    119 Lectures 
     17.5 hours 

 Monica Mittal

    76 Lectures 
     7 hours 

 Arnab Chakraborty
 Print
 Add Notes
 Bookmark this page
LISP - Comparison Operators

Following table shows all the relational operators supported by LISP that compares between numbers. However unlike relational operators in other languages, LISP comparison operators may take more than two operands and they work on numbers only.
Assume variable A holds 10 and variable B holds 20, then −
Create a new source code file named main.lisp and type the following code in it.
(setq a 10)
(setq b 20)
(format t "~% A = B is ~a" (= a b))
(format t "~% A /= B is ~a" (/= a b))
(format t "~% A > B is ~a" (> a b))
(format t "~% A < B is ~a" (< a b))
(format t "~% A >= B is ~a" (>= a b))
(format t "~% A <= B is ~a" (<= a b))
(format t "~% Max of A and B is ~d" (max a b))
(format t "~% Min of A and B is ~d" (min a b))
When you click the Execute button, or type Ctrl+E, LISP executes it immediately and the result returned is −
A = B is NIL
A /= B is T
A > B is NIL
A < B is T
A >= B is NIL
A <= B is T
Max of A and B is 20
Min of A and B is 10


    79 Lectures 
     7 hours 

 Arnold Higuit
 Print
 Add Notes
 Bookmark this page
Tryit Editor v3.6 - Show Python

mydb = mysql.connector.connect(
fmt.Sscan() Function in Golang With Examples - GeeksforGeeks

05 May, 2020
In Go language, fmt package implements formatted I/O with functions analogous to C’s printf() and scanf() function. The fmt.Sscan() function in Go language scans the specified texts and store the successive space-separated texts into successive arguments. 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 Sscan(str string, a ...interface{}) (n int, err error)

Parameters: This function accepts two parameters which are illustrated below:
str string: This parameter contains the specified text which is going to be scanned.
a ...interface{}: This parameter receives each texts.
Returns: It returns the number of items successfully scanned.
Example 1:
// Golang program to illustrate the usage of// fmt.Sscan() function  // Including the main packagepackage main  // Importing fmtimport (    "fmt")  // Calling mainfunc main() {      // Declaring two variables    var name string    var alphabet_count int      // Calling the Sscan() function which    // returns the number of elements    // successfully scanned and error if    // it persists    n, err := fmt.Sscan("GFG 3", &name, &alphabet_count)      // Below statements get executed if there is any error    if err != nil {        panic(err)    }      // Printing the number of elements and each elements also    fmt.Printf("%d: %s, %d\n", n, name, alphabet_count)  }
Output:
2: GFG, 3

Example 2:
// Golang program to illustrate the usage of// fmt.Sscan() function  // Including the main packagepackage main  // Importing fmtimport (    "fmt")  // Calling mainfunc main() {      // Declaring some variables    var name string    var alphabet_count int    var float_value float32    var boolean_value bool      // Calling the Sscan() function which    // returns the number of elements    // successfully scanned and error if    // it persists    n, err := fmt.Sscan("GeeksforGeeks 13 6.7 true",      &name, &alphabet_count, &float_value, &boolean_value)      // Below statements get    // executed if there is any error    if err != nil {        panic(err)    }      // Printing the number of     // elements and each elements also    fmt.Printf("%d: %s, %d, %g, %t", n, name,      alphabet_count, float_value, boolean_value)  }
Output:
4: GeeksforGeeks, 13, 6.7, true

Golang-fmt
Go Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
How to Parse JSON in Golang?
Defer Keyword in Golang
Rune in Golang
Anonymous function in Go Language
Loops in Go Language
Class and Object in Golang
Structures in Golang
Time Durations in Golang
Strings in Golang
How to iterate over an Array using for loop in Golang?
\varphi - Tex Command

\varphi - Used to create varphi symbol.
{ \varphi}
\varphi command draws varphi symbol.

\varphi

φ



\varphi

φ


\varphi

    14 Lectures 
     52 mins

 Ashraf Said

    11 Lectures 
     1 hours 

 Ashraf Said

    9 Lectures 
     1 hours 

 Emenwa Global, Ejike IfeanyiChukwu

    29 Lectures 
     2.5 hours 

 Mohammad Nauman

    14 Lectures 
     1 hours 

 Daniel Stern

    15 Lectures 
     47 mins

 Nishant Kumar
 Print
 Add Notes
 Bookmark this page
Find the mean vector of a Matrix in C++

Suppose we have a matrix of order M x N, we have to find the mean vector of the given matrix. So if the matrix is like −
Then the mean vector is [4, 5, 6] As the mean of each column is (1 + 4 + 7)/3 = 4, (2 + 5 + 8)/3 = 5, and (3 + 6 + 9)/3 = 6
From the example, we can easily identify that if we calculate the mean of each column will be the mean vector.
 Live Demo
#include<iostream>
#define M 3
#define N 3
using namespace std;
void calculateMeanVector(int mat[M][N]) {
   cout << "[ ";
   for (int i = 0; i < M; i++) {
      double average = 0.00;
      int sum = 0;
      for (int j = 0; j < N; j++)
      sum += mat[j][i];
      average = sum / M;
      cout << average << " ";
   }
   cout << "]";
}
int main() {
   int mat[M][N] = {{ 1, 2, 3 },
      { 4, 5, 6 },
      { 7, 8, 9 }
   };
   cout << "Mean vector is: ";
   calculateMeanVector(mat);
}
Mean vector is: [ 4 5 6 ]
Python Object Comparison : “is” vs “==”

10 Sep, 2018
Both “is” and “==” are used for object comparison in Python. The operator “==” compares values of two objects, while “is” checks if two objects are same (In other words two references to same object).
# Python program to demonstrate working of # "=="  # Two different objects having same valuesx1 = [10, 20, 30]x2 = [10, 20, 30]  # Comparison using "==" operatorif  x1 == x2:    print("Yes")else:    print("No")
Yes

The “==” operator does not tell us whether x1 and x2 are actually referring to the same object or not. We use “is” for this purpose.
# Python program to demonstrate working of # "is"  # Two different objects having same valuesx1 = [10, 20, 30]x2 = [10, 20, 30]  # We get "No" hereif  x1 is x2:    print("Yes")else:    print("No")  # It creates another reference x3 to same list.x3 = x1  # So we get "Yes" hereif  x1 is x3:    print("Yes")else:    print("No")  # "==" would also produce yes anywayif  x1 == x3:    print("Yes")else:    print("No")
No
Yes
Yes

x1 = [10, 20, 30]  # Here a new list x2 is created using x1x2 = list(x1)  # The "==" operator would produce "Yes"if  x1 == x2:    print("Yes")else:    print("No")  # But "is" operator would produce "No"if  x1 is x2:    print("Yes")else:    print("No")
Yes
No

Conclusion:
“is” returns True if two variables point to the same object.
“==” returns True if two variables have same values(or content).
python-basics
Python-Operators
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Different ways to create Pandas Dataframe
Enumerate() in Python
Python String | replace()
How to Install PIP on Windows ?
*args and **kwargs in Python
Python Classes and Objects
Iterate over a list in Python
Python OOPs Concepts
Introduction To PYTHON
Python | Check if tuple has any None value

26 Nov, 2019
Sometimes, while working with Python, we can have a problem in which we have a record and we need to check if it contains all valid values i.e has any None value. This kind of problem is common in data preprocessing steps. Let’s discuss certain ways in which this task can be performed.
Method #1 : Using any() + map() + lambdaCombination of above functions can be used to perform this task. In this, we check for any element using any() and extension of logic is done by map() and lambda.
# Python3 code to demonstrate working of# Check if tuple has any None value# using any() + map() + lambda  # initialize tupletest_tup = (10, 4, 5, 6, None)  # printing original tupleprint("The original tuple : " + str(test_tup))  # Check if tuple has any None value# using any() + map() + lambdares = any(map(lambda ele: ele is None, test_tup))  # printing resultprint("Does tuple contain any None value ? : " + str(res))
The original tuple : (10, 4, 5, 6, None)
Does tuple contain any None value ? : True

 
Method #2 : Using not + all()This checks for truthness of all elements of tuple using all() and with not, returns True if there is no None element.
# Python3 code to demonstrate working of# Check if tuple has any None value# using not + all()  # initialize tupletest_tup = (10, 4, 5, 6, None)  # printing original tupleprint("The original tuple : " + str(test_tup))  # Check if tuple has any None value# using not + all()res = not all(test_tup)  # printing resultprint("Does tuple contain any None value ? : " + str(res))
The original tuple : (10, 4, 5, 6, None)
Does tuple contain any None value ? : True

Python tuple-programs
Python
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python reversed() function

23 Sep, 2021
Python reversed() method returns an iterator that accesses the given sequence in the reverse order.
reversed(sequ) 
sequ : Sequence to be reversed. 
returns an iterator that accesses the given sequence in the reverse order. 
Here we use tuple and range.
Python3
# Python code to demonstrate working of# reversed() # For tupleseqTuple = ('g', 'e', 'e', 'k', 's')print(list(reversed(seqTuple))) # For rangeseqRange = range(1, 5)print(list(reversed(seqRange)))
Output:
['s', 'k', 'e', 'e', 'g']
[4, 3, 2, 1]
Python3
class gfg:    vowels = ['a', 'e', 'i', 'o', 'u']     # Function to reverse the list    def __reversed__(self):        return reversed(self.vowels) # Main Function   if __name__ == '__main__':    obj = gfg()    print(list(reversed(obj)))
Output : 
['u', 'o', 'i', 'e', 'a']
Python3
vowels = ['a', 'e', 'i', 'o', 'u']print(list(reversed(vowels)))
Output:
['u', 'o', 'i', 'e', 'a']
Python3
str = "Geeksforgeeks"print(list(reversed(str)))
Output:
['s', 'k', 'e', 'e', 'g', 'r', 'o', 'f', 's', 'k', 'e', 'e', 'G']
Python3
# For listseqList = [1, 2, 4, 3, 5]print(list(reversed(seqList)))
Output:
[5, 3, 4, 2, 1]
kumar_satyam
Python-Functions
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Different ways to create Pandas Dataframe
Enumerate() in Python
Python String | replace()
How to Install PIP on Windows ?
*args and **kwargs in Python
Python Classes and Objects
Iterate over a list in Python
Python OOPs Concepts
Introduction To PYTHON
How to deal with error “$ operator is invalid for atomic vectors” in R?

This error occurs because $ operator is not designed to access vector elements. If we use $ operator to access the vector elements then R does not understand it and consider it invalid, therefore, we must be very careful about where we should use $ operator. It happens when we give a name to our elements and start thinking that we can treat them as data frame columns which is a wrong approach. To access the vector elements, we should use single square brackets.
Consider the below vector −
> set.seed(1)
> x1<-sample(1:10,20,replace=TRUE)
> x1
[1] 9 4 7 1 2 7 2 3 1 5 5 10 6 10 7 9 5 5 9 9
> names(x1)<-LETTERS[1:20]
> x1
A B C D E F G H I J K L M N O P Q R S T
9 4 7 1 2 7 2 3 1 5 5 10 6 10 7 9 5 5 9 9
> x1$K
Error in x1$K : $ operator is invalid for atomic vectors
Here, we are getting the error that “$ operator is invalid for atomic vectors”. Now we should access the elements of the vector x1 with single square brackets as shown below −
> x1["K"]
K
5
> x1["T"]
T
9
> x1["A"]
A
9
> x1[1]
A
9
Let’s have a look at one more example −
> x2<-sample(1:100,10)
> x2
[1] 37 34 89 44 79 33 84 35 70 74
> names(x2)<-c("A1","A2","A3","A4","A5","A6","A7","A8","A9","A10")
> x2
A1 A2 A3 A4 A5 A6 A7 A8 A9 A10
37 34 89 44 79 33 84 35 70 74
> x2["A10"]
A10
74
> x2["A5"]
A5
79
> x2["A6"]
A6
33
> x2["A1"]
A1
37
> x2["A3"]
A3
89
HTML | <font> face Attribute

28 May, 2019
The HTML <font> face Attribute is used to specify the font family of the text inside <font> element.
Syntax:
<font face="font_family">
Attribute Values: It contains single value font_family which is used to specify the font family. Several font family can be used by separating comma.
Note: The <font> face attribute is not supported by HTML5.
Example:
<!DOCTYPE html><html>  <head>    <title>        HTML font face Attribute    </title></head>  <body>    <font size="6" face="verdana">            GeeksforGeeks!        </font>    <br>      <font size="6" face="arial">            GeeksforGeeks!        </font>    <br>      <font size="6">            GeeksforGeeks!        </font></body>  </html>
Output:
Supported Browsers: The browser supported by HTML <font> face attribute are listed below:
Google Chrome
Internet Explorer
Firefox
Safari
Opera
HTML-Attributes
HTML
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
REST API (Introduction)
Types of CSS (Cascading Style Sheet)
Design a Tribute Page using HTML & CSS
HTTP headers | Content-Type
How to Insert Form Data into Database using PHP ?
Installation of Node.js on Linux
Difference between var, let and const keywords in JavaScript
How to fetch data from an API in ReactJS ?
Differences between Functional Components and Class Components in React
Remove elements from a JavaScript Array
numpy.random.uniform() in Python

18 Aug, 2020
With the help of numpy.random.uniform() method, we can get the random samples from uniform distribution and returns the random samples as numpy array by using this method.
Uniform distribution
Syntax : numpy.random.uniform(low=0.0, high=1.0, size=None)
Return : Return the random samples as numpy array.
Example #1 :
In this example we can see that by using numpy.random.uniform() method, we are able to get the random samples from uniform distribution and return the random samples.
Python3
# import numpyimport numpy as npimport matplotlib.pyplot as plt  # Using uniform() methodgfg = np.random.uniform(-5, 5, 5000)  plt.hist(gfg, bins = 50, density = True)plt.show()
Output :
Example #2 :
Python3
# import numpyimport numpy as npimport matplotlib.pyplot as plt  # Using uniform() methodgfg = np.random.uniform(2.1, 5.5, 10000)  plt.hist(gfg, bins = 100, density = True)plt.show()
Output :
Python numpy-Random
Python-numpy
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Python Classes and Objects
Python OOPs Concepts
Introduction To PYTHON
How to drop one or multiple columns in Pandas Dataframe
Python | os.path.join() method
How To Convert Python Dictionary To JSON?
Check if element exists in list in Python
Python | datetime.timedelta() function
Python | Get unique values from a list
Logger addHandler() method in Java with Examples

24 Jun, 2021
addHandler() method of a Logger class used to add a log Handler to receive logging messages. A Handler is a component of JVM that takes care of actual logging to the defined output writers like a file, console out etc. one or more Handlers can be added to a Logger. When different types of messages are logged using the Logger, the logs are forwarded to the Handler’s output. By default, Loggers send their output to their parent logger.So we can say Parent Logger is a type of handler for child logger.Syntax:  
public void addHandler(Handler handler)
                throws SecurityException
Parameters: This method accepts one parameter handler which represents a logging Handler.Return value: This method returns nothing.Exception: This method throws SecurityException if a security manager exists, this logger is not anonymous, and the caller does not have LoggingPermission(“control”).Below programs illustrate the isLoggable() method: Program 1:  
Java
// Java program to demonstrate// Logger.addHandler() method import java.util.logging.*;import java.io.IOException; public class GFG {     private static Logger logger        = Logger.getLogger(            GFG.class.getName());     public static void main(String args[])        throws SecurityException, IOException    {         // Create a file handler object        FileHandler handler = new FileHandler("logs.txt");         // Add file handler as        // handler of logs        logger.addHandler(handler);         // Log message        logger.info("This is Info Message ");        logger.log(Level.WARNING,                   "Warning Message");    }}
Output: The output printed on logs.txt file is shown below-  
addHandler
Program 2:  
Java
// Java program to demonstrate// Logger.addHandler() method import java.util.logging.*;import java.io.IOException; public class GFG {     private static Logger logger        = Logger.getLogger(            GFG.class.getName());     public static void main(String args[])        throws SecurityException, IOException    {         // Create a ConsoleHandler object        ConsoleHandler handler            = new ConsoleHandler();         // Add console handler as        // handler of logs        logger.addHandler(handler);         // Log message        logger.info("This is Info Message ");        logger.log(Level.WARNING, "Warning Message");    }}
The output printed on console output is shown below-  
addHandler(java.util.logging.Handler)
References: https://docs.oracle.com/javase/10/docs/api/java/util/logging/Logger.html#addHandler(java.util.logging.Handler) 
sooda367
Java - util package
Java-Functions
Java-Logger
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
nslookup command in Linux with Examples

09 Nov, 2021
Nslookup (stands for “Name Server Lookup”) is a useful command for getting information from the DNS server. It is a network administration tool for querying the Domain Name System (DNS) to obtain domain name or IP address mapping or any other specific DNS record. It is also used to troubleshoot DNS-related problems. 
Syntax: 
nslookup [option]
Options of nslookup command:  
nslookup google.com : nslookup followed by the domain name will display the “A Record” (IP Address) of the domain. Use this command to find the address record for a domain. It queries to domain name servers and gets the details. 
nslookup 192.168.0.10: Reverse DNS lookup You can also do the reverse DNS look-up by providing the IP Address as an argument to nslookup. 
You can also do the reverse DNS look-up by providing the IP Address as an argument to nslookup. 
nslookup -type=any google.com : Lookup for any record We can also view all the available DNS records using the -type=any option. 
nslookup -type=soa redhat.com : Lookup for an soa record SOA record (start of authority), provides the authoritative information about the domain, the e-mail address of the domain admin, the domain serial number, etc... 
nslookup -type=ns google.com : Lookup for an ns record NS (Name Server) record maps a domain name to a list of DNS servers authoritative for that domain. It will output the name serves which are associated with the given domain. 
nslookup -type=a google.com : Lookup for an a record We can also view all the available DNS records for a particular record using the -type=a option. 
nslookup -type=mx google.com : Lookup for an mx record MX (Mail Exchange) record maps a domain name to a list of mail exchange servers for that domain. The MX record tells that all the mails sent to “google.com” should be routed to the Mail server in that domain. 
nslookup -type=txt google.com : Lookup for an txt record TXT records are useful for multiple types of records like DKIM, SPF, etc. You can find all TXT records configured for any domain using the below command. 
 
marcosarcticseal
linux-command
Linux-networking-commands
Picked
Computer Networks
Linux-Unix
Computer Networks
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Differences between TCP and UDP
Types of Network Topology
RSA Algorithm in Cryptography
TCP Server-Client implementation in C
Socket Programming in Python
AWK command in Unix/Linux with examples
cut command in Linux with examples
cp command in Linux with examples
ZIP command in Linux with examples
tar command in Linux with examples
Boundary Value Analysis – Triangle Problem

11 Jun, 2021
Boundary Value Analysis (BVA) is a black box software testing technique where test cases are designed using boundary values. BVA is based on the single fault assumption, also known as critical fault assumption which states that failures are rarely the product of two or more simultaneous faults. Hence while designing the test cases for BVA we keep all but one variable to the nominal value and allowing the remaining variable to take the extreme value. 
Test Case Design for BVA: While designing the test cases for BVA first we determine the number of input variables in the problem. For each input variable, we then determine the range of values it can take. Then we determine the extreme values and nominal value for each input variable. 
Consider an input variable t taking values in the range [l, r].Extreme values for t are –  
t = l
t = l+1
t = r-1
t = r 
The nominal value for the variable can be any value in the range (l, r). In most of the BVA implementations, it is taken as the middle value of the range (r+l)/2. The figure on the right shows the nominal and extreme values for boundary value of analysis of a two variable problem. 
Under the single fault assumption, the total number of test cases in BVA for a problem with n inputs is 4n+1. The 4n cases correspond to the test cases with the four extreme values of each variable keeping the other n-1 variable at nominal value. The one additional case is where all variables are held at a nominal value. 
One of the common problem for Test Case Design using BVA is the Triangle Problem that is discussed below – 
Triangle Problem accepts three integers – a, b, c as three sides of the triangle .We also define a range for the sides of the triangle as [l, r] where l>0. It returns the type of triangle (Scalene, Isosceles, Equilateral, Not a Triangle) formed by a, b, c. 
For a, b, c to form a triangle the following conditions should be satisfied – 
a < b+c
b < a+c
c < a+b 
If any of these conditions is violated output is Not a Triangle.  
For Equilateral Triangle all the sides are equal.
For Isosceles Triangle exactly one pair of sides is equal.
For Scalene Triangle all the sides are different.
The table shows the Test Cases Design for the Triangle Problem.The range value [l, r] is taken as [1, 100] and nominal value is taken as 50. 
The total test cases is,  
4n+1 = 4*3+1 = 13 
 
akshaysingh98088
Software Testing
Technical Scripter 2019
Software Engineering
Technical Scripter
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Software Engineering | Software Quality

30 Sep, 2019
Traditionally, a high-quality product is outlined in terms of its fitness of purpose. That is, a high-quality product will specifically what the users need it to try to. For code merchandise, the fitness of purpose is typically taken in terms of satisfaction of the wants arranged down within the SRS document. though “fitness of purpose” could be a satisfactory definition of quality for several merchandises like an automobile, a table fan, a grinding machine, etc. – for code merchandise, “fitness of purpose” isn’t a completely satisfactory definition of quality. To convey associate degree example, think about a software that’s functionally correct.
It performs all functions as laid out in the SRS document. But, it has an associate degree virtually unusable program. despite the fact that it should be functionally correct, we have a tendency to cannot think about it to be a high-quality product. Another example is also that of a product that will everything that the users need however has associate degree virtually incomprehensible and not maintainable code. Therefore, the normal construct of quality as “fitness of purpose” for code merchandise isn’t totally satisfactory.
The modern read of high-quality associates with software many quality factors like the following:
Portability:A software is claimed to be transportable, if it may be simply created to figure in several package environments, in several machines, with alternative code merchandise, etc.
Usability:A software has smart usability if completely different classes of users (i.e. each knowledgeable and novice users) will simply invoke the functions of the merchandise.
Reusability:A software has smart reusability if completely different modules of the merchandise will simply be reused to develop new merchandise.
Correctness:A software is correct if completely different needs as laid out in the SRS document are properly enforced.
Maintainability:A software is reparable, if errors may be simply corrected as and once they show up, new functions may be simply added to the merchandise, and therefore the functionalities of the merchandise may be simply changed, etc
nidhi_biet
Software Engineering
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Is it possible to manually set the attribute value of a Web Element using Selenium?

Yes it is possible to manually set the attribute value of a web element in Selenium webdriver using the JavaScript Executor. Selenium can run JavaScript commands with the help of the executeScript method.
First, we shall identify the element on which we want to manually set the attribute value with the JavaScript command document.getElementsByClassname. Next to set the attribute we have to use the setAttribute method.
Let us modify the background color of the button CHECK IT NOW to yellow. By default it is green on the page.
The can be done by setting the style attribute of the background-color to yellow.
JavascriptExecutor j = (JavascriptExecutor) driver;
j.executeScript ("document.getElementsByClassName('mui-btn')[0].setAttribute('style', " + "'background-color: yellow')");
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.JavascriptExecutor;
public class BackGroundColr{
   public static void main(String[] args) {
      System.setProperty("webdriver.gecko.driver",
         "C:\\Users\\ghs6kor\\Desktop\\Java\\geckodriver.exe");
      WebDriver driver = new FirefoxDriver();
      driver.get("https://www.tutorialspoint.com/index.htm");
      // Javascript executor to modify background color
      JavascriptExecutor j = (JavascriptExecutor) driver;
      j.executeScript ("document.getElementsByClassName('mui-btn')[0].setAttribute('style', "
         + "'background-color: yellow')");
   }
}
Reading a text file into an Array in Node.js

We can read a text file and return its content as an Array using node.js. We can use this array content to either process its lines or just for the sake of reading. We can use the 'fs' module to deal with the reading of file. The fs.readFile() and fs.readFileSync() methods are used for the reading files. We can also read large text files using this method.
Create a file with name – fileToArray.js and copy the below code snippet. After creating file, use the following command to run this code as shown in the example below −
node fileToArray.js
fileToArray.js
// Importing the fs module
let fs = require("fs")

// Intitializing the readFileLines with the file
const readFileLines = filename =>
   fs.readFileSync(filename)
   .toString('UTF8')
   .split('\n');

// Calling the readFiles function with file name
let arr = readFileLines('tutorialsPoint.txt');

// Printing the response array
console.log(arr);
C:\home\node>> node fileToArray.js
[ 'Welcome to TutorialsPoint !',
   'SIMPLY LEARNING', '' ]
Let's take a look at one more example.
// Importing the fs module
var fs = require("fs")

// Intitializing the readFileLines with filename
fs.readFile('tutorialsPoint.txt', function(err, data) {
   if(err) throw err;
      var array = data.toString().split("\n");
   for(i in array) {
      // Printing the response array
      console.log(array[i]);
   }
});
C:\home\node>> node fileToArray.js
Welcome to TutorialsPoint !
SIMPLY LEARNING
MySQL DELETE Statement

The DELETE statement is used to delete existing records in a table.
Note: Be careful when deleting records in a table! Notice the 
WHERE clause in the 
DELETE statement.
The WHERE clause specifies which record(s) should be deleted. If 
you omit the WHERE clause, all records in the table will be deleted!
Below is a selection from the "Customers" table in the Northwind sample 
database:
The following SQL statement deletes the customer "Alfreds Futterkiste" from 
the "Customers" table:
The "Customers" table will now look like this:
It is possible to delete all rows in a table without deleting the table. This 
means that the table structure, attributes, and indexes will be intact:
The following SQL statement deletes all rows in the "Customers" table, 
without deleting the table:
Delete all the records from the Customers table where the Country value is 'Norway'.
 Customers
 Country = 'Norway';

Start the Exercise
We just launchedW3Schools videos
Get certifiedby completinga course today!
If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:
help@w3schools.com
Your message has been sent to W3Schools.
Python Program to find the area of a circle

In this article, we will learn about the solution and approach to solve the given problem statement.
Problem statement −Given the radius of a circle, we need to find a circle.
The area of a circle can simply be evaluated using the following formula.
Area = Pi*r*r
Let’s see the implementation below −
 Live Demo
def findArea(r):
   PI = 3.142
   return PI * (r*r);
# Driver method
print("Area is %.6f" % findArea(5));
Area is 78.550000
All variables and functions are declared in the global scope as shown in the figure below.
In this article, we learned about the approach to find whether it is possible to make a divisible by 3 numbers using all digits in an array.