code-rag-bench/online-tutorials huggingface dataset:
Casting value or an expression from one data type to another in SQL server - GeeksforGeeks

28 Dec, 2020
SQL Server uses the CAST() function to cast or convert a value or an expression from one data type to another.
Syntax :
CAST ( value AS targettype [ ( length ) ] )

Parameters used :
value –value can be any value of any type that will be converted.
targettype –targettype is the target data type to which the value will be converted. e.g. INT, BIT, SQL_VARIANT, etc.
length –length is an optional parameter that specifies the length of the targettype, default length is 30.
For better understanding, let us run the below query as follows.
SELECT 3 + '3' AS Result;
Output :
Its result is 6 as a number. In above statement, SQL Server implicitly converts the character string ‘3’ to the number 3.
Note –When two values with different data types are used in SQL Server, it will convert the lower to higher data type before it process if further. This is known as implicit conversion.
On the other hand, SQL server could use explicit conversions where the CAST() function is used explicitly to convert a value of one type to another as follows.
SELECT 3 + CAST('3' AS INT) AS Result;
Output :
To cast a value of the data types in different scenarios, SQL Server will return a truncated value or a rounded value based on the following rules as follows.
Examples –
Example-1 :Below example uses the CAST() function to convert the decimal type value to an integer type value.SELECT CAST(5.95 AS INT) AS Result;Output :Result5
SELECT CAST(5.95 AS INT) AS Result;
Output :
Example-2 :Below example uses the CAST() function to convert the decimal type value to another decimal type value number with the zero scale.SELECT CAST(5.95 AS DEC(3, 0)) Result;Output :Result6
SELECT CAST(5.95 AS DEC(3, 0)) Result;
Output :
Example-3 :Using the CAST() function to convert a string to a datetime value example.The below example uses the CAST() function to convert the string to a datetime.SELECT CAST('2020-09-14' AS DATETIME) 
AS Result;Output :Result2020-09-14 00:00:00.000
SELECT CAST('2020-09-14' AS DATETIME) 
AS Result;
Output :
DBMS-SQL
SQL-Server
SQL
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
How to Update Multiple Columns in Single Update Statement in SQL?
How to Alter Multiple Columns at Once in SQL Server?
What is Temporary Table in SQL?
SQL using Python
SQL Query to Find the Name of a Person Whose Name Starts with Specific Letter
SQL | Subquery
SQL Query to Convert VARCHAR to INT
SQL - SELECT from Multiple Tables with MS SQL Server
SQL | Date functions
SQL Query to Insert Multiple Rows
Explain about the Time stamp ordering protocol in DBMS

The timestamp-ordering protocol ensures serializability among transactions in their conflicting read and write operations. This is the responsibility of the protocol system that the conflicting pair of tasks should be executed according to the timestamp values of the transactions.
A conflict occurs when an older transaction tries to read/write a value already read or written by a younger transaction. Read or write proceeds only if the last update on that data item was carried out by an older transaction.
Otherwise, the transaction requesting read/write is restarted and gives a new timestamp. Here no locks are used so no deadlock.
The timestamp of transaction Ti is denoted as TS(Ti).
The timestamp of transaction Ti is denoted as TS(Ti).
Read time-stamp of data-item X is denoted by R-timestamp(X).
Read time-stamp of data-item X is denoted by R-timestamp(X).
Write time-stamp of data-item X is denoted by W-timestamp(X).
Write time-stamp of data-item X is denoted by W-timestamp(X).
These timestamps are updated after a successful read/write operation on data item X.
Older transactions get priority over younger transactions in the event of conflict operation. Conflict is resolved by rolling back and restarting transactions.
To ensure serializability following rules are used −
Rule 1 − If a transaction Ti issues a read(X) operation.
If TS(Ti) < W-timestamp(X)
Operation rejected.
If TS(Ti) >= W-timestamp(X)
Operation executed.
All data-item timestamps updated.
Rule 2 − If a transaction Ti issues a write(X) operation.
If TS(Ti) < R-timestamp(X)
Operation rejected.
If TS(Ti) < W-timestamp(X)
Operation rejected and Ti rolled back.
Otherwise, the operation is executed.
This rule states if TS(Ti) < W-timestamp(X), then the operation is rejected and Ti is rolled back.
Time-stamp ordering rules can be modified to make the schedule view serializable.
Instead of making Ti rolled back, the 'write' operation itself is ignored.
EFFECT − Thomas Write Rule allows such operations and is a modification on the Basic Timestamp Ordering protocol. In Thomas Write Rule users ignore outdated writes.
S: f1(X) W2(X) W1(X)
Check whether timestamp ordering protocol allows schedule S.
X-----------------RTS------3
X----------------WTS------4
For f1(X) : TS(Ti) <WTS(X) i.e TS(T1)<WTS(X)
   3<0 (FALSE)
GOTO else and perform write operation W2(X) AND WTS(X)=4
For W1(X): TS(Ti)<RTS(X) i.e TS(T1)<RTS(X)
      3<3 (FALSE)
   TS(T1)<WTS(X)
      3<4 (TRUE)
ROLLBACK
Return array from function in C

