code-rag-bench/online-tutorials huggingface dataset:
Vue.js | v-text directive

25 Jun, 2020
The v-text directive is a Vue.js directive used to update a element’s textContent with our data. It is just a nice alternative to Mustache syntax. First, we will create a div element with id as app and let’s apply the v-text directive to this element with data as a message. Now we will create this message by initializing a Vue instance the data attribute containing our message.
Syntax: 
v-text="data"

Parameters: This directive accepts a single parameter which is the data.Example: This example uses VueJS to update the text of a element with v-text. 
HTML
<!DOCTYPE html><html>  <head>    <title>        VueJS | v-text directive    </title>      <!-- Load Vuejs -->    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js">    </script>    </script></head>  <body>    <div style="text-align: center;width: 600px;">        <h1 style="color: green;">            GeeksforGeeks        </h1>        <b>            VueJS | v-text directive        </b>    </div>      <div id="canvas" style="border:1px solid #000000;                            width: 600px;height: 200px;">        <div v-text="message" id="app">        </div>    </div>      <script>        var app = new Vue({            el: '#app',            data: {                message: 'Hello this is GeeksforGeeks.'            }        })    </script></body>  </html>                    
Output: 
Vue.JS
JavaScript
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Difference between var, let and const keywords in JavaScript
Differences between Functional Components and Class Components in React
Remove elements from a JavaScript Array
Roadmap to Learn JavaScript For Beginners
Difference Between PUT and PATCH Request
Installation of Node.js on Linux
Top 10 Projects For Beginners To Practice HTML and CSS Skills
Difference between var, let and const keywords in JavaScript
How to insert spaces/tabs in text using HTML/CSS?
How to fetch data from an API in ReactJS ?
Convert a Roman Number to Decimal using Hashmap in Java

30 Mar, 2022
Given a Roman numeral, the task is to find the corresponding decimal value.
Note: Roman numerals are represented by seven different symbols: I, V, X, L, C, D, and M.
Examples:
Input: “III”
Output: 3
Input: “MDCCLX”
Output: 1760
Approach:
Loop through each character in the string containing the Roman numerals.Compare the value of the current roman symbol with the value of the roman symbol to its right. If the current value is greater than or equal to the value of the symbol to the right, add the current symbol’s value to the total. If the current value is smaller than the value of the symbol to the right, subtract the current symbol’s value from the total.
Loop through each character in the string containing the Roman numerals.
Compare the value of the current roman symbol with the value of the roman symbol to its right. If the current value is greater than or equal to the value of the symbol to the right, add the current symbol’s value to the total. If the current value is smaller than the value of the symbol to the right, subtract the current symbol’s value from the total.
Below is the implementation of the above approach:
Java
// Java Program to Convert a Roman// Number to Decimal using Hashmapimport java.io.*;import java.util.Scanner;import java.util.HashMap;class solution {    int romanToInt(String s)    {        // Create a empty hash map.        HashMap<Character, Integer> map = new HashMap<>();         // Putting value in hash map.        map.put('I', 1);        map.put('V', 5);        map.put('X', 10);        map.put('L', 50);        map.put('C', 100);        map.put('D', 500);        map.put('M', 1000);         // Creating integer variable to store result.        int result = 0;         // initialize loop to iterate in string.        for (int i = 0; i < s.length(); i++) {             // Checking that current element            // is not smaller then previous            if (i > 0                && map.get(s.charAt(i))                       > map.get(s.charAt(i - 1))) {                result += map.get(s.charAt(i))                          - 2 * map.get(s.charAt(i - 1));            }            else {                result += map.get(s.charAt(i));            }        }        // Returning the integer value of Roman number.        return result;    }}public class GFG {     public static void main(String[] args)    {        String s;               // Scanner sc = new Scanner(System.in);        // s = sc.nextLine();        solution gfg = new solution();        System.out.println(gfg.romanToInt("MDCCLX"));    }}
Output:
1760
Time Complexity: O(N)
Auxiliary Space: O(1)
rohitsingh07052
Java-HashMap
Java
Java Programs
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Stream In Java
Introduction to Java
Constructors in Java
Exceptions in Java
Generics in Java
Java Programming Examples
Convert Double to Integer in Java
Implementing a Linked List in Java using Class
Factory method design pattern in Java
Java Program to Remove Duplicate Elements From the Array
Requests - File Upload

In this chapter, we will upload a file using request and read the contents of the file uploaded. We can do it using the files param as shown in the example below.
We will use the http://httpbin.org/post to upload the file.
import requests
myurl = 'https://httpbin.org/post'
files = {'file': open('test.txt', 'rb')}
getdata = requests.post(myurl, files=files)
print(getdata.text)  
File upload test using Requests

E:\prequests>python makeRequest.py
{
   "args": {},
   "data": "",
   "files": {
      "file": "File upload test using Requests"
   },
   "form": {},
   "headers": {
      "Accept": "*/*",
      "Accept-Encoding": "gzip, deflate",
      "Content-Length": "175",
      "Content-Type": "multipart/form-data; 
      boundary=28aee3a9d15a3571fb80d4d2a94bfd33",
      "Host": "httpbin.org",
      "User-Agent": "python-requests/2.22.0"
   },
   "json": null,
   "origin": "117.223.63.135, 117.223.63.135",
   "url": "https://httpbin.org/post"
}

