code-rag-bench/online-tutorials huggingface dataset:
How to get all the available azure VM images using Azure CLI in PowerShell?

To get all the available azure VM images using Azure CLI, you can use the command az vm image.
The below command will retrieve all the available azure images in the marketplace.
PS C:\> az vm image list --all
The above command will take some time to retrieve the output. To get the output into the table format, use the below command.
PS C:\> az vm image list --all -otable
To retrieve the images from the particular location, use the -l or --location parameter.
PS C:\> az vm image list -l eastus -otable
To get the VM images from the specific publisher,
PS C:\> az vm image list -l eastus -p MicrosoftWindowsServer --all -otable
Find All Numbers Disappeared in an Array in C++

Suppose we have an array of n elements. Some elements appear twice and other appear once. Elements are in range 1 <= A[i] <= n. We have to find those elements that are not present in the array. The constraint is that we have to solve this problem without using extra space, and time will be O(n).
So if the array is [4, 3, 2, 7, 8, 2, 3, 1], then result will be [5, 6]
To solve this, we will follow these steps −
let n is the size of the array
for i in range 0 to n – 1x := |A[i]| - 1if A[x] > 0, then A[x] := - A[x]
x := |A[i]| - 1
if A[x] > 0, then A[x] := - A[x]
define answer as an array
for i in range 0 to n – 1if A[i] > 0, then add i + 1 into the answer
if A[i] > 0, then add i + 1 into the answer
return the answer
Let us see the following implementation to get better understanding −
 Live Demo
#include <bits/stdc++.h>
using namespace std;
void print_vector(vector<int> v){
   cout << "[";
   for(int i = 0; i<v.size(); i++){
      cout << v[i] << ", ";
   }
   cout << "]";
}
class Solution {
   public:
   vector<int> findDisappearedNumbers(vector<int>& v) {
      int n = v.size();
      for(int i = 0;i < n; i++){
         int x = abs(v[i]) - 1;
         if(v[x] > 0) v[x] = -v[x];
      }
      vector <int> ans;
      for(int i = 0; i < n; i++){
         if(v[i]>0)ans.push_back(i+1);
      }
      return ans;
   }
};
main(){
   Solution ob;
   vector<int> v{4,3,2,7,8,2,3,5};
   print_vector(ob.findDisappearedNumbers(v));
}
[4,3,2,7,8,2,3,5]
[1, 6, ]
Dimensional Data Modeling - GeeksforGeeks

24 Sep, 2021
Popular Schema – Star Schema, Snow Flake Schema  
Dimensional Data Modelling is one of the data modelling techniques used in data warehouse design. 
Goal: Improve the data retrieval.
The concept of Dimensional Modelling was developed by Ralph Kimball which is comprised of facts and dimension tables. Since the main goal of this modelling is to improve the data retrieval so it is optimized for SELECT OPERATION. The advantage of using this model is that we can store data in such a way that it is easier to store and retrieve the data once stored in a data warehouse. Dimensional model is the data model used by many OLAP systems. 
 
Figure – Steps for Dimensional Model 
Steps to Create Dimensional Data Modelling: 
Step-1: Identifying the business objective – The first step is to identify the business objective. Sales, HR, Marketing, etc. are some examples as per the need of the organization. Since it is the most important step of Data Modelling the selection of business objective also depends on the quality of data available for that process.  
Step-2: Identifying Granularity – Granularity is the lowest level of information stored in the table. The level of detail for business problem and its solution is described by Grain.  
Step-3: Identifying Dimensions and its Attributes – Dimensions are objects or things. Dimensions categorize and describe data warehouse facts and measures in a way that supports meaningful answers to business questions. A data warehouse organizes descriptive attributes as columns in dimension tables. For Example, the data dimension may contain data like a year, month and weekday.  
Step-4: Identifying the Fact – The measurable data is held by the fact table. Most of the fact table rows are numerical values like price or cost per unit, etc.  
Step-5: Building of Schema – We implement the Dimension Model in this step. A schema is a database structure. There are two popular schemes: Star Schema and Snowflake Schema. 
krishna_97
gabaa406
Technical Scripter 2018
DBMS
DBMS
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
SQL | Views
CTE in SQL
Difference between DELETE, DROP and TRUNCATE
Third Normal Form (3NF)
Second Normal Form (2NF)
Data Preprocessing in Data Mining
Difference between SQL and NoSQL
SQL | GROUP BY
Difference between DDL and DML in DBMS
Indexing in Databases | Set 1
How to create a qqplot with confidence interval in R?

A qqplot is the plot of quantiles that helps to understand whether the supplied data comes from the specified distribution, mostly it is used to check whether the data follows normal distribution or not. If we want to create the qqplot with confidence interval then qqPlot function of car package can be used as shown in the below example.
Consider the below data frame −
 Live Demo
x<-rnorm(20,74,3.5)
y<-rnorm(20,50,2.25)
df<-data.frame(x,y)
df
       x      y
1  73.30956  51.31650
2  78.67091  51.01323
3  71.34887  46.93155
4  81.89449  51.54427
5  70.74800  55.81567
6  71.84334  50.74052
7  70.50627  50.35543
8  75.99494  48.10296
9  72.22310  50.42166
10 76.17660  47.82578
11 70.23273  45.80355
12 77.38643  47.50654
13 76.91476  51.83949
14 69.65716  48.11115
15 74.00487  52.76651
16 74.25146  53.72022
17 73.83530  50.83250
18 68.10708  50.85800
19 73.75495  50.37560
20 73.99065  52.60846
Loading car package and creating the qqplot with confidence interval −
library(car)
qqPlot(df$x)
[1] 4 18
Sort the words in lexicographical order in C#