C programming does not allow to return an entire array as an argument to a function. However, you can return a pointer to an array by specifying the array's name without an index.
If you want to return a single-dimension array from a function, you would have to declare a function returning a pointer as in the following example −
int * myFunction() {
   .
   .
   .
}
Second point to remember is that C does not advocate to return the address of a local variable to outside of the function, so you would have to define the local variable as static variable.
Now, consider the following function which will generate 10 random numbers and return them using an array and call this function as follows −
#include <stdio.h>

/* function to generate and return random numbers */
int * getRandom( ) {

   static int  r[10];
   int i;

   /* set the seed */
   srand( (unsigned)time( NULL ) );
  
   for ( i = 0; i < 10; ++i) {
      r[i] = rand();
      printf( "r[%d] = %d\n", i, r[i]);
   }

   return r;
}

/* main function to call above defined function */
int main () {

   /* a pointer to an int */
   int *p;
   int i;

   p = getRandom();
	
   for ( i = 0; i < 10; i++ ) {
      printf( "*(p + %d) : %d\n", i, *(p + i));
   }

   return 0;
}
When the above code is compiled together and executed, it produces the following result −
r[0] = 313959809
r[1] = 1759055877
r[2] = 1113101911
r[3] = 2133832223
r[4] = 2073354073
r[5] = 167288147
r[6] = 1827471542
r[7] = 834791014
r[8] = 1901409888
r[9] = 1990469526
*(p + 0) : 313959809
*(p + 1) : 1759055877
*(p + 2) : 1113101911
*(p + 3) : 2133832223
*(p + 4) : 2073354073
*(p + 5) : 167288147
*(p + 6) : 1827471542
*(p + 7) : 834791014
*(p + 8) : 1901409888
*(p + 9) : 1990469526

 Print
 Add Notes
 Bookmark this page
Concatenation of two strings in PHP

16 Jun, 2022
There are two string operators. The first is the concatenation operator (‘.‘), which returns the concatenation of its right and left arguments. The second is the concatenating assignment operator (‘.=‘), which appends the argument on the right side to the argument on the left side. Examples :
Input : string1:  Hello
        string2 : World! 
Output : HelloWorld!


Input : string1: geeksfor
        string2: geeks
Output : geeksforgeeks
Code #1: 
PHP
<?php // First String$a = 'Hello'; // Second String$b = 'World!'; // Concatenation Of String$c = $a.$b; // print Concatenate Stringecho " $c \n";?>
Output :
 HelloWorld!
Time complexity : O(n) Auxiliary Space : O(n)
  Code #2 : 
PHP
<?php // First String$fname = 'John'; // Second String$lname = 'Carter!'; // Concatenation Of String$c = $fname." ".$lname; // print Concatenate Stringecho " $c \n";?>
Output :
John Carter!
Time complexity : O(n) Auxiliary Space : O(n)
  Code #3 : 
PHP
<?php // First String$a = 'Hello'; // now $a contains "HelloWorld!"$a. = "World!"; // Print The String $aecho " $a \n";?>
Output :
 HelloWorld!
Time complexity : O(n) Auxiliary Space : O(n)
PHP is a server-side scripting language designed specifically for web development. You can learn PHP from the ground up by following this PHP Tutorial and PHP Examples.
mahendrabagul569
PHP-string
PHP
Strings
Web Technologies
Strings
PHP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
SQL Right Join

26 Apr, 2021
The RIGHT JOIN keyword in SQL returns the all matching records(or rows) and the records(or rows) which are present in the right table but not in the left table .That means that, if a certain row is present in the right table but not in the left, the result will include this row but with a NULL value in each column from the left . If a record from the left table is not in the right, it will not be included in the result.
RIGHT JOIN
The syntax for a RIGHT JOIN is :-
SELECT column_name(s) 
FROM tableA 
RIGHT JOIN tableB ON tableA.column_name = tableB.column_name;
SQL RIGHT JOIN EXAMPLE  :
In this example we will consider two tables employee table containing details of the employees working in the particular department the and department table containing the details of the department
employee table :
department table :
To perform right- join on these two tables we will use the following SQL query:
select emp_no , emp_name ,d_name, location 
from employee 
right join dept on employee.dept_no = department.dept_no;
The output that we will get is as follows : 
As right join gives the matching rows and the rows that are present in the left table but not in the right table .Here  in this example ,we see that the department that contains no employee contains [NULL] values of emp_no and emp_name after performing the right join.
DBMS-SQL
DBMS
SQL
DBMS
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python | Truncate a list

04 Jan, 2019
Sometimes there is a requirement to restrict the list size to a particular number and remove all the elements from list which occur after a certain number as decided as list size. This is a useful utility for web development using Python. Let’s discuss certain ways in which this can be performed.
Method #1 : Using pop()pop function can be repeated a number of times till size of the list reaches the threshold required as the size of the list. This uses a whole loop and hence is comparatively tedious.
# Python3 code to demonstrate # to truncate list using pop()  # initializing list  test_list = [1, 4, 5, 6, 7, 3, 8, 9, 10]  # printing original listprint ("The original list is : " + str(test_list))  # size desiredk = 5  # using pop()# to truncate list n = len(test_list)for i in range(0, n - k ):    test_list.pop()  # printing resultprint ("The truncated list is : " +  str(test_list))
The original list is : [1, 4, 5, 6, 7, 3, 8, 9, 10]
The truncated list is : [1, 4, 5, 6, 7]

 Method #2 : Using del + list slicedel operator can be used to delete all the elements that appear after the specific index, which is handled by the list slicing technique.