It is also possible to send the contents of the file as shown below−
import requests
myurl = 'https://httpbin.org/post'
files = {'file': ('test1.txt', 'Welcome to TutorialsPoint')}
getdata = requests.post(myurl, files=files)
print(getdata.text)
E:\prequests>python makeRequest.py
{
   "args": {},
   "data": "",
   "files": {
      "file": "Welcome to TutorialsPoint"
   },
   "form": {},
   "headers": {
      "Accept": "*/*",
      "Accept-Encoding": "gzip, deflate",
      "Content-Length": "170",
      "Content-Type": "multipart/form-data; 
      boundary=f2837238286fe40e32080aa7e172be4f",
      "Host": "httpbin.org",
      "User-Agent": "python-requests/2.22.0"
   },
   "json": null,
   "origin": "117.223.63.135, 117.223.63.135",
SQL | Union Clause

02 Sep, 2019
The Union Clause is used to combine two separate select statements and produce the result set as a union of both the select statements.NOTE:
The fields to be used in both the select statements must be in same order, same number and same data type.The Union clause produces distinct values in the result set, to fetch the duplicate values too UNION ALL must be used instead of just UNION.
The fields to be used in both the select statements must be in same order, same number and same data type.
The Union clause produces distinct values in the result set, to fetch the duplicate values too UNION ALL must be used instead of just UNION.
Basic Syntax:
SELECT column_name(s) FROM table1 UNION SELECT column_name(s) FROM table2;

Resultant set consists of distinct values.

SELECT column_name(s) FROM table1 UNION ALL SELECT column_name(s) FROM table2;

Resultant set consists of duplicate values too.

Queries
To fetch distinct ROLL_NO from Student and Student_Details table.SELECT ROLL_NO FROM Student UNION SELECT ROLL_NO FROM Student_Details; 
Output:ROLL_NO1234 
SELECT ROLL_NO FROM Student UNION SELECT ROLL_NO FROM Student_Details; 

Output:
 
To fetch ROLL_NO from Student and Student_Details table including duplicate values.SELECT ROLL_NO FROM Student UNION ALL SELECT ROLL_NO FROM Student_Details; 
Output:ROLL_NO123432
SELECT ROLL_NO FROM Student UNION ALL SELECT ROLL_NO FROM Student_Details; 

Output:
To fetch ROLL_NO , NAME from Student table WHERE ROLL_NO is greater than 3 and ROLL_NO , Branch from Student_Details table WHERE ROLL_NO is less than 3 , including duplicate values and finally sorting the data by ROLL_NO.SELECT ROLL_NO,NAME FROM Student WHERE ROLL_NO>3 
UNION ALL
SELECT ROLL_NO,Branch FROM Student_Details WHERE ROLL_NO<3
ORDER BY 1; 

Note:The column names in both the select statements can be different but the
 data type must be same.And in the result set the name of column used in the first
 select statement will appear. 
Output:ROLL_NONAME1Information Technology2Computer Science4SURESH
SELECT ROLL_NO,NAME FROM Student WHERE ROLL_NO>3 
UNION ALL
SELECT ROLL_NO,Branch FROM Student_Details WHERE ROLL_NO<3
ORDER BY 1; 

Note:The column names in both the select statements can be different but the
 data type must be same.And in the result set the name of column used in the first
 select statement will appear. 

Output:
This article is contributed by Pratik Agarwal. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
SaranshSharma
SQL-Clauses-Operators
Articles
DBMS
SQL
DBMS
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Kth Smallest Element in a Sorted Matrix in Python

Suppose we have a n x n matrix where each of the rows and columns are sorted in increasing order, we have to find the kth smallest element in the matrix. Note that it is the kth smallest element in the sorted order, not the kth unique element. So if the input is like [[1,5,9],[10,11,13],[12,13,15]], if k = 8, then the output will be 13.
To solve this, we will follow these steps −
define one method called checkVal() and the arguments are matrix and value
i := 0, j := length of matrix[0] – 1, counter := 0
while i < length of matrix and j >= 0if matrix[i, j] > value, then decrease j by 1, otherwise counter := counter + j + 1, increase i by 1
if matrix[i, j] > value, then decrease j by 1, otherwise counter := counter + j + 1, increase i by 1
return counter
the main method will be like −
n := row of matrix, high := bottom right corner element, low := top left corner element
while low <= high, domid = low + (high – low)/2count := checkVal(matrix, mid)if count < k, then low := mid + 1, otherwise high := mid – 1
mid = low + (high – low)/2
count := checkVal(matrix, mid)
if count < k, then low := mid + 1, otherwise high := mid – 1
return low
Let us see the following implementation to get better understanding −
 Live Demo
class Solution(object):
   def kthSmallest(self, matrix, k):
      """
      :type matrix: List[List[int]]
      :type k: int
      :rtype: int
      """
      n = len(matrix)
      high = matrix[n-1][n-1]
      low = matrix[0][0]
      while low<=high:
         mid = low + (high - low) /2
         count = self.check_value(matrix,mid)
         if count< k:
            low = mid+1
         else :
            high = mid-1
      return int(low)
   def check_value(self, matrix, value):
      i = 0
      j = len(matrix[0])-1
      counter = 0
      while(i<len(matrix) and j >=0):
         if matrix[i][j] > value:
            j-=1
         else:
            counter+=j+1
            i+=1
      return counter
matrix = [[1,5,9],[10,11,13],[12,13,15]]
ob = Solution()
print(ob.kthSmallest(matrix, 8))
matrix =[[1,5,9],[10,11,13],[12,13,15]]
k = 8
13
How to select only non - numeric values from varchar column in MySQL?

You need to use REGEXP for this. The syntax is as follows
SELECT *FROM yourTableName WHERE yourColumnName REGEXP '[a-zA-Z]';
To understand the concept, let us create a table. The query to create a table is as follows
mysql> create table SelectNonNumericValue
   -> (
   -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,
   -> UserId varchar(100)
   -> );
Query OK, 0 rows affected (0.58 sec)
Insert some records in the table using insert command. The query is as follows
mysql> insert into SelectNonNumericValue(UserId) values('123John');
Query OK, 1 row affected (0.12 sec)
mysql> insert into SelectNonNumericValue(UserId) values('58475Carol98457Taylor24');
Query OK, 1 row affected (0.52 sec)
mysql> insert into SelectNonNumericValue(UserId) values('199575Sam124');
Query OK, 1 row affected (0.14 sec)
mysql> insert into SelectNonNumericValue(UserId) values('Mike2456');
Query OK, 1 row affected (0.14 sec)
mysql> insert into SelectNonNumericValue(UserId) values('1000');
Query OK, 1 row affected (0.12 sec)
mysql> insert into SelectNonNumericValue(UserId) values('1001');
Query OK, 1 row affected (0.21 sec)
mysql> insert into SelectNonNumericValue(UserId) values('10293Bob');
Query OK, 1 row affected (0.13 sec)
mysql> insert into SelectNonNumericValue(UserId) values('David');
Query OK, 1 row affected (0.30 sec)
mysql> insert into SelectNonNumericValue(UserId) values('2456');
Query OK, 1 row affected (0.15 sec)
Display all records from the table using a select statement. The query is as follows
mysql> select *from SelectNonNumericValue;
The following is the output
+----+-------------------------+
| Id | UserId                  |
+----+-------------------------+
| 1 | 123John                  |
| 2 | 58475Carol98457Taylor24  |
| 3 | 199575Sam124             |
| 4 | Mike2456                 |
| 5 | 1000                     |
| 6 | 1001                     |
| 7 | 10293Bob                 |
| 8 | David                    |
| 9 | 2456                     |
+----+-------------------------+
9 rows in set (0.00 sec)
Here is the query to select non-numeric values
mysql> select *from SelectNonNumericValue WHERE UserId REGEXP '[a-zA-Z]';
The following is the output that ignores the numeric values
+----+-------------------------+
| Id | UserId                  |
+----+-------------------------+
| 1 | 123John                  |
| 2 | 58475Carol98457Taylor24  |
| 3 | 199575Sam124             |
| 4 | Mike2456                 |
| 7 | 10293Bob                 |
| 8 | David                    |
+----+-------------------------+
6 rows in set (0.00 sec)
How to Fix: KeyError in Pandas

28 Nov, 2021
In this article, we will discuss how to fix the KeyError in pandas. Pandas KeyError occurs when we try to access some column/row label in our DataFrame that doesn’t exist. Usually, this error occurs when you misspell a column/row name or include an unwanted space before or after the column/row name.
The link to dataset used is here
Example
Python3
# importing pandas as pdimport pandas as pd  # using .read_csv method to import datasetdf = pd.read_csv('data.csv')
Output:
Python3
# intentionally passing wrong spelling of# the key present in datasetdf['country']
output:
KeyError: 'country'
Since there is no column with the name country we get a KeyError.
We can simply fix the error by correcting the spelling of the key. If we are not sure about the spelling we can simply print the list of all column names and crosscheck.
Python3
# printing all columns of the dataframeprint(df.columns.tolist())
Output:
['Country', 'Age', 'Salary', 'Purchased']
Python3
# printing the column 'Country'df['Country']
Output:
0     France
1      Spain
2    Germany
3      Spain
4    Germany
5     France
6      Spain
7     France
8    Germany
9     France
Name: Country, dtype: object
If we want to avoid errors raised by the compiler when an invalid key is passed, we can use df.get(‘your column’) to print column value. No error is raised if the key is invalid.
Syntax :  DataFrame.get( ‘column_name’ , default = default_value_if_column_is_not_present)
Python3
# Again using incorrect spelling of the # column name 'Country' but this time# we will use df.get method with default # value "no_country"df.get('country', default="no_country")
Output:
'no_country'
But when we will use correct spelling we will get the value of the column instead of the default value.
Python3
# printing column 'Country'df.get('Country', default="no_country")
Output:
0     France
1      Spain
2    Germany
3      Spain
4    Germany
5     France
6      Spain
7     France
8    Germany
9     France
Name: Country, dtype: object
Picked
Python-pandas
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
Create a directory in Python
Difference between LOOK and C-LOOK Disk scheduling algorithms

05 Jun, 2020
1. LOOK disk scheduling algorithm :Look Algorithm is actually an improves version of SCAN Algorithm. In this algorithm, the head starts from first request at one side of disk and moves towards the other end by serving all requests in between. After reaching the last request of one end, the head reverse its direction and returns to first request, servicing all requests in between. Unlike SCAN, in this the head instead of going till last track, it goes till last request and then direction is changed.
Example –Consider a disk with 200 tracks (0-199) and the disk queue having I/O requests in the following order as follows: 98, 183, 40, 122, 10, 124, 65. The current head position of the Read/Write head is 53 and will move in Right direction . Calculate the total number of track movements of Read/Write head using LOOK algorithm.
Total head movements,
= (65-53)+(98-65)+(122-98)
           +(124-122)+(183-124)+(183-40)+(40-10)
= 303 
2. C-LOOK disk scheduling algorithm :C-LOOK is the modified version of both LOOK and SCAN algorithms. In this algorithm, the head starts from first request in one direction and moves towards the last request at other end, serving all request in between. After reaching last request in one end, the head jumps in other direction and move towards the remaining requests and then satisfies them in same direction as before. Unlike LOOK, it satisfies requests only in one direction.
Example –Consider a disk with 200 tracks (0-199) and the disk queue having I/O requests in the following order as follows: 98, 183, 40, 122, 10, 124, 65. The current head position of the Read/Write head is 53 and will move in Right direction . Calculate the total number of track movements of Read/Write head using C-LOOK algorithm.
Total head movements,
= (65-53)+(98-65)+(122-98)
               +(124-122)+(183-124)+(183-10)+(40-10)
= 333 
Difference between LOOK and C-LOOK disk scheduling algorithm :
Picked
Difference Between
GATE CS
Operating Systems
Operating Systems
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Difference between var, let and const keywords in JavaScript
Difference Between Method Overloading and Method Overriding in Java
Difference between Process and Thread
Difference between Clustered and Non-clustered index
Differences between IPv4 and IPv6
Layers of OSI Model
ACID Properties in DBMS
Types of Operating Systems
TCP/IP Model
Normal Forms in DBMS
How to check if mod_rewrite is enabled in PHP ?

20 Dec, 2019
In PHP, there is an inbuilt function called ‘phpinfo’. By using this function, we can output all the Loaded Modules and see the ‘mod_rewrite’ is enabled or not.
Syntax:
phpinfo();

Here is a process to check the ‘mod_rewrite’ load module is enabled or not.
Note: The local server used here is XAMPP.
Create a ‘check.php’ file in ‘c:/xampp/htdocs’ directory and write the below code in that file and save it.<?php  phpinfo();?>Now, start the Apache server from the XAMPP Control Panel.Open any web browser browser and type following the URL, ‘localhost/check.php’. It will display the PHP version details and Apache Configuration.In Apache Configuration, search for the Loaded Modules section, and there you will find all the modules that are enabled.If it is enabled then it will be displayed in the list, as shown in the above screenshot.
Create a ‘check.php’ file in ‘c:/xampp/htdocs’ directory and write the below code in that file and save it.<?php  phpinfo();?>
<?php  phpinfo();?>
Now, start the Apache server from the XAMPP Control Panel.
Open any web browser browser and type following the URL, ‘localhost/check.php’. It will display the PHP version details and Apache Configuration.
In Apache Configuration, search for the Loaded Modules section, and there you will find all the modules that are enabled.
If it is enabled then it will be displayed in the list, as shown in the above screenshot.
PHP-basics
Picked
PHP
Technical Scripter
Web Technologies
Web technologies Questions
PHP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to execute PHP code using command line ?
How to delete an array element based on key in PHP?
PHP in_array() Function
How to Insert Form Data into Database using PHP ?
How to convert array to string in PHP ?
Installation of Node.js on Linux
Top 10 Projects For Beginners To Practice HTML and CSS Skills
Difference between var, let and const keywords in JavaScript
How to insert spaces/tabs in text using HTML/CSS?
How to fetch data from an API in ReactJS ?
HTML | lang Attribute

19 Jul, 2019
This attribute is used to specify the language of the element content. Some examples of languages are en for English, es for Spanish, etc.
Syntax:
<element lang = "language_code">
Attribute Value: This attribute contains single value language_code which is used to specify the language of content.
Difference between HTML 4.1 and HTML 5: In HTML 5, the lang attribute can be used with any HTML elements but in HTML 4.1 the lang attribute is used with <base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param>, and <script> elements.
Example:
<!DOCTYPE html><html>    <head>        <title>lang attribute</title>        <style>            body {                text-align:center;            }            h1 {                color:green;            }        </style>    </head>    <body>        <h1>GeeksforGeeks</h1>        <h2>lang attribute</h2>                  <p lang = "en">A computer science portal for geeks</p>    </body></html>
Output:
Supported Browsers: The browser supported by lang attribute are listed below:
Google Chrome
Internet Explorer
Firefox
Opera
Safari
HTML-Attributes
CSS
HTML
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to update Node.js and NPM to next version ?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to insert spaces/tabs in text using HTML/CSS?
How to create footer to stay at the bottom of a Web page?
CSS to put icon inside an input element in a form
How to update Node.js and NPM to next version ?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to insert spaces/tabs in text using HTML/CSS?
REST API (Introduction)
Hide or show elements in HTML using display property
GATE | GATE-CS-2005 | Question 55

11 Sep, 2017
Consider the languages:
L1 = {anbncm | n, m > 0} 
L2 = {anbmcm | n, m > 0} 
Which one of the following statements is FALSE?(A) L1 ∩ L2 is a context-free language(B) L1 U L2 is a context-free language(C) L1 and L2 are context-free language(D) L1 ∩ L2 is a context sensitive languageAnswer: (A)Explanation: We can recognize strings of given language using one Stack. These given languages are context free, so also context sensitive.Because CFLs are closed under Union property, so union of given languages will also be Context free.But CFLs are not closed under Intersection property, so Intersection of two CFLs may not be CFL.Given L1 and If L2 are two context free languages, their intersection L1 ∩ L2 is not context free because we cannot identify strings of resultant language with help of one Stack:
L1 = { anbncm | n > 0 and m > 0 } and L2 = { ambncn | n > 0 and m > 0 }
L3 = L1 ∩ L2 = { anbncn | n > 0 } is not context free.
So, option (a) is false.
See wikipedia page for closure properties.Quiz of this Question
GATE-CS-2005
GATE-GATE-CS-2005
GATE
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
GATE | GATE-CS-2014-(Set-2) | Question 65
GATE | Sudo GATE 2020 Mock I (27 December 2019) | Question 33
GATE | GATE-CS-2014-(Set-3) | Question 20
GATE | GATE CS 2008 | Question 46
GATE | GATE-CS-2015 (Set 3) | Question 65
GATE | GATE-CS-2014-(Set-3) | Question 65
GATE | GATE-CS-2014-(Set-1) | Question 51
GATE | GATE CS 1996 | Question 63
GATE | GATE CS 2008 | Question 40
GATE | GATE-CS-2015 (Set 2) | Question 55
Xv6 Operating System -add a user program

14 Aug, 2020
Xv6 is a re-implementation of the Unix sixth edition in order to use as a learning tool. xv6 was developed by MIT as a teaching operating system for their “6.828” course. A vital fact about xv6 is that it contains all the core Unix concepts and has a similar structure to Unix even though it lacks some functionality that you would expect from a modern operating system. This is a lightweight operating system where the time to compile is very low and it also allow remote debugging.
The source code of xv6 can be cloned to your machine as follows :https://github.com/mit-pdos/xv6-public
Adding user program to xv6 :After completing xv6 setup on your machine, you could have a look at how to add a new user program to xv6. A user program could be a simple C program. However, just adding a file to the xv6 folder would not be sufficient as we need to make it available to the user at the shell prompt.
Step-1: A simple C programFirst of all, let’s create a C program like the following. We save it inside the source code directory of xv6 operating system with the name first.c or whatever the name you prefer.
C
//A Simple C programinclude "types.h"include "stat.h"include "user.h"     //passing command line arguments    int main(int argc, char *argv[]){  printf(1, "My first xv6 program learnt at GFG\n");  exit();}  // This code is contributed by sambhav228
Step-2: Edit the MakefileThe Makefile needs to be edited to make our program available for the xv6 source code for compilation.
gedit Makefile 
This line of code would open the Makefile in the gedit text editor. Next, the following sections of the Makefile needs to be edited to add your program first.c
UPROGS=\
_cat\
_crash\
_echo\
_factor\
_forktest\
_grep\
_hello\
_init\
_kill\
_ln\
_ls\
_mkdir\
_null\
_rm\
_sh\
_share\
_stressfs\
_usertests\
_wc\
_zombie\
_first\
EXTRA=\

 mkfs.c ulib.c user.h cat.c echo.c forktest.c grep.c kill.c\
 ln.c ls.c mkdir.c rm.c stressfs.c usertests.c wc.c zombie.c\
 first.c\
 printf.c umalloc.c\
 README dot-bochsrc *.pl toc.* runoff runoff1 runoff.list\
 .gdbinit.tmpl gdbutil\  
Now, our Makefile and our user program is ready to be tested. Enter the following commands to compile the whole system.
make clean
make 
Now, start xv6 system on QEMU and when it booted up, run ls command to check whether our program is available for the user. If yes, give the name of that executable program, which is in my case is first to see the program output on the terminal.
Output :“My first xv6 program learnt at GFG” shows this output on the QEMU emulator window.
Operating Systems
Operating Systems
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Page Replacement Algorithms in Operating Systems
Introduction of Operating System - Set 1
Introduction of Deadlock in Operating System
Inter Process Communication (IPC)
Paging in Operating System
File Allocation Methods
Semaphores in Process Synchronization
Difference between Process and Thread
Deadlock Prevention And Avoidance
Introduction of Process Synchronization
How to perform mouseover action on an element in Selenium?

We can perform mouseover action on elements in Selenium with the help of Actions class. In order to perform the mouse movement we will use moveToElement () method of the Actions class. Finally use build().perform() to execute all the steps.
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.interactions.Action;
import org.openqa.selenium.interactions.Actions;
import java.util.concurrent.TimeUnit;
public class MouseOver{
   public static void main(String[] args) {
      System.setProperty("webdriver.chrome.driver", "C:\\Users\\ghs6kor\\Desktop\\Java\\chromedriver.exe");
      WebDriver driver = new ChromeDriver();
      String url = "https://www.tutorialspoint.com/questions/index.php";
      driver.get(url);
      driver.manage().timeouts().implicitlyWait(12, TimeUnit.SECONDS);
      // actions class with moveToElement() method for mouse hover to element
      Actions a = new Actions(driver);
      a.moveToElement(driver.findElement(By.xpath(“input[@type=’text’]))).
      build().perform();
      driver.quit();
   }
}
Tryit Editor v3.7

Tryit: HTML comment to hide content
Convert String to Integer in R Programming - strtoi() Function - GeeksforGeeks

01 Jun, 2020
strtoi() function in R Language is used to convert the specified string to integers.
Syntax: strtoi(x, base=0L)
Parameters:x: character vectorbase: integer between 2 and 36 inclusive, default is 0
Example 1:
# R program to illustrate# strtoi function  # Initializing some string vectorx <- c("A", "B", "C")y <- c("1", "2", "3")  # Calling strtoi() functionstrtoi(x, 16L)strtoi(y)
Output :
[1] 10 11 12
[1] 1 2 3

Example 2:
# R program to illustrate# strtoi function  # Calling strtoi() function over# some specified stringsstrtoi(c("0xff", "023", "567"))strtoi(c("ffff", "FFFF"), 16L)strtoi(c("246", "135"), 8L)
Output:
[1] 255  19 567
[1] 65535 65535
[1] 166  93

R String-Functions
R Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Filter data by multiple conditions in R using Dplyr
Change Color of Bars in Barchart using ggplot2 in R
How to change Row Names of DataFrame in R ?
How to Change Axis Scales in R Plots?
Group by function in R using Dplyr
K-Means Clustering in R Programming
Remove rows with NA in one column of R DataFrame
How to Split Column Into Multiple Columns in R DataFrame?
How to filter R DataFrame by values in a column?
How to import an Excel File into R ?
Putting semicolons after while and if statements in C++

When you have a statement like −
while (expression);
the while loop runs no matter if the expression is true or not. However, if you put −
if (expression);
the statement runs no matter if the expression is true or not. This is because the syntax for if and while is −
if (<expr>) <statement>
// or
while (<expr>) <statement>
So the <statement> is only executed if the <expr> evaluates to true. In while, it will enter an infinite loop.
So the question what <statement> it executes. If there are not braces {} then the next statement is terminated by; even if that statement is EMPTY. Note that an empty statement is valid.
if (<expr>)    /* Empty Statement */;
while (<expr>) /* Empty Statement */;
In both cases, there is nothing being executed (after the expression is evaluated). Though while may enter an infinite loop. Note: '{}' is a statement-Block (a type of statement (that contains a list of other statements).
How to implement the search functionality of a JTable in Java?

A JTable is a subclass of JComponent for displaying complex data structures. A JTable component can follow the Model View Controller (MVC) design pattern for displaying the data in rows and columns. A JTable can generate TableModelListener, TableColumnModelListener, ListSelectionListener, CellEditorListener, RowSorterListener interfaces. We can implement the search functionality of a JTable by input a string in the JTextField, it can search for a string available in a JTable. If the string matches it can only display the corresponding value in a JTable. We can use the DocumentListener interface of a JTextField to implement it.
import java.awt.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.table.*;
public class JTableSearchTest extends JFrame {
   private JTextField jtf;
   private JLabel searchLbl;
   private TableModel model;
   private JTable table;
   private TableRowSorter sorter;
   private JScrollPane jsp;
   public JTableSearchTest() {
      setTitle("JTableSearch Test");
      jtf = new JTextField(15);
      searchLbl = new JLabel("Search");
      String[] columnNames = {"Name", "Technology"};
      Object[][] rowData = {{"Raja", "Java"},{"Vineet", "Java Script"},{"Archana", "Python"},{"Krishna", "Scala"},{"Adithya", "AWS"},{"Jai", ".Net"}};
      model = new DefaultTableModel(rowData, columnNames);
      sorter = new TableRowSorter<>(model);
      table = new JTable(model);
      table.setRowSorter(sorter);
      setLayout(new FlowLayout(FlowLayout.CENTER));
      jsp = new JScrollPane(table);
      add(searchLbl);
      add(jtf);
      add(jsp);
      jtf.getDocument().addDocumentListener(new DocumentListener() {
         @Override
         public void insertUpdate(DocumentEvent e) {
            search(jtf.getText());
         }
         @Override
         public void removeUpdate(DocumentEvent e) {
            search(jtf.getText());
         }
         @Override
         public void changedUpdate(DocumentEvent e) {
            search(jtf.getText());
         }
         public void search(String str) {
            if (str.length() == 0) {
               sorter.setRowFilter(null);
            } else {
               sorter.setRowFilter(RowFilter.regexFilter(str));
            }
         }
      });
      setSize(475, 300);
      setDefaultCloseOperation(EXIT_ON_CLOSE);
      setLocationRelativeTo(null);
      setResizable(false);
      setVisible(true);
   }
   public static void main(String[] args) {
      new JTableSearchTest();
   }
}
ReactJS MDBootstrap Switch Component - GeeksforGeeks

07 Jan, 2022
MDBootstrap is a Material Design and bootstrap-based react UI library that is used to make good-looking webpages with its seamless and easy-to-use component. In this article, we will know how to use Switch Component in ReactJS MDBootstrap.The switch component is used to indicate the on/off state of the component.
 
Properties: 
className: It is used to add a custom class to the component.
disabled: It is used to make the component disabled.
name: It is used to specify the name for the component.
id: It is used to define an id for the component.
label: It is used to define a label text for the component.
labeled: It is used to define an id for the label.
labelClass: It is used to add custom classes to the label.
 
Syntax:
<MDBSwitch />
Creating React Application And Installing Module:
Step 1: Create a React application using the following command.
npx create-react-app foldername
Step 2: After creating your project folder i.e. foldername, move to it using the following command.
cd foldername
Step 3: Install ReactJS MDBootstrap in your given directory.
npm i mdb-ui-kit
npm i mdb-react-ui-kit
Step 4: Import the element to be used in the project.
import { MDBSwitch } from 'mdb-react-ui-kit'
Project Structure: It will look like the following.
Step to Run Application: Run the application from the root directory of the project, using the following command.
npm start
Example 1: this is the basic example that shows how to use Switch Component.
App.js
import React from "react";import { MDBSwitch } from 'mdb-react-ui-kit';  export default function App() {    return (        <div id="gfg">            <h2>GeeksforGeeks</h2>            <h4>ReactJS MDBootstrap Switch component</h4>              <MDBSwitch label='Switch 1' />            <br />            <MDBSwitch defaultChecked label='Switch 2' />            <br />        </div>    );}
Output:
Example 2: In this example, we will know how to use disabled property in a Switch component.
App.js
import React from "react";import { MDBSwitch } from 'mdb-react-ui-kit';  export default function App() {    return (        <div id="gfg">            <h2>GeeksforGeeks</h2>            <h4>ReactJS MDBootstrap Switch component</h4>              <MDBSwitch disabled label='Switch 1' />            <br />            <MDBSwitch disabled defaultChecked                 label='Switch 2' />            <br />        </div>    );}
Output:
Reference: https://mdbootstrap.com/docs/b5/react/forms/switch/
MDBootstrap
ReactJS
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
How to navigate on path by button click in react router ?
How to create a table in ReactJS ?
How to check the version of ReactJS ?
Explain the purpose of render() in ReactJS
How to set background images in ReactJS ?
Express.js express.Router() Function
How to set input type date in dd-mm-yyyy format using HTML ?
Installation of Node.js on Linux
Differences between Functional Components and Class Components in React
How to create footer to stay at the bottom of a Web page?
How to change the target of a link in HTML?

To change the target of a link in HTML, use the target attribute of the <a>...</a> tag. The target attribute can be used to open any link in a new tab, or the same tab, etc.
Here are the values of the target attribute:
You can try to run the following code to change the target of a link in HTML. We will set it to open in a new tab
Live Demo
<!DOCTYPE html>
<html>
   <head>
      <title>HTML link target</title>
   </head>
   <body>
      <h2>References</h2>
      <p>
         Refer the following <a href="https://www.qries.com/questions.php"
            target="_blank">website</a>.
         The above link will open in a new tab.
      </p>
   </body>
</html>
How to convert a string to a Python class object?

Given a string as user input to a python function, I'd like to get a class object out of it if there's a class with that name in the currently defined namespace.
class Foobar:
    pass
print eval("Foobar")
print type(Foobar)
 __main__.Foobar
<type 'classobj'>


Another way to convert a string to class object is as follows
import sys
class Foobar:
    pass
def str_to_class(str):
    return getattr(sys.modules[__name__], str)
print str_to_class("Foobar")
print type(Foobar)
__main__.Foobar
<type 'classobj'>
What are union, intersect and except operators in Linq C#?

Union combines multiple collections into a single collection and returns a resultant collection with unique elements
Intersect returns sequence elements which are common in both the input sequences
Except returns sequence elements from the first input sequence that are not present in the second input sequence
class Program{
   static void Main(){
      int[] count1 = { 1, 2, 3, 4 };
      int[] count2 = { 2, 4, 7 };
      var resultUnion = count1.Union(count2);
      var resultIntersect = count1.Intersect(count2);
      var resultExcept = count1.Except(count2);
      System.Console.WriteLine("Union");
      foreach (var item in resultUnion){
         Console.WriteLine(item);
      }
      System.Console.WriteLine("Intersect");
      foreach (var item in resultIntersect){
         Console.WriteLine(item);
      }
      System.Console.WriteLine("Except");
      foreach (var item in resultExcept){
         Console.WriteLine(item);
      }
      Console.ReadKey();
   }
}
Union
1
2
3
4
7
Intersect
2
4
Except
1
3
C# - Nested Loops

C# allows to use one loop inside another loop. Following section shows few examples to illustrate the concept.
The syntax for a nested for loop statement in C# is as follows −
for ( init; condition; increment ) {
   for ( init; condition; increment ) {
      statement(s);
   }
   statement(s);
}

The syntax for a nested while loop statement in C# is as follows −
while(condition) {
   while(condition) {
      statement(s);
   }
   statement(s);
}

The syntax for a nested do...while loop statement in C# is as follows −
do {
   statement(s);
   do {
      statement(s);
   }
   while( condition );
}
while( condition );

A final note on loop nesting is that you can put any type of loop inside of any other type of loop. For example a for loop can be inside a while loop or vice versa.
The following program uses a nested for loop to find the prime numbers from 2 to 100 −
using System;

namespace Loops {
   class Program {
      static void Main(string[] args) {
         /* local variable definition */
         int i, j;
         
         for (i = 2; i < 100; i++) {
            for (j = 2; j <= (i / j); j++)
            if ((i % j) == 0) break; // if factor found, not prime
            if (j > (i / j)) Console.WriteLine("{0} is prime", i);
         }
         Console.ReadLine();
      }
   }
} 
When the above code is compiled and executed, it produces the following result −
2 is prime
3 is prime
5 is prime
7 is prime
11 is prime
13 is prime
17 is prime
19 is prime
23 is prime
29 is prime
31 is prime
37 is prime
41 is prime
43 is prime
47 is prime
53 is prime
59 is prime
61 is prime
67 is prime
71 is prime
73 is prime
79 is prime
83 is prime
89 is prime
97 is prime


    119 Lectures 
     23.5 hours 

 Raja Biswas

    37 Lectures 
     13 hours 

 Trevoir Williams

    16 Lectures 
     1 hours 

 Peter Jepson

    159 Lectures 
     21.5 hours 

 Ebenezer Ogbu

    193 Lectures 
     17 hours 

 Arnold Higuit

    24 Lectures 
     2.5 hours 

 Eric Frick
 Print
 Add Notes
 Bookmark this page
New '=' Operator in Python3.8 f-string - GeeksforGeeks

03 Jun, 2020
Python have introduced the new = operator in f-string for self documenting the strings in Python 3.8.2 version. Now with the help of this expression we can specify names in the string to get the exact value in the strings despite the position of the variable. Now f-string can be defined as f'{expr=}' expression. We can specify any required name in place of expr.
Syntax : f'{expr=}'Return : Return the formatted string.
Note: For older versions of Python this operator will raise the syntax error. See the below image.
Example #1 :In this example we can see that with the help of f'{expr=}' expression, we are able to format strings in python by self documenting expressions by using = operator.
length = len('GeeksForGeeks')  # Using f'{expr =}' expressiongfg = f'The length of GeeksForGeeks is {length =}.'  print(gfg)
Output :
The length of GeeksForGeeks is length=13.
Example #2 :
a, b = 5, 10  # Using f'{expr =}' expressiongfg = f'Value of {b = } and {a = }.'  print(gfg)
Output :
Value of b = 10 and a = 5.
python-basics
Python-Operators
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Box Plot in Python using Matplotlib
Bar Plot in Matplotlib
Python | Get dictionary keys as a list
Python | Convert set into a list
Ways to filter Pandas DataFrame by column values
Python - Call function from another file
loops in python
Multithreading in Python | Set 2 (Synchronization)
Python Dictionary keys() method
Python Lambda Functions
Foreign key in MS SQL Server - GeeksforGeeks

31 Jul, 2020
Prerequisite – Primary key in MS SQL ServerSQL Server has different keys which serve a different purpose. In this article, the foreign key will be discussed in brief.
The foreign key has a similar purpose as the primary key yet, the foreign key is used for two tables. In a few cases, the foreign key is used for self-referencing a single table.
Foreign key :A singular column or a set of columns of one table that uniquely identified by a singular column or a set of columns of another table is referred to as a foreign key.
Syntax –
constraint fk_constraint-name foreign key(col1, col2) 
references parent_table-name(col1, col2)
                                        (OR)
foreign key(col1, col2) 
references parent_table-name(col1, col2)
A foreign key has two tables – parent table and child table. If a user wants to insert a column in a child table, the column has to be a part of the parent table otherwise, an error is displayed. In the syntax, the constraint term is not mandatory to use.
When a foreign key is mentioned in the query, the key automatically creates a referential constraint meaning a column can be inserted in the child table only if it is a part of the parent table.
Two tables named student (parent table) and marks (child table) are considered from the university database.
If a user wants to insert a new column, the query is given as –
foreign key('rollno') 
references student('rollno')

insert into marks ('name', 'rollno', 'marks') 
values('Naina, '111', '7.5')
An error is displayed as the roll number is already taken by a student. (Foreign key constraint). The foreign key does not allow the value to reoccur. To avoid such errors, the values must neither be repeated nor a different column must be considered.
DBMS-SQL
SQL-Server
DBMS
SQL
DBMS
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Deadlock in DBMS
Types of Functional dependencies in DBMS
KDD Process in Data Mining
Conflict Serializability in DBMS
What is Temporary Table in SQL?
SQL | DDL, DQL, DML, DCL and TCL Commands
How to find Nth highest salary from a table
SQL | ALTER (RENAME)
How to Update Multiple Columns in Single Update Statement in SQL?
MySQL | Group_CONCAT() Function
HashSet iterator() Method in Java - GeeksforGeeks

26 Nov, 2018
The Java.util.HashSet.iterator() method is used to return an iterator of the same elements as the hash set. The elements are returned in random order from what present in the hash set.
Syntax:
Iterator iterate_value = Hash_Set.iterator();

Parameters: The function does not take any parameter.
Return Value: The method iterates over the elements of the hash set and returns the values(iterators).
Below program illustrate the Java.util.HashSet.iterator() method:
// Java code to illustrate iterator()import java.util.*;import java.util.HashSet;  public class HashSetDemo {    public static void main(String args[])    {        // Creating an empty HashSet        HashSet<String> set = new HashSet<String>();          // Use add() method to add elements into the Set        set.add("Welcome");        set.add("To");        set.add("Geeks");        set.add("4");        set.add("Geeks");          // Displaying the HashSet        System.out.println("HashSet: " + set);          // Creating an iterator        Iterator value = set.iterator();          // Displaying the values after iterating through the set        System.out.println("The iterator values are: ");        while (value.hasNext()) {            System.out.println(value.next());        }    }}
HashSet: [4, Geeks, Welcome, To]
The iterator values are: 
4
Geeks
Welcome
To

Java - util package
Java-Collections
Java-Functions
java-hashset
Java
Java
Java-Collections
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Stream In Java
Interfaces in Java
ArrayList in Java
Initialize an ArrayList in Java
Stack Class in Java
Singleton Class in Java
Multidimensional Arrays in Java
Multithreading in Java
Collections in Java
Queue Interface In Java