Firstly, set a string array −
string[] arr = new string[] {
   "Indian",
   "Moroccon",
   "American",
};
To sort the words in lexicographical order −
var sort = from a in arr
orderby a
select a;
 Live Demo
Let us see the complete code −
using System;
using System.Linq;
class Program {
   static void Main() {

      string[] arr = new string[] {
         "Indian",
         "Moroccon",
         "American",
      };
      var sort = from a in arr
      orderby a
      select a;

      foreach(string res in sort) {
         Console.WriteLine(res);
      }
   }
}
American
Indian
Moroccon
C++ Program To Find Decimal Equivalent Of Binary Linked List - GeeksforGeeks

03 Jan, 2022
Given a singly linked list of 0s and 1s find its decimal equivalent.
Input: 0->0->0->1->1->0->0->1->0
Output: 50   

Input: 1->0->0
Output: 4
The decimal value of an empty linked list is considered as 0.
Initialize the result as 0. Traverse the linked list and for each node, multiply the result by 2 and add the node’s data to it.
C++
// C++ Program to find decimal value // of binary linked list #include <bits/stdc++.h>using namespace std;  // Link list Node class Node {     public:    bool data;     Node* next; };   /* Returns decimal value of binary    linked list */int decimalValue(Node *head) {     // Initialized result     int res = 0;       // Traverse linked list     while (head != NULL)     {         // Multiply result by 2 and         // add head's data         res = (res << 1) + head->data;           // Move next         head = head->next;     }     return res; }   // Utility function to create a // new node. Node *newNode(bool data) {     Node *temp = new Node;     temp->data = data;     temp->next = NULL;     return temp; }   // Driver codeint main() {     // Start with the empty list     Node* head = newNode(1);     head->next = newNode(0);     head->next->next = newNode(1);     head->next->next->next = newNode(1);    cout << "Decimal value is " <<              decimalValue(head);     return 0; } // This is code is contributed by rathbhupendra
Output : 
Decimal value is 11
Please refer complete article on Decimal Equivalent of Binary Linked List for more details!
Juniper Networks
C++ Programs
Linked List
Juniper Networks
Linked List
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Passing a function as a parameter in C++
Program to implement Singly Linked List in C++ using class
cout in C++
Pi(π) in C++ with Examples
Const keyword in C++
Linked List | Set 1 (Introduction)
Linked List | Set 2 (Inserting a node)
Reverse a linked list
Stack Data Structure (Introduction and Program)
Linked List | Set 3 (Deleting a node)
What is SimpleDateFormat in Java?

The java.text.SimpleDateFormat class is used to format and parse a string to date and date to string.
One of the constructors of this class accepts a String value representing the desired date format and creates SimpleDateFormat object. To parse/convert a string as a Date object
Instantiate this class by passing desired format string.
Parse the date string using the parse() method.
Live Demo
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
public class Sample {
   public static void main(String args[]) throws ParseException {  
      String date_string = "2007-25-06";
      //Instantiating the SimpleDateFormat class
      SimpleDateFormat formatter = new SimpleDateFormat("yyyy-dd-MM");      
      //Parsing the given String to Date object
      Date date = formatter.parse(date_string);      
      System.out.println("Date value: "+date);
   }
}
Date value: Mon Jun 25 00:00:00 IST 2007
The toPattern() method of this class returns the pattern string representing the format of the current object.
Live Demo
import java.text.ParseException;
import java.text.SimpleDateFormat;
public class Demo {
   public static void main(String args[]) throws ParseException {  
      SimpleDateFormat obj = new SimpleDateFormat();
      String pattern = obj.toPattern();
      System.out.println(pattern);
   }
}
M/d/yy h:mm a
The parse() method of this class accepts ParsePosition as a parameter along with date string and, parses date from a text.
Live Demo
import java.text.ParseException;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.Date;
public class Sample {
   public static void main(String args[]) throws ParseException {  
      String text = "Marriage date of Samrat is 2007-25-06";
      //Instantiating the SimpleDateFormat class
      SimpleDateFormat formatter = new SimpleDateFormat("yyyy-dd-MM");      
      //Parsing date from the given text
      ParsePosition pos = new ParsePosition(27);
      Date date = formatter.parse(text, pos);
      System.out.println("Date value: "+date);
   }
}
Date value: Mon Jun 25 00:00:00 IST 2007
Program to find Perimeter / Circumference of Square and Rectangle in C++