# Python3 code to demonstrate # to truncate list # using del + list slicing  # initializing list  test_list = [1, 4, 5, 6, 7, 3, 8, 9, 10]  # printing original listprint ("The original list is : " + str(test_list))  # size desiredk = 5  # using del + list slicing# to truncate list del test_list[5:]  # printing resultprint ("The truncated list is : " +  str(test_list))
The original list is : [1, 4, 5, 6, 7, 3, 8, 9, 10]
The truncated list is : [1, 4, 5, 6, 7]

 Method #3 : Using list slicingIn this method, we just slice the first K elements and ignore all the elements that occur after K elements. This is most pythonic and recommended method to perform this task.
# Python3 code to demonstrate # to truncate list # using list slicing  # initializing list  test_list = [1, 4, 5, 6, 7, 3, 8, 9, 10]  # printing original listprint ("The original list is : " + str(test_list))  # size desiredk = 5  # using list slicing# to truncate list res = test_list[0 : 5]  # printing resultprint ("The truncated list is : " +  str(res))
The original list is : [1, 4, 5, 6, 7, 3, 8, 9, 10]
The truncated list is : [1, 4, 5, 6, 7]

Python list-programs
Python
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
HTML <head> Tag

17 Mar, 2022
The <head> tag in HTML is used to define the head portion of the document which contains information related to the document. The <head> tag contains other head elements such as <title>, <meta>, <link>, <style> <link> etc. In HTML 4.01 the <head> element was mandatory but in HTML5, the <head> element can be omitted.Tag Specific Attributes:The below-mentioned layout-attributes of the <hr> tag have been removed from HTML5. 
Attribute: 
profile: It is used to specify the URL to a document that contains one or more metadata profiles for browsers to clearly understand the information.
Syntax : 
<head>
<title>Title of the document</title>
</head>
Below program illustrates the <head> element:
Program 1:
HTML
<!DOCTYPE html><html lang="en"> <head>    <title>HTML Head Tag </title></head> <body>     <p>GeeksforGeeks is a portal for geeks.</p>     <hr></body> </html>
Output:  
Program 2(Using style tag inside head tag)
HTML
<!DOCTYPE html> <html> <head>    <style>        body {            background: skyblue;        }                 h1 {            color: red;        }                 p {            color: blue;        }    </style></head> <body>     <h1>GeeksforGeeks</h1>     <p>It is a portal for geeks.</p>  </body> </html>
Output:  
Program 3(Using link tag inside head tag):
HTML
<!DOCTYPE html> <html> <head>    <link rel="stylesheet" type="text/css" href="mystyle.css"></head> <body>     <h1>GeeksforGeeks</h1>     <p>It is a portal for geeks.</p>  </body> </html>
Output:  
Supported Browsers: 
Google Chrome
Internet Explorer
Firefox
Opera
Safari
 
shubhamyadav4
HTML-Tags
HTML5
HTML
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Replace a Substring of a String in Dart?

11 Jun, 2020
To replace all the substring of a string we make use of  replaceAll method in Dart. This method replaces all the substring in the given string to the desired substring. Returns a new string in which the non-overlapping substrings matching from (the ones iterated by from.allMatches(this String)) are replaced by the literal string replace.
Syntax: String_name.replaceAll (Old_String_Pattern, New_String_Pattern);

In the above sequence:
String_name is the name of the string in which operation is to be done. It could be the string itself.
Old_String_Pattern is the pattern present in the given string.
New_String_Pattern is the new pattern that is to be replaced with the old pattern.
Example 1: 
Replacing the substring in the given string.
Dart
// Main functionmain() {    String gfg = "Welcome GeeksForGeeks";          //replace substring of the given string    String result = gfg.replaceAll("GeeksForGeeks", "Geek!");          print(result);}
Output:
Welcome Geek!

In the above example the substring “GeeksForGeeks” is replaced by another string “Geek!”.
Example 2:
Using chain of replaceAll() method to change the string in dart.
Dart
// Main functionmain() {    String gfg = "Welcome GeeksForGeeks";          //replace substring of the given string    String result = gfg.replaceAll("GeeksForGeeks", "Geek!").replaceAll("!", " :)");          print(result);}
Output:
Welcome Geek :)

In the above example the substring “GeeksForGeeks” is replaced by another string “Geek!” and then “!” is replaced by ” : )”.
Dart-String
Dart
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
HTML | <object> align Attribute