In this problem, we are given the side of a square (A) and the length and breadth of a rectangle (L and B). Our task is to create a Program to find Perimeter / Circumference of Square and Rectangle in C++.
To find the circumference of a square, we need the side of the square (a). For that, we will use the formula for the perimeter of the square which is 4a.
To find the circumference of a square, we need the side of the square (a). For that, we will use the formula for the perimeter of the square which is 4a.
To find the circumference of a rectangle, we need the Length (L) and breadth (B) of the rectangle. For that, we will use the formula for the perimeter of the rectangle which is 2(L+B).
To find the circumference of a rectangle, we need the Length (L) and breadth (B) of the rectangle. For that, we will use the formula for the perimeter of the rectangle which is 2(L+B).
Square is a four-sided closed figure that has all four sides equal and all angle 90 degrees.
Formula for perimeter / circumference of square = (4 * a)
Let’s take an example to understand the problem,
Input − 5
Output − 20
Input − 12
Output − 48
#include <iostream>
using namespace std;
int calcCircumference(int a){
   int perimeter = (4 * a);
   return perimeter;
}
int main() {
   int a = 6;
   cout<<"The Perimeter / Circumference of Square is
   "<<calcCircumference(a);
}
The Perimeter / Circumference of Square is 24
Square is a four-sided closed figure that has opposite sides equal and all angle 90 degrees.
Formula for perimeter/circumference of square = 2 * (l + b)
Let’s take an example to understand the problem,
Input − l = 7; b = 3
Output − 20
Input − l = 13; b = 6
Output − 38
#include <iostream>
using namespace std;
int calcCircumference(int l, int b){
   int perimeter = (2 * (l + b)); w =
   return perimeter;
}
int main() {
   int l = 8, b = 5;
   cout<<"The Perimeter / Circumference of Rectangle is
   "<<calcCircumference(l, b);
}
The Perimeter / Circumference of Rectangle is 26
Assign other value to a variable from two possible values in C++

we have to assign a variable the value of other variables from two possible values without using any conditional operator.
In this problem, we are given a variable let's say a which can have a value of any of the two variables x and y. Now, we have to create a program to assign the value of another than its current value without using any conditional operator i.e. we can’t check the value of x.
Let’s take an example to understand the problem better −
Input : a = 43 ; x = 43 and y = 21
Output : 21
Explanation − the initial value of a is 43 so we need to return the other value i.e. 21 as the final value of a.
Since we are not allowed to check the value of an i.e. use of any sort of conditional statement is not valid in the code. So, we need to see alternate solutions to the swap value of the variable. For this, there can be multiple solutions but we are discussing most feasible and easy once here −
One of the easy ways to swap value is to use addition/multiplication of the two values and subtract/divide for respective opposite operations i.e subtract if we have done addition and divide if used multiplication.
So, the formula becomes −
a = x + y - a or a = x * y / a
But here the multiply and divide operations are more costly and may sometimes throw errors. So, we have used addition - subtraction combo for this.
 Live Demo
#include <iostream>
using namespace std;
int main(){
   int x = 45;
   int y = 5;
   int a = x;
   cout<<"Initial value of a is : "<<a;
   a = x+y - a;
   cout<<"\nAfter changing the value of a is : "<<a;
}
Initial value of a is : 45
After changing the value of a is : 5
A more effective way could be using the bitwise XOR operator.
So, the value would be changed in the following manner −
a = x^y^a;
 Live Demo
#include <iostream>
using namespace std;
int main(){
   int x = 56;
   int y = 78;
   int a = x;
   cout<<"Initial value of a is : "<< a;
   a = x^y^a;
   cout<<"\nAfter changing the value of a is "<<a;
   return 0;
}
Initial value of a is : 56
After changing the value of a is 78
Extra brackets with function names in C/C++ - GeeksforGeeks

21 Jun, 2018
Consider below C program. The program has extra bracket around function name.
// C program to show that extra brackets with function// name work#include <stdio.h>  void (foo)(int n){   printf("Function : %d ", n);}  int main(){   (foo)(4);   return 0;  }
Output:
Function 4
So putting extra bracket with function name works in C/C++.
What can be use of it?One use could be, if we have a macro with same name as function, then extra brackets avoid macro expansion wherever we want the function to be called.
// C program to show that extra brackets with function// name can be useful if we have a macro with same name#include <stdio.h>#define foo(n)  printf("\nMacro : %d ", n);  void (foo)(int n){   printf("Function : %d ", n);}  int main(){   (foo)(4);   foo(4);   return 0;}
Output:
Function 4
Macro : 4
If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above
CPP-Functions
C Language
C++
CPP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
TCP Server-Client implementation in C
Exception Handling in C++
Multithreading in C
'this' pointer in C++
Arrow operator -> in C/C++ with Examples
Vector in C++ STL
Initialize a vector in C++ (6 different ways)
Inheritance in C++
Map in C++ Standard Template Library (STL)
C++ Classes and Objects
Fetch records in MongoDB on querying its subset

You can use $all operator. Let us first create a collection with documents −
> db.subsetOfAnArrayDemo.insertOne({"StudentProgrammingSkills":
   ["Java","MongoDB","MySQL","C++","Data Structure","Algorithm","Python","Oracle","SQL Server"]});
{
   "acknowledged" : true,
   "insertedId" : ObjectId("5cb9d1e1895c4fd159f80804")
}
Following is the query to display all documents from the collection with the help of find() method −
> db.subsetOfAnArrayDemo.find().pretty();
This will produce the following output −
{
   "_id" : ObjectId("5cb9d1e1895c4fd159f80804"),
   "StudentProgrammingSkills" : [
      "Java",
      "MongoDB",
      "MySQL",
      "C++",
      "Data Structure",
      "Algorithm",
      "Python",
      "Oracle",
      "SQL Server"
   ]
}
Following is the query to get the subset of an array −
> db.subsetOfAnArrayDemo.find({ StudentProgrammingSkills:
   { $all: [ 'MongoDB', 'MySQL' ] } } ).pretty();