22 Feb, 2022
The HTML <object> align Attribute is used to specify an alignment for an object Element. It is an inline element means that can not insert a new line on a page. The text and other elements can also wrap around it. Note: This attribute is not supported by HTML5. 
Syntax:  
<object align="left | right | middle | top | bottom">
Attribute Values:  
left: It sets the object to the left-align.
right: It sets the object to the right-align.
middle: It sets the object to the middle.
top: It sets the object to the top-align.
Bottom: It sets the object to the bottom align.
Example:  
html
<!DOCTYPE html><html> <head>    <title>        HTML object align Attribute    </title></head> <body style="text-align:center;">     <h2>HTML object align Attribute</h2>     <object id="myobject"            width="200"            height="100"            align="left"            data="https://cdncontribute.geeksforgeeks.org/wp-content/uploads/geek-8.png">    </object>     <object id="myobject"            width="200"            height="100"            align="right"            data="https://cdncontribute.geeksforgeeks.org/wp-content/uploads/geek-8.png">    </object>    <object id="myobject"            width="200"            height="100"            align="middle"            data=           "https://cdncontribute.geeksforgeeks.org/wp-content/uploads/geek-8.png">    </object>    <object id="myobject"            width="200"            height="100"            align="top"            data="https://cdncontribute.geeksforgeeks.org/wp-content/uploads/geek-8.png">    </object></body> </html>
Output:  
Supported Browsers: The browser supported by HTML object align attribute are listed below:  
Google Chrome 10.0
Internet Explorer 10.0
Firefox 4.0
Opera 10.6
Apple Safari
 
hritikbhatnagar2182
kashishsoda
chhabradhanvi
HTML-Attributes
HTML
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Node.js process.traceDeprecation Property

10 Jun, 2021
The process.traceDeprecation property is an inbuilt application programming interface of the process module which is used to indicate whether the –trace-deprecation flag is set on the current Node.js process.
Syntax:
process.traceDeprecation
Return Value: This property indicates whether the –trace-deprecation flag is set on the current Node.js process.
Below examples illustrate the use of the process.traceDeprecation property in Node.js:
 
Example 1:
index.js
// Node.js program to demonstrate the// process.traceDeprecation Property  // Include process moduleconst process = require('process');  // Printing process.traceDeprecation property valueconsole.log(process.traceDeprecation);
Run the index.js file using the following command:
node --trace-deprecation index.js
Output:
true
Again run the same file, but using the different command as shown below:
node index.js
Output:
undefined
Example 2:
Filename: index.js
Javascript
// Node.js program to demonstrate the// process.traceDeprecation Property  // Include process moduleconst process = require('process');  // Instance Properties process.traceDeprecation = false;  // Printing process.traceDeprecation// property valueconsole.log(process.traceDeprecation);  // Instance Properties process.traceDeprecation = true;  // Printing process.traceDeprecation// property valueconsole.log(process.traceDeprecation);
Run the index.js file using the following command:
node --trace-deprecation index.js
Output:
true
true
Again run the same file, but using the different command as shown below:
node index.js
Output:
false
true
Node.js-process-module
Picked
Node.js
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Lodash | _.castArray() Method - GeeksforGeeks

22 Jul, 2021
The _.castArray() method is used to cast value into an array if it is not an array.
Syntax: 
_.castArray( value )
Parameters: This method accepts single parameter as mentioned above and described below:  
value: This parameter holds the value that need to be inspect.
Return Value: It returns an array with the including value passed in the _.castArray().
Example 1: This example using integer value as a parameter.  
Javascript
const _ = require('lodash'); let x = 10; let arr = _.castArray(x); console.log("\n\nThe value returned to by _castArray(x) is", arr);
Here, const _ = require(‘lodash’) is used to import the lodash library into the file.Output: 
Example 2: This example using String, null, and undefined as a parameter.  
Javascript
const _ = require('lodash'); let x = _.castArray('abc'); console.log('\n With String ', x );  let y = _.castArray(null); console.log('\n With null ', y );  let z = _.castArray(undefined); console.log('\n With undefined ', z);
Output: 
Example 3: With no parameter, object, and function. 
Javascript
const _ = require('lodash'); let x = _.castArray(); console.log("\n With no parameter ", x); let y = _.castArray({"name":"lodash",         "work":"I'm make js more" }); console.log("\n With object ", y); let z = _.castArray(function hello() {    console.log("hello");}); console.log("\n with function ", z);
Output: 
Example 4: This example using multiple parameters, it will take only the first parameter and with an array, it will just return the same array. 
Javascript
const _ = require('lodash'); let x = _.castArray(1, 2, "hello"); console.log('\n With multiple parameter ', x); let y = _.castArray([1, 2, 3]); console.log('\n With array ', y);
Output: 
Note: This will not work in normal JavaScript because it requires the library lodash to be installed.Reference: https://lodash.com/docs/4.17.15#castArray 
sumitgumber28
surinderdawra388
JavaScript-Lodash
JavaScript
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Remove elements from a JavaScript Array
Convert a string to an integer in JavaScript
Difference between var, let and const keywords in JavaScript
Differences between Functional Components and Class Components in React
How to calculate the number of days between two dates in javascript?
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 ?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
How to pop an alert message box using PHP ? - GeeksforGeeks

17 Nov, 2021
An alert box is used in the website to display a warning message to the user that they have entered the wrong value other than what is required to fill in that position. An alert box can still be used for friendlier messages. The alert box gives only one button “OK” to select and proceed. 
The alert message just like a pop-up window on the screen. Using this you can alert to the user with some information and message. PHP doesn’t support alert message box because it is a server-side language but you can use JavaScript code within the PHP body to alert the message box on the screen.
Syntax: 
alert("Message")
Program 1: PHP program to pop up an alert box on the screen.  
PHP
<?php// PHP program to pop an alert// message box on the screen  // Display the alert box echo '<script>alert("Welcome to Geeks for Geeks")</script>';  ?>
Output: 
Program 2: PHP program to pop up an alert box on the screen.  
PHP
<?php// PHP program to pop an alert// message box on the screen  // Function definitionfunction function_alert($message) {          // Display the alert box     echo "<script>alert('$message');</script>";}    // Function callfunction_alert("Welcome to Geeks for Geeks");  ?>
Output: 
 
PHP is a server-side scripting language designed specifically for web development. You can learn PHP from the ground up by following this PHP Tutorial and PHP Examples.
gulshankumarar231
Picked
PHP
PHP Programs
Web Technologies
Web technologies Questions
PHP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to convert array to string in PHP ?
PHP | Converting string to Date and DateTime
How to pass JavaScript variables to PHP ?
Split a comma delimited string into an array in PHP
Download file from URL using PHP
How to convert array to string in PHP ?
How to pass JavaScript variables to PHP ?
Split a comma delimited string into an array in PHP
How to get parameters from a URL string in PHP?
How to declare a global variable in PHP?
PHP | array() Function - GeeksforGeeks

30 May, 2019
The array() function is an inbuilt function in PHP which is used to create an array. There are three types of array in PHP:
Indexed array: The array which contains numeric index.Syntax:array( val1, val2, val3, ... )
array( val1, val2, val3, ... )
Associative array: The array which contains name as keys.Syntax:array( key=>val, key=>val, key=>value, ... )
array( key=>val, key=>val, key=>value, ... )
Multidimensional array: The array which contains one or more arrays.Syntax:array( array( val11, val12, ...)
       array( val21, val22, ...)
       ... )
array( array( val11, val12, ...)
       array( val21, val22, ...)
       ... )
Parameters: This function accepts atmost two parameters as mentioned above and described below:
val: This parameter is used to hold the value of array.
key: This parameter is used to hold the key value:
Return Value: This function returns an array of parameters.
Below programs illustrates the array() function in PHP:
Program 1: This example illustrate the Indexed array.
<?php  // Create an array$sub = array("DBMS", "Algorithm", "C++", "JAVA");  // Find length of array$len = count( $sub );  // Loop to print array elementsfor( $i = 0; $i < $len; $i++) {    echo $sub[$i] . "\n";}?>
DBMS
Algorithm
C++
JAVA

Program 2: This example illustrate the Associative array.
<?php  // Declare an associative array$detail = array( "Name"=>"GeeksforGeeks",                  "Address"=>"Noida",                  "Type"=>"Educational site");  // Display the outputvar_dump ($detail);?> 
array(3) {
  ["Name"]=>
  string(13) "GeeksforGeeks"
  ["Address"]=>
  string(5) "Noida"
  ["Type"]=>
  string(16) "Educational site"
}

Program 3: This example illustrate the Multidimensional array.
<?php  // Declare 2D array$detail = array(array(1, 2, 3, 4),                array(5, 6, 7, 8));  // Display the outputvar_dump ($detail);?> 
array(2) {
  [0]=>
  array(4) {
    [0]=>
    int(1)
    [1]=>
    int(2)
    [2]=>
    int(3)
    [3]=>
    int(4)
  }
  [1]=>
  array(4) {
    [0]=>
    int(5)
    [1]=>
    int(6)
    [2]=>
    int(7)
    [3]=>
    int(8)
  }
}

PHP-function
PHP
Web Technologies
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 Insert Form Data into Database using PHP ?
How to convert array to string in PHP ?
PHP in_array() Function
How to pop an alert message box using PHP ?
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 ?
How to insert spaces/tabs in text using HTML/CSS?
AngularJS | lowercase Filter - GeeksforGeeks

22 Apr, 2019
The lowercase filter is used to convert a string into lowercase letters.
Syntax:
{{expression|lowercase}}
Example-1:
<!DOCTYPE html><html><script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js">  </script>  <body>      <h2>AngularJS - lowercase</h2>    <br>    <br>      <div ng-app="myApp"          ng-controller="myCtrl">          <strong>Input:</strong>        <br>        <input type="text"                ng-model="string">        <br>        <br>        <strong>Output:</strong>        <br> {{string|lowercase}}      </div>      <script>        var app = angular.module('myApp', []);        app.controller('myCtrl', function($scope) {            $scope.string = "";        });    </script>  </body>  </html>
Example-2:
<!DOCTYPE html><html><script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js">  </script>  <body>      <h2>AngularJS - lowercase</h2>    <br>    <br>      <div ng-app="myApp"         ng-controller="myCtrl">          <strong>First Name:</strong>        <br>        <input type="text"               ng-model="firstName">        <br>        <br>        <strong>Last Name:</strong>        <br>        <input type="text"                ng-model="lastName">        <br>          <strong>Output:</strong>        <br> {{firstName|lowercase}}             {{lastName|lowercase}}      </div>      <script>        var app = angular.module('myApp', []);        app.controller('myCtrl', function($scope) {            $scope.firstName = "";            $scope.lastName = "";        });    </script>  </body>  </html>
Output:
Picked
AngularJS
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Angular File Upload
Angular PrimeNG Dropdown Component
Angular | keyup event
Auth Guards in Angular 9/10/11
How to Display Spinner on the Screen till the data from the API loads using Angular 8 ?
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 ?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
C Program for Insertion Sort - GeeksforGeeks