This will produce the following output −
{
   "_id" : ObjectId("5cb9d1e1895c4fd159f80804"),
   "StudentProgrammingSkills" : [
      "Java",
      "MongoDB",
      "MySQL",
      "C++",
      "Data Structure",
      "Algorithm",
      "Python",
      "Oracle",
      "SQL Server"
   ]
}
Expressive words problem case in JavaScript

Sometimes people repeat letters to represent extra feeling, such as "hello" −> "heeellooo", "hi" −> "hiiii". In these strings like "heeellooo", we have groups of adjacent letters that are all the same: "h", "eee", "ll", "ooo".
For some given string S, a query word is stretchy if it can be made to be equal to S by any number of applications of the following extension operation: choose a group consisting of characters c, and add some number of characters c to the group so that the size of the group is
3 or more.
For example, starting with "hello", we could do an extension on the group "o" to get "hellooo", but we cannot get "helloo" since the group "oo" has size less than 3. Also, we could do another extension like "ll" −> "lllll" to get "helllllooo". If S = "helllllooo", then the query word "hello" would be stretchy because of these two extension operations: query = "hello" −> "hellooo" −> "helllllooo" = S.
Given a list of query words, we are required to return the number of words that are stretchy.
For example −
If the input string is −
const str = 'heeellooo';
And the list of words is −
const words = ["hello", "hi", "helo"];
And the output should be −
const output = 1
The code for this will be −
const str = 'heeellooo';
const words = ["hello", "hi", "helo"];
const extraWords = (str, words) => {
   let count = 0;
   for (let w of words) {
      let i = 0;
      let j = 0;
      for (; i < str.length && j < w.length && w[j] === str[i];) {
         let lenS = 1;
         let lenW = 1;
         for (; i+lenS < str.length && str[i+lenS] === str[i]; lenS++);
         for (; j+lenW < w.length && w[j+lenW] === w[j]; lenW++);
         if (lenS < lenW || lenS > lenW && lenS < 3) break;
         i += lenS;
         j += lenW;
      }
      if (i === str.length && j === w.length) {
         count++;
      }
   }
   return count;
}
console.log(extraWords(str, words));
And the output in the console will be −
1
Set the background color of an element with CSS

To set the background color of an element, use the background-color property.
You can try to run the following code to learn how to work with the background-color property:
<html>
   <head>
      <body>
         <p style = "background-color:blue;">
         This text has a blue background color.</p>
      </body>
   </head>
<html>
How to make loops run faster using Python?

This is a language agnostic question. Loops are there in almost every language and the same principles apply everywhere. You need to realize that compilers do most heavy lifting when it comes to loop optimization, but you as a programmer also need to keep your loops optimized.
It is important to realize that everything you put in a loop gets executed for every loop iteration. They key to optimizing loops is to minimize what they do. Even operations that appear to be very fast will take a long time if the repeated many times. Executing an operation that takes 1 microsecond a million times will take 1 second to complete.
Don't execute things like len(list) inside a loop or even in its starting condition.
a = [i for i in range(1000000)]
length = len(a)
for i in a:
   print(i - length)
is much much faster than
a = [i for i in range(1000000)]
for i in a:
   print(i - len(a))
You can also use techniques like Loop Unrolling(https://en.wikipedia.org/wiki/Loop_unrolling) which is loop transformation technique that attempts to optimize a program's execution speed at the expense of its binary size, which is an approach known as space-time tradeoff.
Using functions like map, filter, etc. instead of explicit for loops can also provide some performance improvements.
What is Modulus Operator (%) in JavaScript?

The Modulus operator (%) outputs the remainder of an integer division.
You can try to run the following code to learn how to work with Modulus (%) operator.
<html>
   <body>
      <script>
         var a = 33;
         var b = 10;

         document.write("a % b = ");
         result = a % b;
         document.write(result);
      </script>
   </body>
</html>
Hardware Protection and Type of Hardware Protection - GeeksforGeeks

31 May, 2021
In this article, we are going to learn about hardware protection and it’s the type. so first let’s see the type of hardware which is used in a computer system. we know that a computer system contains the hardware like processor, monitor, RAM and many more, and one thing that the operating system ensures that these devices can not directly accessible by the user. 
Basically, hardware protection is divided into 3 categories: CPU protection, Memory Protection, and I/O protection. These are explained as following below. 
 1. CPU Protection: CPU protection is referred to as we can not give CPU to a process forever, it should be for some limited time otherwise other processes will not get the chance to execute the process. So for that, a timer is used to get over from this situation. which is basically give a certain amount of time a process and after the timer execution a signal will be sent to the process to leave the CPU. hence process will not hold CPU for more time. 
2. Memory Protection: In memory protection, we are talking about that situation when two or more processes are in memory and one process may access the other process memory. and to prevent this situation we are using two registers as: 
1. Bare register
2. Limit register 
So basically Bare register store the starting address of program and limit register store the size of the process, so when a process wants to access the memory then it is checked that it can access or can not access the memory.  
3. I/O Protection: So when we’re ensuring the I/O protection then some cases will never have occurred in the system as: 
Termination I/O of other processView I/O of other processGiving priority to a particular process I/O
Termination I/O of other process
View I/O of other process
Giving priority to a particular process I/O
kshgupta99
Computer Organization & Architecture
Operating Systems
Operating Systems
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Logical and Physical Address in Operating System
Memory Hierarchy Design and its Characteristics
Architecture of 8086
Programmable peripheral interface 8255
Computer Organization and Architecture | Pipelining | Set 1 (Execution, Stages and Throughput)
Banker's Algorithm in Operating System
Page Replacement Algorithms in Operating Systems
Program for FCFS CPU Scheduling | Set 1
Program for Round Robin scheduling | Set 1
Program for Shortest Job First (or SJF) CPU Scheduling | Set 1 (Non- preemptive)
SequenceMatcher in Python for Longest Common Substring - GeeksforGeeks

11 Dec, 2017
Given two strings ‘X’ and ‘Y’, print the longest common sub-string.
Examples:
Input :  X = "GeeksforGeeks", 
         Y = "GeeksQuiz"
Output : Geeks

Input : X = "zxabcdezy", 
        Y = "yzabcdezx"
Output : abcdez

We have existing solution for this problem please refer Print the longest common substring link. We will solve problem in python using SequenceMatcher.find_longest_match() method.
First we initialize SequenceMatcher object with two input string str1 and str2, find_longest_match(aLow,aHigh,bLow,bHigh) takes 4 parameters aLow, bLow are start index of first and second string respectively and aHigh, bHigh are length of first and second string respectively. find_longest_match() returns named tuple (i, j, k) such that a[i:i+k] is equal to b[j:j+k], if no blocks match, this returns (aLow, bLow, 0).
# Function to find Longest Common Sub-string  from difflib import SequenceMatcher  def longestSubstring(str1,str2):       # initialize SequenceMatcher object with      # input string     seqMatch = SequenceMatcher(None,str1,str2)       # find match of longest sub-string     # output will be like Match(a=0, b=0, size=5)     match = seqMatch.find_longest_match(0, len(str1), 0, len(str2))       # print longest substring     if (match.size!=0):          print (str1[match.a: match.a + match.size])      else:          print ('No longest common sub-string found')  # Driver programif __name__ == "__main__":    str1 = 'GeeksforGeeks'    str2 = 'GeeksQuiz'    longestSubstring(str1,str2)
Output:
Geeks

python-string
Python
Strings
Strings
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Python Dictionary
Read a file line by line in Python
Enumerate() in Python
How to Install PIP on Windows ?
Iterate over a list in Python
Reverse a string in Java
Write a program to reverse an array or string
Write a program to print all permutations of a given string
C++ Data Types
Python program to check if a string is palindrome or not
How to Execute a Script in SQLite using Python? - GeeksforGeeks

09 May, 2021
In this article, we are going to see how to execute a script in SQLite using Python. Here we are executing create table and insert records into table scripts through Python. In Python, the sqlite3 module supports SQLite database for storing the data in the database.
Step 1: First we need to import the sqlite3 module in Python.
import sqlite3
Step 2: Connect to the database by creating the database. We can connect to the database by simply create a database named geeks_db.db or we can simply create a database in our memory by using :memory:
Database creation by name
connection_object = sqlite3.connect(“database_name.db”)
Database creation in Memory:
connection_object = sqlite3.connect:memory:)
Step 3: Create the cursor object after making the database connection.
cursor_object = connection_object.cursor()
Step 4: Write the SQL query that can be executable.
cursor_object.executescript(“script”)
Step 5: Execute the cursor object
cursor_object(“sql statement”)
Step 6: Get the data inside the table from the database.
cursor_object.fetchall()
Example 1:
Python3
# import sqlite3 moduleimport sqlite3  # create con object to connect # the database geeks_db.dbcon = sqlite3.connect("geeks_db.db")  # create the cursor objectcur = con.cursor()  # execute the script by creating the # table named geeks_demo and insert the datacur.executescript("""    create table geeks_demo(        geek_id,        geek_name    );   insert into geeks_demo values ( '7058', 'sravan kumar' );   insert into geeks_demo values ( '7059', 'Jyothika' );   insert into geeks_demo values ( '7072', 'Harsha' );   insert into geeks_demo values ( '7075', 'Deepika' );          """)  # display the data in the table by # executing the cursor objectcur.execute("SELECT * from geeks_demo")  # fetch all the dataprint(cur.fetchall())
Output:
Example 2:
Python3
# import sqlite3 moduleimport sqlite3  # create con object to connect # the database geeks_db.dbcon = sqlite3.connect("geeks_db.db")  # create the cursor objectcur = con.cursor()  # execute the script by creating the table# named geeks1 and insert the datacur.executescript("""    create table geeks1(        geek_id,        geek_name,        address    );   insert into geeks1 values ( '7058', 'sravan kumar','hyd' );   insert into geeks1 values ( '7059', 'Jyothika' ,'ponnur' );   insert into geeks1 values ( '7072', 'Harsha','chebrolu'  );   insert into geeks1 values ( '7075', 'Deepika','tenali'  );          """)  # display the data in the table by # executing the cursor objectcur.execute("SELECT * from geeks1")  # fetch all the dataprint(cur.fetchall())
Output:
Picked
Python-SQLite
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
How To Convert Python Dictionary To JSON?
Check if element exists in list in Python
How to drop one or multiple columns in Pandas Dataframe
Python Classes and Objects
Python | os.path.join() method
Create a directory in Python
Python | Get unique values from a list
Python | Pandas dataframe.groupby()
Defaultdict in Python
HTML <object> vspace Attribute - GeeksforGeeks