23 Feb, 2022
Insertion sort is a simple sorting algorithm that works the way we sort playing cards in our hands. 
C
// C program for insertion sort#include <math.h>#include <stdio.h> /* Function to sort an array using insertion sort*/void insertionSort(int arr[], int n){    int i, key, j;    for (i = 1; i < n; i++) {        key = arr[i];        j = i - 1;         /* Move elements of arr[0..i-1], that are          greater than key, to one position ahead          of their current position */        while (j >= 0 && arr[j] > key) {            arr[j + 1] = arr[j];            j = j - 1;        }        arr[j + 1] = key;    }} // A utility function to print an array of size nvoid printArray(int arr[], int n){    int i;    for (i = 0; i < n; i++)        printf("%d ", arr[i]);    printf("\n");} /* Driver program to test insertion sort */int main(){    int arr[] = { 12, 11, 13, 5, 6 };    int n = sizeof(arr) / sizeof(arr[0]);     insertionSort(arr, n);    printArray(arr, n);     return 0;}
5 6 11 12 13
 
Please refer complete article on Insertion Sort for more details! 
simmytarika5
C Programs
Sorting
Sorting
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
C Program to read contents of Whole File
Producer Consumer Problem in C
C program to find the length of a string
Exit codes in C/C++ with Examples
Difference between break and continue statement in C
IDE | GeeksforGeeks | A computer science portal for geeks

Please enter your email address or userHandle.
12345678910111213141516171819202122232425262728293031323334353637https://pastelink.net/h8l4y6dghttps://paiza.io/projects/xSg95cR8tnZzN6zNgn6AJQ?language=phphttps://ide.geeksforgeeks.org/U0LUPqZlwYhttps://bitbin.it/HhEX27Hp/http://pastie.org/p/31mlJ3v8wxHBz0f6D2QhWOhttps://controlc.com/85b52465https://pastebin.com/riDehjRFhttps://paste2.org/hVzXg0aGhttps://p.teknik.io/QaScrhttps://www.bankier.pl/forum/zapisz-wiadomoschttps://www.techrum.vn/threads/qwsedrftgyhuj.537257/https://paste.rs/yGXhttps://ideone.com/rqXLbzhttps://rextester.com/l/php_online_compilerhttps://pasteio.com/xaHqr84LItD6http://cpp.sh/https://tech.io/snippet?l=phphttps://paste.cutelyst.org/ZCFYcqFSThttps://paste.artemix.org/-/jeyZfnhttps://0paste.com/345541https://paste.tbee-clan.de/GYJ94#http://paste.akingi.com/uQ53Rleshttps://paste.feed-the-beast.com/view/b82967echttps://caribbeanfever.com/photo/albums/qwedrftgyhj-1https://kukooo.com/promotion/business-promotion/qwedrftgyh_i192981https://webhitlist.com/profiles/blogs/qwedrftgyhujhttp://beterhbo.ning.com/profiles/blogs/wsedrftgyhujhttp://zacriley.ning.com/photo/albums/wsedrftgyhuj-1https://myclc.clcillinois.edu/web/jeff_test/tutoring/-/message_boards/message/32109862http://ptits.net/boards/t/59079/wsedrftgyhjk.aspxhttp://taylorhicks.ning.com/photo/photo/listForContributor?screenName=c42f49c509f4476f948f11b1a4654b56http://www.shadowville.com/board/general-discussions/qwedrftgyhuj#p509335ההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
https://ide.geeksforgeeks.org/jboZmyGimN
Output has been truncated..please click on RUN to regenrate complete output when required.
How to List all Files and Directories in FTP Server using Python?

13 Jan, 2021
FTP ( File Transfer Protocol ) is set of rules that computer follows to transfer files across computer network. It is TCP/IP based protocol. FTP lets clients share files. FTP is less secure because of files are shared as plain text without any encryption across the network. 
It is possible using python to retrieve list of file and directories from FTP server using its in-built ftplib module. ftplib is a pre-installed python package, which enables us to implement client side FTP protocol and in order to use it we simply have to import it like any other module. Basic approach to extract list or directories remains the same.
Import module
Connect to host on default port 
Syntax:
FTP(host=”, user=”, passwd=”, acct=”, timeout=None, source_address=None, *, encoding=’utf-8′)
Log in to the server using login() function
Syntax:
login(user=’anonymous’, passwd=”, acct=”)
Retrieve files and directories accordingly.
Close connection
Method 1: using retrlines()
Files and directories can be listed with retrlines() function. It returns filename, modified time, file size, owner, file type, permissions and Mode.
Syntax:
retrlines(cmd, callback=None)
Passing ‘LIST’ in this function retrieves files and information about those files.
Program:
Python3
from ftplib import FTP  ftp = FTP('ftp.us.debian.org')  ftp.login()  # changing directoryftp.cwd('debian')  ftp.retrlines('LIST')  ftp.quit()
Output:
fig: 2
This function could also be user to search for a file or directory. Search query can be entered in between asterisk(*).
Syntax:
ftp.retrlines(‘LIST *query*’)
Program: listing file names starting with “README”.
Python3
from ftplib import FTP  ftp = FTP('ftp.us.debian.org')  ftp.login()  # changing directoryftp.cwd('debian')  ftp.retrlines('LIST *README*')  ftp.quit()
Output:
fig: 3
Method 2: Using dir()
Files and directories can be listed with dir(). It returns filename, modified time, file size, owner, file type, permissions and Mode.
Syntax:
ftp.dir()
Program:
Python3
from ftplib import FTP  ftp = FTP('ftp.us.debian.org')  ftp.login()  # changing directoryftp.cwd('debian')  ftp.dir()  ftp.quit()
Output:
fig: 4
Method 3: Using nlst()
Files and directories can be listed with nlst(). It returns name of files and directories of list type.
Syntax:
ftp.nlst()
Program:
Python3
from ftplib import FTP  ftp = FTP('ftp.us.debian.org')  ftp.login()  # changing directoryftp.cwd('debian')  ftp.nlst()  ftp.quit()
Output:
fig: 5
Picked
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
Python | os.path.join() method
How to drop one or multiple columns in Pandas Dataframe
How To Convert Python Dictionary To JSON?
Check if element exists in list in Python
Python | Get unique values from a list
Python | datetime.timedelta() function
Python Tkinter - SpinBox range Validation - GeeksforGeeks