14 Dec, 2021
The HTML <object> vspace Attribute is used to specify the number of whitespace on the bottom and top side of an object.
Syntax:  
<object vspace="pixels"> 
Attribute:
pixels: It specifies the number of whitespaces on the top and bottom of an object in terms of pixels.
Note: The <object> vspace Attribute is not supported in HTML 5. Use CSS margin property instead of this attribute.
Below examples illustrate the <object> vspace attribute in HTML:Example 1: In this example the object with 50px margin on top and bottom.
html
<!DOCTYPE html><html>   <head>    <title>        HTML object vspace Attribute    </title></head>   <body>    <center>           <h1 style="color:green">GeeksforGeeks</h1>        <h4>             HTML <object> vspace Attribute         </h4>        <br>           <object data="https://www.geeksforgeeks.org/wp-content/uploads/Geek_logi_-low_res.png"                width="350px" height="150px" vspace=50>            GeeksforGeeks        </object>    </center></body>   </html>
Output:  
Example 2:  
html
<!DOCTYPE html><html>  <head>    <title>        HTML object vspace Attribute    </title></head>  <body>    <center>          <h1 style="color:green">GeeksforGeeks</h1>        <h4>             HTML <object> vspace Attribute         </h4>        <h4>Object without vspace:</h4>        <object data="https://media.geeksforgeeks.org/wp-content/uploads/20190822082748/child.png"                width="50%" height="150px">            GeeksforGeeks        </object>          <h4>Object with 25 vspace:</h4>        <object data="https://media.geeksforgeeks.org/wp-content/uploads/20190822082748/child.png"                 width="50%" height="150px" vspace="25">            GeeksforGeeks        </object>    </center>  </body>  </html>
Output:
Supported Browsers: The browsers supported by HTML <Object> vspace attribute are listed below:  
Google Chrome
Internet Explorer
Firefox
Opera
Safari
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.
shubham_singh
arorakashish0911
hritikbhatnagar2182
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)
HTML Cheat Sheet - A Basic Guide to HTML
Design a web page using HTML and CSS
Form validation using jQuery
Angular File Upload
Remove elements from a JavaScript Array
Installation of Node.js on Linux
Convert a string to an integer in JavaScript
How to fetch data from an API in ReactJS ?
Difference between var, let and const keywords in JavaScript
How to use GET method to send data in jQuery Ajax?

The jQuery.get( url, [data], [callback], [type] ) method loads data from the server using a GET HTTP request.
Here is the description of all the parameters used by this method −
url − A string containing the URL to which the request is sent
data − This optional parameter represents key/value pairs that will be sent to the server.
callback − This optional parameter represents a function to be executed whenever the data is loaded successfully.
type − This optional parameter represents type of data to be returned to callback function: "xml", "html", "script", "json", "jsonp", or "text".
Assuming we have the following PHP content in result.php file −
<?php
if( $_REQUEST["name"] ) {

   $name = $_REQUEST['name'];
   echo "Welcome ". $name;
}
?>
Here's the code snippet to implement GET method in jQuery −
   <head>
      <title>The jQuery Example</title>
      <script src = "https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
       
      <script>
         $(document).ready(function() {
           
            $("#driver").click(function(event){
               $.get(
                  "result.php",
                  { name: "Zara" },
                  function(data) {
                     $('#stage').html(data);
                  }
               );
            });
               
         });
      </script>    
   </head>
   
   <body>
   
      <p>Click on the button to load result.html file −</p>
       
      <span id = "stage" style = "background-color:#cc0;">
         STAGE
      </span>
       
      <div><input type = "button" id = "driver"
         value = "Load Data" /></div>
   
   </body>
C# - Infinite Loop - GeeksforGeeks

21 Jul, 2021
Infinite Loop is a loop that never terminates or ends and repeats indefinitely. Or in other words, an infinite loop is a loop in which the test condition does not evaluate to false and the loop continues forever until an external force is used to end it. You can create an infinite loop:
Using for loop
Using while loop
Example 1:
In this example, we are using a while loop to create an infinite loop by setting the condition to true. It will make while loop to never evaluates to false and the loop repeats indefinitely.
C#
// C# program to illustrate// infinite loopusing System; class GFG{     static public void Main (){         // Creating infinite loop    // using while loop    while (true)    {                 // This statement will be printed        // infinite times        Console.WriteLine("Hey! GeeksforGeeks");    }}}
  Output:
Hey! GeeksforGeeks
Hey! GeeksforGeeks
Hey! GeeksforGeeks
Hey! GeeksforGeeks
Hey! GeeksforGeeks
Hey! GeeksforGeeks
Hey! GeeksforGeeks
Hey! GeeksforGeeks
Hey! GeeksforGeeks
.........
 
Example 2:
In this example, we are using for loop to create an infinite loop.
C#
// C# program to illustrate// infinite loopusing System; class GFG{     public static void Main(){         // Creating infinite loop    // Using for loop    for(;;)         // This statement will be printed    // infinite times    Console.WriteLine("Welcome GFG!!");}}
Output:
Welcome GFG!!
Welcome GFG!!
Welcome GFG!!
Welcome GFG!!
Welcome GFG!!
Welcome GFG!!
Welcome GFG!!
Welcome GFG!!
........
kapoorsagar226
anikakapoor
C#
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Extension Method in C#
HashSet in C# with Examples
C# | Inheritance
Partial Classes in C#
C# | Generics - Introduction
Top 50 C# Interview Questions & Answers
Switch Statement in C#
C# | How to insert an element in an Array?
Convert String to Character Array in C#
Lambda Expressions in C#
Get contents of a Tkinter Entry widget

An Entry widget is a basic one-line character widget that supports only single-line text input. An Entry widget can be defined by initializing the Entry(parent, width) constructor.
To validate the Entry widget, we can use the get() method which results in the character entered in the Entry widget.
Let us define an Entry widget that accepts single-line text input, and we will print the character that is input in the Entry widget.
#Import the required Libraries
from tkinter import *
from tkinter import ttk

#Create an instance of Tkinter frame
win = Tk()

#Set the geometry of Tkinter frame
win.geometry("750x250")
def get_content():
   #Get the content of Entry Widget
   print(entry.get())

#Create an entry widget
entry= Entry(win, width= 40)
entry.pack(pady= 20)

#Create a button to validate the entry widget
button= ttk.Button(win, text= "Get Content", command= get_content)
button.pack(pady=10)

win.mainloop()
Running the above code will display a window that will contain an Entry widget and a button to get the content of the Entry widget.
Now click the "Get Content" Button to print the Content of Entry Widget. Once we click the Button, it will print the output as,
Hello World!
How to clone an ArrayList to another ArrayList in Java? - GeeksforGeeks

08 Dec, 2020
The clone() method of the ArrayList class is used to clone an ArrayList to another ArrayList in Java as it returns a shallow copy of its caller ArrayList. 
Syntax:
public Object clone();
Return Value: This function returns a copy of the instance of Object.
Below program illustrate the Java.util.ArrayList.clone() method:
Example:
Java
// Java program to clone an ArrayList to another ArrayList  import java.util.ArrayList;public class GFG {      public static void main(String a[])    {          // create ArrayList        ArrayList<String> ArrList1            = new ArrayList<String>();          // Insert elements in ArrayList        ArrList1.add("Mukul");        ArrList1.add("Rahul");        ArrList1.add("Suraj");        ArrList1.add("Mayank");          // print ArrayList1        System.out.println("Original ArrayList = "                           + ArrList1);          // clone ArrayList        ArrayList ArrList2            = (ArrayList)ArrList1.clone();          // print ArrayList2        System.out.println("Clone ArrayList2 = "                           + ArrList2);    }}
Original ArrayList = [Mukul, Rahul, Suraj, Mayank]
Clone ArrayList2 = [Mukul, Rahul, Suraj, Mayank]
Example 2:
Java
// Java code to illustrate clone() method  import java.io.*;import java.util.*;  public class ArrayListDemo {      public static void main(String args[])    {          // Creating an empty ArrayList        ArrayList<Integer> list = new ArrayList<Integer>();          // Use add() method        // to add elements in the list        list.add(16);        list.add(32);        list.add(48);          // Displaying the list        System.out.println("First ArrayList: " + list);          // Creating another linked list and copying        // creates a shallow copy        ArrayList<Integer> sec_list            = (ArrayList<Integer>)list.clone();          sec_list.add(64);          // Displaying the list        System.out.println("First ArrayList: " + list);                  // Displaying the other linked list        System.out.println("Second ArrayList is: "                           + sec_list);    }}
Output
First ArrayList: [16, 32, 48]
First ArrayList: [16, 32, 48]
Second ArrayList is: [16, 32, 48, 64]
Java-ArrayList
Picked
Technical Scripter 2020
Java
Java Programs
Technical Scripter
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
HashMap in Java with Examples
Interfaces in Java
Initialize an ArrayList in Java
Multidimensional Arrays in Java
Stack Class in Java
Convert a String to Character array in Java
Initializing a List in Java
Java Programming Examples
Convert Double to Integer in Java
How to Iterate HashMap in Java?
Enumerable.Repeat method in C#

Enumerable.Repeat method is part of System.Linq namespace.
It returns a collection with repeated elements in C#.
Firstly, set which element you want to repeat and how many times.
As an example, let us see how to repeat number 10, five times −
Enumerable.Repeat(10, 5);
The following is the complete example −
 Live Demo
using System;
using System.Linq;
class Demo {
   static void Main() {
      var val = Enumerable.Repeat(10, 5);
      foreach (int res in val) {
         Console.WriteLine(res);
      }
   }
}
10
10
10
10
10
Find the siblings of tags using BeautifulSoup