17 Sep, 2021
Prerequisites: Python GUI – tkinter, Python Tkinter – Validating Entry Widget Tkinter is a Python GUI (Graphical User Interface) module which is quick and easy to implement and is widely used for creating desktop applications. It provides various basic widgets to build a GUI program. In Tkinter, Spinbox is commonly used widget to select the fixed number of values from the range provided by the programmer, but by default Spinbox accepts all types of input given by user. Hence we need to validate the input and accept only those values which are in the range. Below is the implementation: 
Note: For more information on Validatecommand, refer to Python Tkinter – Validating Entry Widget  
Python3
from tkinter import * # Validating functiondef validate(user_input):    # check if the input is numeric    if  user_input.isdigit():        # Fetching minimum and maximum value of the spinbox        minval = int(root.nametowidget(spinbox).config('from')[4])        maxval = int(root.nametowidget(spinbox).config('to')[4])         # check if the number is within the range        if int(user_input) not in range(minval, maxval):            print ("Out of range")            return False         # Printing the user input to the console        print(user_input)        return True     # if input is blank string    elif user_input is "":        print(user_input)        return True     # return false is input is not numeric    else:        print("Not numeric")        return False  root = Tk()root.geometry("300x300")root.title("Spinbox Range Validation") # Creating Spinboxspinbox = Spinbox(root, from_ = 1, to = 1000)spinbox.pack()range_validation = root.register(validate) spinbox.config(validate ="key",         validatecommand =(range_validation, '% P')) root.mainloop()
Output:  
 
simmytarika5
abhishek0719kadiyan
Python-tkinter
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
Python Classes and Objects
How to drop one or multiple columns in Pandas Dataframe
Python | Get unique values from a list
Defaultdict in Python
Python | os.path.join() method
Create a directory in Python
Python | Pandas dataframe.groupby()
C# Program to Reverse a String without using Reverse() Method - GeeksforGeeks

16 Nov, 2021
C# has a built-in function to reverse a string. First, the string is converted to a character array by using ToCharArray() then by using the Reverse() the character array will be reversed, But in this article, we will understand how to Reverse a String without using Reverse().
Example
Input  : Geek
Output : keeG

Input  : For
Output : roF
Method 1: Using a for loop to reverse a string.
An empty string is declared and name as ReversedString. The input string will be iterated from right to left and each character is appended to the ReversedString. By the end of the iteration, the ReversedString will have the reversed string stored in it.
C#
// C# program to reverse a string using a for loopusing System; class GFG{     public static string Reverse(string Input) {          // Converting string to character array    char[] charArray = Input.ToCharArray();          // Declaring an empty string    string reversedString = String.Empty;          // Iterating the each character from right to left    for(int i = charArray.Length - 1; i > -1; i--)     {                  // Append each character to the reversedstring.        reversedString += charArray[i];     }         // Return the reversed string.    return reversedString;}  // Driver codestatic void Main(string[] args) {     Console.WriteLine(Reverse("GeeksForGeeks")); } }
skeeGroFskeeG
Method 2: Using a while loop to reverse a string.
In this method, an empty string is declared and name as reversedString now the input string will be iterated from right to left using the while loop, and each character is appended to the reversedString. By the end of the iteration, the reversedString will have the reversed string stored in it.
C#
// C# program to reverse a string using while loopusing System; class GFG{ public static string Reverse(string Input) {          // Converting string to character array    char[] charArray = Input.ToCharArray();          // Declaring an empty string    string reversedString = String.Empty;          int length, index;     length = charArray.Length - 1;    index = length;         // Iterating the each character from right to left     while (index > -1)     {                  // Appending character to the reversedstring.        reversedString = reversedString + charArray[index];         index--;     }         // Return the reversed string.    return reversedString;}  // Driver codestatic void Main(string[] args) {     Console.WriteLine(Reverse("GeeksForGeeks")); } }
skeeGroFskeeG
anikakapoor
sagartomar9927
CSharp LINQ
CSharp-programs
Picked
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#
Convert String to Character Array in C#
C# | How to insert an element in an Array?
Lambda Expressions in C#
Python Program for Selection Sort - GeeksforGeeks