03 Mar, 2021
Prerequisite: BeautifulSoup
BeautifulSoup(bs4) is a Python library for pulling data out of HTML and XML files. This module does not come in built-in with Python. To install this type the below command in the terminal. In this article, we will learn about siblings in HTML tags using BeautifulSoup.
Here we will discuss these four sibling properties:
previous_sibling is used to find the previous element of the given element
next_sibling is used to find the next element of the given element
previous_siblings is used to find all previous element of the given element
next_siblings is used to find all next element of the given element
Approach
Import module
Load or create HTML code
Parse HTML code
Print required sibling.
Example 1: To print next immediate sibling
Python3
# Import Modulefrom bs4 import BeautifulSoup  # HTML CODEhtml_code = """<a><b>text1</b><c>text2</c></a>"""  # Parse HTML CODEsoup = BeautifulSoup(html_code, 'html.parser')  # next elementprint(soup.b.next_sibling)
Output:
<c>text2</c>
Example 2: To get previous immediate sibling
Python3
# Import Modulefrom bs4 import BeautifulSoup  # HTML CODEhtml_code = """<a><b>text1</b><c>text2</c></a>"""  # Parse HTML CODEsoup = BeautifulSoup(html_code, 'html.parser')  # previous elementprint(soup.c.previous_sibling)
Output:
<b>text1</b>
Suppose we want to find all the next elements of a tag. For that, we just simply iterate through siblings and print the required tag.
Example 3: To get all siblings next to the tag
Python3
# Import Modulefrom bs4 import BeautifulSoup  # HTML CODEhtml_code = """<a><b>text1</b><d>text3</d><c>text2</c></a>"""  # Parse HTML CODEsoup = BeautifulSoup(html_code, 'html.parser')  # next elementfor element in soup.b.next_siblings:    print(element)
Output:
<d>text3</d>
<c>text2</c>
Example 4: To get all previous siblings
Python3
# Import Modulefrom bs4 import BeautifulSoup  # HTML CODEhtml_code = """<a><b>text1</b><d>text3</d><c>text2</c></a>"""  # Parse HTML CODEsoup = BeautifulSoup(html_code, 'html.parser')  # previous elementfor element in soup.c.previous_siblings:    print(element)
Output:
<d>text3</d>
<b>text1</b>
Picked
Python BeautifulSoup
Python bs4-Exercises
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to change a primary key in MySQL to auto_increment?


To change a primary key to auto_increment, you can use MODIFY command. Let us first create a table.
mysql> create table changePrimaryKeyInAutoIncrement
   -> (
   -> StudentId int not null primary key,
   -> StudentName varchar(100),
   -> StudentAge int,
   -> StudentAddress varchar(100)
   -> );
Query OK, 0 rows affected (0.63 sec)
Let us now check the description of table using desc command:
mysql> desc changePrimaryKeyInAutoIncrement;
This will produce the following output
+----------------+--------------+------+-----+---------+-------+
| Field          | Type         | Null | Key | Default | Extra |
+----------------+--------------+------+-----+---------+-------+
| StudentId      | int(11)      | NO   | PRI | NULL    |       |
| StudentName    | varchar(100) | YES  |     | NULL    |       |
| StudentAge     | int(11)      | YES  |     | NULL    |       |
| StudentAddress | varchar(100) | YES  |     | NULL    |       |
+----------------+--------------+------+-----+---------+-------+
4 rows in set (0.00 sec)
Look at the above sample output, StudentId column is a primary key. Now let us change the primary key to auto_increment:
mysql> alter table changePrimaryKeyInAutoIncrement MODIFY StudentId INT AUTO_INCREMENT;
Query OK, 0 rows affected (1.48 sec)
Records: 0 Duplicates: 0 Warnings: 0
Let us check the table description of once again:
mysql> desc changePrimaryKeyInAutoIncrement;
This will produce the following output
+----------------+--------------+------+-----+---------+----------------+
| Field          | Type         | Null | Key | Default | Extra          |
+----------------+--------------+------+-----+---------+----------------+
| StudentId      | int(11)      | NO   | PRI | NULL    | auto_increment |
| StudentName    | varchar(100) | YES  |     | NULL    |                |
| StudentAge     | int(11)      | YES  |     | NULL    |                |
| StudentAddress | varchar(100) | YES  |     | NULL    |                |
+----------------+--------------+------+-----+---------+----------------+
4 rows in set (0.00 sec)
Look at the above sample output, StudentId column has been changed to auto_increment.
Python script to get device vendor name from MAC Address

29 Dec, 2020
Prerequisite: Python Requests
A MAC address is a unique identity of a network interface that is used to address the device in a Computer Network.
A MAC address is made up of 12 hexadecimal digits, 6 octets separated by ‘:’. There are 6 octets in a MAC address. In the first half, the manufacturer info is stored.
For this article, we will be using an API that will fetch the MAC Address for us. We will use a Python script to automate the fetching process so that we can use it later in the Softwares and websites that may require this functionality.
We will use requests module to work with this API.
Below is the implementation.
Python3
import requestsimport argparse  print("[*] Welcome")  # Function to get the interface namedef get_arguments():        # This will give user a neat CLI    parser = argparse.ArgumentParser()          # We need the MAC address    parser.add_argument("-m", "--macaddress",                        dest="mac_address",                        help="MAC Address of the device. "                        )    options = parser.parse_args()          # Check if address was given    if options.mac_address:        return options.mac_address    else:        parser.error("[!] Invalid Syntax. "                     "Use --help for more details.")    def get_mac_details(mac_address):          # We will use an API to get the vendor details    url = "https://api.macvendors.com/"          # Use get method to fetch details    response = requests.get(url+mac_address)    if response.status_code != 200:        raise Exception("[!] Invalid MAC Address!")    return response.content.decode()  # Driver Codeif __name__ == "__main__":    mac_address = get_arguments()    print("[+] Checking Details...")          try:        vendor_name = get_mac_details(mac_address)        print("[+] Device vendor is "+vendor_name)    except:                # Incase something goes wrong        print("[!] An error occured. Check "              "your Internet connection.")
Save this code as macdetails.py. We can use ‘-h’ or ‘–help’ to see the help on how to run this script from the terminal.
Output : 
Python web-scraping-exercises
Python-projects
Python-requests
python-utility
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
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
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
Python | Get unique values from a list
Python | datetime.timedelta() function