30 Dec, 2020
The selection sort algorithm sorts an array by repeatedly finding the minimum element (considering ascending order) from unsorted part and putting it at the beginning. The algorithm maintains two subarrays in a given array.
1) The subarray which is already sorted.2) Remaining subarray which is unsorted.
In every iteration of selection sort, the minimum element (considering ascending order) from the unsorted subarray is picked and moved to the sorted subarray.
Python
# Python program for implementation of Selection# Sortimport sysA = [64, 25, 12, 22, 11]  # Traverse through all array elementsfor i in range(len(A)):          # Find the minimum element in remaining     # unsorted array    min_idx = i    for j in range(i+1, len(A)):        if A[min_idx] > A[j]:            min_idx = j                  # Swap the found minimum element with     # the first element            A[i], A[min_idx] = A[min_idx], A[i]  # Driver code to test aboveprint ("Sorted array")for i in range(len(A)):    print("%d" %A[i]), 
python sorting-exercises
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python | Convert string dictionary to dictionary
Iterate over characters of a string in Python
Python Program for factorial of a number
Python | Convert set into a list
Python | Convert a list into a tuple
Python | Check if a variable is string
Add a key:value pair to dictionary in Python
Appending to list in Python dictionary
Python program to find sum of elements in list
Python program to find largest number in a list
Creating a dataframe using CSV files - GeeksforGeeks

17 Feb, 2022
CSV files are the “comma-separated values”, these values are separated by commas, this file can be viewed like an excel file. In Python, Pandas is the most important library coming to data science. We need to deal with huge datasets while analyzing the data, which usually can get in CSV file format. Creating a pandas data frame using CSV files can be achieved in multiple ways.Note: Get the csv file used in the below examples from here.Method #1: Using read_csv() method: read_csv() is an important pandas function to read csv files and do operations on it.Example:  
Python3
# Python program to illustrate# creating a data frame using CSV files # import pandas moduleimport pandas as pd # creating a data framedf = pd.read_csv("CardioGoodFitness.csv")print(df.head())
Output: 
Method #2: Using read_table() method: read_table() is another important pandas function to read csv files and create data frame from it.Example:  
Python3
# Python program to illustrate# creating a data frame using CSV files # import pandas moduleimport pandas as pd # creating a data framedf = pd.read_table("CardioGoodFitness.csv", delimiter =", ")print(df.head())
Output: 
Method #3: Using the csv module: One can directly import the csv files using the csv module and then create a data frame using that csv file.Example:  
Python3
# Python program to illustrate# creating a data frame using CSV files # import pandas moduleimport pandas as pd# import csv moduleimport csv with open("CardioGoodFitness.csv") as csv_file:    # read the csv file    csv_reader = csv.reader(csv_file)     # now we can use this csv files into the pandas    df = pd.DataFrame([csv_reader], index = None) # iterating values of first columnfor val in list(df[1]):    print(val)
Output:  
['TM195', '18', 'Male', '14', 'Single', '3', '4', '29562', '112']
 
punamsingh628700
Python pandas-dataFrame
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 ?
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
How to drop one or multiple columns in Pandas Dataframe
Python Classes and Objects
Python | os.path.join() method
Python | Get unique values from a list
Create a directory in Python
Defaultdict in Python
Python | Pandas dataframe.groupby()
How to find the width of a div using vanilla JavaScript? - GeeksforGeeks

21 Jun, 2019
To measure the width of a div element we will utilize the offsetWidth property of JavaScript. This property of JavaScript returns an integer representing the layout width of an element and is measured in pixels.
Syntax:
element.offsetWidth
Returns the corresponding element’s layout pixel width.
Example:
The following program will illustrate the solution using offsetWidth:Program 1:
<!DOCTYPE html><html>  <head>    <title>        GeeksforGeeks    </title>      <style>        #GFG {            height: 30px;            width: 300px;            padding: 10px;            margin: 15px;            background-color: green;        }    </style></head>  <body>      <div id="GFG">        <b>Division</b>    </div>      <button type="button"            onclick="Geeks()">        Check    </button>      <script>        function Geeks() {              var elemWidth =                 document.getElementById("GFG").offsetWidth;            alert(elemWidth);        }    </script></body>  </html>
Output:
320
The another method to measure the width of a div element we will utilize the clientWidth() property of JavaScript.
The following program will illustrate the solution using clientWidth:Program 2:
<!DOCTYPE html><html>  <head>    <title>        GeeksforGeeks    </title>      <style>        #GFG {            height: 30px;            width: 300px;            padding: 10px;            margin: 15px;            background-color: green;        }    </style></head>  <body>      <div id="GFG">        <b>Division</b>    </div>      <button type="button" onclick="Geeks()">        Check    </button>      <script>        function Geeks() {              var elemWidth =                 document.getElementById("GFG").clientWidth;            alert(elemWidth);        }    </script></body>  </html>
Output:
320
Note: clientWidth returns the inner width which includes padding but excludes borders and scroll bars whereas offsetWidth returns the outer width which includes padding and borders.
JavaScript-Misc
Picked
HTML
JavaScript
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
Convert a string to an integer in JavaScript
Difference between var, let and const keywords in JavaScript
Differences between Functional Components and Class Components in React
How to calculate the number of days between two dates in javascript?