code-rag-bench/online-tutorials huggingface dataset:
What is the difference between UNIX TIMESTAMPS and MySQL TIMESTAMPS?

In MySQL, UNIX TIMESTAMPS are stored as 32-bit integers. On the other hand MySQL TIMESTAMPS are also stored in similar manner but represented in readable YYYY-MM-DD HH:MM:SS format.
mysql> Select UNIX_TIMESTAMP('2017-09-25 02:05:45') AS 'UNIXTIMESTAMP VALUE';
+---------------------+
| UNIXTIMESTAMP VALUE |
+---------------------+
| 1506285345          |
+---------------------+
1 row in set (0.00 sec)
The query above shows that UNIX TIMESTAMPS values are stored as 32 bit integers whose range is same as MySQL INTEGER data type range.
mysql> Select FROM_UNIXTIME(1506283345) AS 'MySQLTIMESTAMP VALUE';
+----------------------+
| MySQLTIMESTAMP VALUE |
+----------------------+
| 2017-09-25 01:32:25  |
+----------------------+
1 row in set (0.00 sec)
The query above shows that MySQL TIMESTAMPS values are also stored as 32 bit integers, but in a readable format, whose range is same as MySQL TIMESTAMP data type range.
How do I display the current date and time in an Android application?

This example demonstrates about How do I display the current date and time in an Android application
Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.
Step 2 − Add the following code to res/layout/activity_main.xml.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
   xmlns:tools="http://schemas.android.com/tools"
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   tools:context=".MainActivity">
   <TextView
      android:id="@+id/tvDateTime"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_centerInParent="true"
      android:layout_margin="16dp"
      android:gravity="center"
      android:padding="16dp"
      android:textSize="24sp" />
</RelativeLayout>
Step 3 − Add the following code to src/MainActivity.java
package app.com.sample;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
import java.text.DateFormat;
import java.util.Date;
public class MainActivity extends AppCompatActivity {
   @Override
   protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      TextView tvDateTime = findViewById(R.id.tvDateTime);
      String currentDateTimeString = DateFormat.getDateTimeInstance().format(new Date());
      tvDateTime.setText(currentDateTimeString);
   }
}
Step 4 − Add the following code to androidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="app.com.sample">
   <application
      android:allowBackup="true"
      android:icon="@mipmap/ic_launcher"
      android:label="@string/app_name"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:supportsRtl="true"
      android:theme="@style/AppTheme">
      <activity android:name=".MainActivity">
         <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
         </intent-filter>
      </activity>
   </application>
</manifest>
Let's try to run your application. I assume you have connected your actual Android Mobile device with your computer. To run the app from android studio, open one of your project's activity files and click Run  icon from the toolbar. Select your mobile device as an option and then check your mobile device which will display your default screen −
Click here to download the project code.
Kotlin Get Started

The easiest way to get started with Kotlin, is to use an IDE.
An IDE (Integrated Development Environment) is used to edit and compile code.
In this chapter, we will use IntelliJ (developed by the same people that created Kotlin) which is free to download from https://www.jetbrains.com/idea/download/.
Once IntelliJ is downloaded and installed, click on the 
New Project button to get started with IntelliJ:
Then click on "Kotlin" in the left side menu, and enter a name for your project:
Next, we need to install something called JDK (Java Development Kit) to get 
our Kotlin project up and going. Click on the "Project JDK" menu, select "Download JDK" and select a version and vendor (e.g. AdoptOpenJDK 11)
and click on the "Download" button:
When the JDK is downloaded and installed, choose it from the select menu and 
then click on the "Next" button and at last "Finish":
Now we can start working with our Kotlin project. Do not worry about all of the different buttons and functions in 
IntelliJ. For now, just open the src (source) folder, and follow the same steps as in the image below, to create a kotlin file:
Select the "File" option and add a name to your Kotlin file, for example "Main":
You have now created your first Kotlin file (Main.kt). Let's add some Kotlin code to it, and run the program to see how it works. Inside the Main.kt file, add the following code:
Main.kt
fun main() {
  println("Hello World")
}
Don't worry if you don't understand the code above - we will discuss it in detail in later chapters. For now, lets focus on how to run the code. Click on the Run button 
at the top navigation bar, then click "Run", and select "Mainkt". 
Next, IntelliJ will build your project, and run the Kotlin file. The output 
will look something like this:
As you can see, the output of the code was "Hello World", meaning that you have now written and executed your first Kotlin program!
When learning Kotlin at w3schools.com, you can use our "Try it Yourself" tool, which shows both the code and the result. This will make it easier for 
you to understand every part as we move forward:
Code:
fun main() {
  println("Hello World")
}
Result:
We just launchedW3Schools videos
Get certifiedby completinga course today!
If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:
help@w3schools.com
Your message has been sent to W3Schools.
What MySQL COALESCE() function returns if all the arguments provided to it are NULL?

If all the values in MySQL COALESCE() function are NULL then it returns NULL as the output. It means that this function does not find any non-NULL value in the list.
mysql> Select COALESCE(NULL, NULL, NULL, NULL);
+----------------------------------+
| COALESCE(NULL, NULL, NULL, NULL) |
+----------------------------------+
|                             NULL |
+----------------------------------+

1 row in set (0.00 sec)
java.time.LocalDate.atTime() Method Example

The java.time.LocalDate.atTime(OffsetTime time) method combines this date with an offset time to create an OffsetDateTime.
Following is the declaration for java.time.LocalDate.atTime(OffsetTime time) method.
public OffsetDateTime atTime(OffsetTime time)

time − the time to combine with, not null.
the offset date-time formed from this date and the specified time, not null.
The following example shows the usage of java.time.LocalDate.atTime(OffsetTime time) method.
package com.tutorialspoint;

import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.time.OffsetTime;

public class LocalDateDemo {
   public static void main(String[] args) {

      LocalDate date = LocalDate.parse("2017-02-03");
      System.out.println(date);  
      OffsetTime time = OffsetTime.now();
      OffsetDateTime date1 = date.atTime(time);
      System.out.println(date1);  
   }
}
Let us compile and run the above program, this will produce the following result −
2017-02-03
2017-02-03T11:47:42.530+05:30

 Print
 Add Notes
 Bookmark this page
Vim - Using Vim As Ide

We can configure Vim to use it as an IDE. In this section, we will discuss following items
Syntax highlighting
Smart indentation
Bounce
Execute shell commands
Configuring ctags and csope
Auto-completion and auto-suggestion
Syntax highlighting is one of the important features of IDE. To enable syntax highlighting use −
:syntax on

For instance, below image show syntax highlighting for C code −
To disable syntax highlighting use −
:syntax off

When syntax highlighting is disabled, it will show following output −
To perform auto and smart indentation use following commands −
: set autoindent 
: set smartindent

In addition to this you can use below command to auto-indent C code −
: set cindent

If you are using programming language which uses curly braces to combine multiple statements then % key will be your friend. This key will jump between start and end of curly braces quickly.
For instance, you are at line 11 and execute % command then it will move cursor the line 4. Below image shows this −
To execute single command from Vim editor user −
:!<command>

For instance, to execute pwd command use following syntax −
:!pwd

However, if you want to multiple shell commands then execute following command −
:shell

Above command will give you terminal access, where you can execute multiple commands. Once you are done with it, just type exit command which will return back to Vim session.
Combination of ctags and csope provides many useful features like go to function definition, go to function declaration, find function calls, search file, and many more. Perform below steps to configure these tool −
Generate tags using following command −
$ ctags <file>

This command will generate new file namely tags
Provide tag file to vim using following command −
:set tags = tag

Now move your cursor under function name and press Ctrl + ] to go to function definition.
Use Ctrl + t to come back to previous position.
To install and configure cscope perform following steps −
Install cscope
$ sudo apt-get install cscope

Generate ctags and launch main window
$ cscope –R

User Ctrl + d to close cscope window
We can use following commands for auto-completion −
Word completion
Line completion
File name completion
Note that we have to use these commands in insert mode.

    46 Lectures 
     5.5 hours 

 Jason Cannon
 Print
 Add Notes
 Bookmark this page
How to print Superscript and Subscript in Python? - GeeksforGeeks

24 Jan, 2021
Whenever we are working with formulas there may be a need of writing the given formula in a given format which may require subscripts or superscripts. There are several methods available to print subscripts and superscripts in Python. We will be discussing two of them below –
Using maketrans() and translate() :
We can make two strings one for the normal characters and the other for the subscript/superscript characters. After this, we can use the maketrans() method which returns a mapping that can be used with the translate() method to replace the specified characters. It can be implemented for superscripts as 
Python3
# function to convert to superscriptdef get_super(x):    normal = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-=()"    super_s = "ABcDEfGHIJKLMNOPQRsTUVWxyzabcdefghɪjklmnop۹rstuvwxyz0123456789+−=()"    res = x.maketrans(''.join(normal), ''.join(super_s))    return x.translate(res)  # display supersciptprint(get_super('GeeksforGeeks')) #GeeksforGeeks
Output:
GeeksforGeeks
And for subscripts, we can implement it as
Python3
# function to convert to subscriptdef get_sub(x):    normal = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-=()"    sub_s = "a8CDeբGhijklmnopQrstuvwxγZa♭꜀ᑯeբ9hijklmnop૧rstuvwxγ20123456789+−=()"    res = x.maketrans(''.join(normal), ''.join(sub_s))    return x.translate(res)  # display subscriptprint('H{}SO{}'.format(get_sub('2'),get_sub('4'))) #H2SO4
Output:
H2SO4
Using Unicode subscripts and superscripts:
The following table gives the subscripts and superscripts of the Unicode characters:
With the help of the Unicode character, we can implement this in our codes as –
Python3
# subscriptprint(u'H\u2082SO\u2084')  # H2SO4  # superscriptprint("x\u00b2 + y\u00b2 = 2")  # x2 + y2 = 2
Output:
H2SO4
x2 + y2 = 2
Picked
python-string
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
How to Install PIP on Windows ?
Selecting rows in pandas DataFrame based on conditions
How to drop one or multiple columns in Pandas Dataframe
Python | Get unique values from a list
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
Defaultdict in Python
Python | os.path.join() method
Create a directory in Python
Bar Plot in Matplotlib
Tryit Editor v3.7

Tryit: HTML image map - execute a function
CSS Layout - The z-index Property

The z-index property specifies the 
stack order of an element.
When elements are positioned, they can overlap other elements.
The z-index property specifies the stack order of an element (which element should be placed in front of, or behind, the others).
An element can have a positive or negative stack order:
Because the image has a z-index of -1, it will be placed behind the text.
Note: z-index only works on positioned elements (position: absolute, 
position: relative, position: fixed, or position: sticky) and flex items 
(elements that are direct children of display: flex elements).
Here we see that an element with greater stack order is always above an element with a lower stack order:
If two positioned elements overlap each other without a z-index 
specified, the element defined last in the HTML code will be shown on top.
Same example as above, but here with no z-index specified:
Both the header and the paragraph are positioned at the top of the page.
Make sure that the header is placed on top of the paragraph.
<style>
 {
  position: absolute;
  top: 0;
  : 1;  
}
 {
  position: absolute;
  top: 0;
  : 0;
}
</style>

<body>
  <h1 id="mytitle">This is a heading</h1>
  <p id="myintro">This is a paragraph</p>
</body>

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

Here we will see how to subtract two 8-bit numbers using this microcontroller. The register A(Accumulator) is used as one operand in the operations. There are seven registers R0 – R7 in different register banks. We can use any of them as the second operand.
We are taking two number73H and BDH at location 20H and 21H, After subtracting the result will be stored at location 30H and 31H.  
MOVR0,#20H;set source address 20H to R0
MOVR1,#30H;set destination address 30H to R1

MOVA,@R0;take the value from source to register A
MOVR5,A; Move the value from A to R5
MOVR4,#00H; Clear register R4 to store borrow

INCR0; Point to the next location
MOVA,@R0; take the value from source to register A
MOVR3,A; store second byte
MOVA,R5;get back the first operand
SUBBA,R3; Subtract R3 from A
       JNCSAVE
       INCR4; Increment R4 to get borrow
       MOVB,R4;Get borrow to register B
       MOV@R1,B; Store the borrow first
       INCR1; Increase R1 to point to the next address

SAVE:  MOV@R1,A; Store the result
HALT:  SJMP HALT ;Stop the program
So by subtracting 73H –BDH, the result will be B6H. At location 30H, we will get 01H. This indicates that the result is negative. The get the actual value from result B6H, we have to perform 2’s complement operation. After performing 2’s Complement, the result will be -4AH.
LISP - Lambda Functions

At times you may need a function in only one place in your program and the function is so trivial that you may not give it a name, or may not like to store it in the symbol table, and would rather write an unnamed or anonymous function.
LISP allows you to write anonymous functions that are evaluated only when they are encountered in the program. These functions are called Lambda functions.
You can create such functions using the lambda expression. The syntax for the lambda expression is as follows −
(lambda (parameters) body)
A lambda form cannot be evaluated and it must appear only where LISP expects to find a function.
Create a new source code file named main.lisp and type the following code in it.
(write ((lambda (a b c x)
   (+ (* a (* x x)) (* b x) c))
   4 2 9 3)
)
When you execute the code, it returns the following result −
51


    79 Lectures 
     7 hours 

 Arnold Higuit
 Print
 Add Notes
 Bookmark this page
Check if a File exists in C#

Use the File.exists method in C# to check if a file exits in C# or not.
Firstly, check whether the file is present in the current directory.
if (File.Exists("MyFile.txt")) {
   Console.WriteLine("The file exists.");
}
After that check whether the file exist in a directory or not.
if (File.Exists(@"D:\myfile.txt")) {
   Console.WriteLine("The file exists.");
}
Let us see the complete example to check if a file exists in C#.
 Live Demo
using System;
using System.IO;
class Demo {
   static void Main() {
      if (File.Exists("MyFile.txt")) {
         Console.WriteLine("File exists...");
      } else {
         Console.WriteLine("File does not exist in the current directory!");
      }
      if (File.Exists(@"D:\myfile.txt")) {
         Console.WriteLine("File exists...");
      } else {
         Console.WriteLine("File does not exist in the D directory!");
      }
   }
}
File does not exist in the current directory!
File does not exist in the D directory!
PLSQL | UPPER Function

11 Oct, 2019
The PLSQL UPPER function is used for converting all letters in the specified string to uppercase. If there are characters in the string that are not letters, they are unaffected by this function.
The char to be converted can be any of the datatypes such as CHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB, or NCLOB. The value returned by the UPPER function is the same datatype as char. The database sets the case of the characters based on the binary mapping defined for the underlying character set.
Syntax:
UPPER( string )
Parameters Used:
string – It is used to specify the string which needs to be converted.
Return Value:The UPPER function in PLSQL returns a string value.
Supported Versions of Oracle/PLSQL
Oracle 12cOracle 11gOracle 10gOracle 9iOracle 8i
Oracle 12c
Oracle 11g
Oracle 10g
Oracle 9i
Oracle 8i
Example-1: Passing a string as an argument with first character in uppercase and rest of the characters in lowercase.
DECLARE 
   Test_String string(20) := 'Geeksforgeeks';
   
BEGIN 
   dbms_output.put_line(UPPER(Test_String)); 
   
END;  
Output:
GEEKSFORGEEKS 
Example-2: Passing a string as an argument with all the characters in lowercase.
DECLARE 
   Test_String string(20) := 'geeksforgeeks';
   
BEGIN 
   dbms_output.put_line(UPPER(Test_String)); 
   
END;   
Output:
GEEKSFORGEEKS 
Example-3: Passing a string as an argument with numeric values and characters in lowercase.
DECLARE 
   Test_String string(20) := '123geeksforgeeks123';
   
BEGIN 
   dbms_output.put_line(UPPER(Test_String)); 
   
END; 
Output:
123GEEKSFORGEEKS123 
Advantage:The UPPER function accepts any of the datatypes CHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB, or NCLOB in the input_string.
SQL-PL/SQL
SQL
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to get list of parameters name from a function in Python?

29 Dec, 2020
In this article, we are going to discuss how to get list parameters from a function in Python. The inspect module helps in checking the objects present in the code that we have written. We are going to use two methods i.e. signature() and getargspec() methods from the inspect module to get the list of parameters name of function or method passed as an argument in one of the methods.
Below are some programs which depict how to use the signature() method of the  inspect module to get the list of parameters name:
Example 1: Getting the parameter list of a method.
Python3
# import required modulesimport inspectimport collections  # use signature()print(inspect.signature(collections.Counter))
Output:
(*args, **kwds)
Example 2: Getting the parameter list of an explicit function.
Python3
# explicit functiondef fun(a, b):    return a**b  # import required modules import inspect   # use signature() print(inspect.signature(fun)) 
Output:
(a, b)
Example 3: Getting the parameter list of an in-built function.
Python3
# import required modules import inspect   # use signature() print(inspect.signature(len))
Output:
(obj, /)
Below are some programs which depict how to use the getargspec() method of the  inspect module to get the list of parameters name:
Example 1: Getting the parameter list of a method.
Python3
# import required modulesimport inspectimport collections  # use getargspec()print(inspect.getargspec(collections.Counter))
Output:
ArgSpec(args=[], varargs=’args’, keywords=’kwds’, defaults=None)
Example 2: Getting the parameter list of an explicit function.
Python3
# explicit functiondef fun(a, b):    return a**b  # import required modules import inspect   # use getargspec() print(inspect.getargspec(fun)) 
Output:
ArgSpec(args=[‘a’, ‘b’], varargs=None, keywords=None, defaults=None)
Example 3: Getting the parameter list of an in-built function.
Python3
# import required modules import inspect   # use getargspec() print(inspect.getargspec(len))
Output:
ArgSpec(args=[‘obj’], varargs=None, keywords=None, defaults=None)
Picked
Python function-programs
Python-Functions
Technical Scripter 2020
Python
Technical Scripter
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
Introduction To PYTHON
Python OOPs Concepts
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
settextstyle function in C

01 Dec, 2021
The header file graphics.h contains settextstyle() function which is used to change the way in which text appears. Using it we can modify the size of text, change direction of text and change the font of text. Syntax :  
void settextstyle(int font, int direction, int font_size);

where,
font argument specifies the font of text,
Direction can be HORIZ_DIR (Left to right) 
or VERT_DIR (Bottom to top).
Examples :  
Input : font = 8, direction = 0, font_size = 5
Output : 
Input : font = 3, direction = 0, font_size = 5
Output : 
The table below shows the fonts with their INT values and appearance:
Below is the implementation of settextstyle() function :  
CPP
// C++ implementation for// settextstyle() function#include <graphics.h> // driver codeint main(){    // gm is Graphics mode which is    // a computer display mode that    // generates image using pixels.    // DETECT is a macro defined in    // "graphics.h" header file    int gd = DETECT, gm;     // initgraph initializes the    // graphics system by loading    // a graphics driver from disk    initgraph(&gd, &gm, "");     // location of text    int x = 150;    int y = 150;     // font style    int font = 8;     // font direction    int direction = 0;     // font size    int font_size = 5;     // for setting text style    settextstyle(font, direction, font_size);     // for printing text in graphics window    outtextxy(x, y, "Geeks For Geeks");     getch();         // closegraph function closes the    // graphics mode and deallocates    // all memory allocated by graphics    // system .    closegraph();         return 0;}
Output:  
Hax4us
theshaunsaw
c-graphics
computer-graphics
C Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python – Convert Snake Case String to Camel Case

01 Oct, 2020
Given a snake case string, convert to camel case.
Input : test_str = ‘geeksforgeeks_is_best_for_geeks’ Output : geeksforgeeksIsBestForGeeks Explanation : String converted to Camel Case.
Input : test_str = ‘geeksforgeeks_best_for_geeks’ Output : geeksforgeeksBestForGeeks Explanation : String converted to Camel Case. 
Method #1 : Using split() + join() + title() + generator expression
The combination of above functions can be used to solve this problem. In this, we first split all underscores, and then join the string appending initial word, followed by title cased words using generator expression and title().
Python3
# Python3 code to demonstrate working of # Convert Snake Case String to Camel Case# Using split() + join() + title() + generator expression  # initializing stringtest_str = 'geeksforgeeks_is_best'  # printing original stringprint("The original string is : " + str(test_str))  # split underscore using splittemp = test_str.split('_')  # joining result res = temp[0] + ''.join(ele.title() for ele in temp[1:])      # printing result print("The camel case string is : " + str(res)) 
The original string is : geeksforgeeks_is_best
The camel case string is : geeksforgeeksIsBest

Method #2  : Using  split() + join() + title() + map()
The combination of above functions can be used to solve this problem. In this, we perform the task of extending logic to entire strings using map(). 
Python3
# Python3 code to demonstrate working of # Convert Snake Case String to Camel Case# Using split() + join() + title() + map()  # initializing stringtest_str = 'geeksforgeeks_is_best'  # printing original stringprint("The original string is : " + str(test_str))  # saving first and rest using split()init, *temp = test_str.split('_')  # using map() to get all words other than 1st# and titlecasing themres = ''.join([init.lower(), *map(str.title, temp)])      # printing result print("The camel case string is : " + str(res)) 
The original string is : geeksforgeeks_is_best
The camel case string is : geeksforgeeksIsBest

Python string-programs
Python
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to set the dropdown button in the center?

26 Aug, 2020
Dropdown menu is a menu that offers a list of options to choose from. The title of the menu is always in display and the rest of the items are hidden. It is a toggleable menu in which all the items can be shown by clicking on it.
Dropdown button can be positioned in the center of the page by setting the “text-align” property of dropdown div to center. The following example contains a simple Bootstrap dropdown menu with an added class “my-menu”. The property “text-align: center” is added to the class.
Example: Here, the property “text-align: center” aligns the content of dropdown div to center, which sets the dropdown button to the center.
<!DOCTYPE html><html>    <head>        <link rel="stylesheet"               href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"               integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z"               crossorigin="anonymous" />          <style>            .my-menu {/*Sets all the content of dropdown div to center*/                text-align: center;             }        </style>    </head>      <body><!-- my-menu class is added to dropdown div for styling-->        <div class="dropdown my-menu">            <button class="btn btn-secondary                            dropdown-toggle"                     type="button"                    id="dropdownMenuButton"                     data-toggle="dropdown"                     aria-haspopup="true"                     aria-expanded="false">                Dropdown button            </button>            <div class="dropdown-menu"                  aria-labelledby="dropdownMenuButton">                <a class="dropdown-item"                    href="#">Action 1</a>                <a class="dropdown-item"                    href="#">Action 2</a>                <a class="dropdown-item"                    href="#">Action 3</a>            </div>        </div>          <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"                 integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN"                 crossorigin="anonymous">      </script>        <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"                 integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"                 crossorigin="anonymous">      </script>        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"                 integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"                 crossorigin="anonymous">      </script>    </body></html>
Output:
Bootstrap-Misc
Bootstrap
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Removing the object from the top of the Stack in C#

28 Jan, 2019
Stack<T>.Pop Method is used to remove and returns the object at the top of the Stack<T>. This method comes under the System.Collections.Generic namespace.
Syntax:
public T Pop ();
Return Value: It returns the Object which is to be removed from the top of the Stack.
Exception : This method will give InvalidOperationException if the Stack<T> is empty.
Below programs illustrate the use of the above-discussed method:
Example 1:
// C# Program to illustrate the// use of Stack<T>.Pop() Methodusing System;using System.Collections.Generic;  class GFG {      // Main Method    public static void Main()    {          // Creating a Stack of Strings        Stack<string> myStack = new Stack<string>();          // Inserting the elements into the Stack        myStack.Push("Geeks");        myStack.Push("Geeks Classes");        myStack.Push("Noida");        myStack.Push("Data Structures");        myStack.Push("GeeksforGeeks");          Console.WriteLine("Number of elements in the Stack: {0}",                                                 myStack.Count);          // Retrieveing top element of Stack        Console.Write("Top element of Stack is: ");        Console.Write(myStack.Pop());          // printing the no of Stack element        // after Pop operation        Console.WriteLine("\nNumber of elements in the Stack: {0}",                                                    myStack.Count);    }}
Number of elements in the Stack: 5
Top element of Stack is: GeeksforGeeks
Number of elements in the Stack: 4

Example 2:
// C# Program to illustrate the// use of Stack<T>.Pop() Methodusing System;using System.Collections.Generic;  class GFG {      // Main Method    public static void Main()    {          // Creating a Stack of integers        Stack<int> myStack = new Stack<int>();          // Inserting the elements into the Stack        myStack.Push(7);        myStack.Push(9);          Console.WriteLine("Number of elements in the Stack: {0}",                                                  myStack.Count);          // Retrieveing top element of Stack        Console.Write("Top element of Stack is: ");        Console.Write(myStack.Pop());          // printing the no of Stack element        // after Pop operation        Console.WriteLine("\nNumber of elements in the Stack: {0}",                                                    myStack.Count);    }}
Number of elements in the Stack: 2
Top element of Stack is: 9
Number of elements in the Stack: 1

Reference:
https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.stack-1.pop?view=netframework-4.7.2
CSharp-Generic-Namespace
CSharp-Generic-Stack
CSharp-method
C#
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python | Set 3 (Strings, Lists, Tuples, Iterations)

13 Jul, 2022
In the previous article, we read about the basics of Python. Now, we continue with some more python concepts.
A string is a sequence of characters that can be a combination of letters, numbers, and special characters. It can be declared in python by using single quotes, double quotes, or even triple quotes. These quotes are not a part of a string, they define only starting and ending of the string.  Strings are immutable, i.e., they cannot be changed. Each element of the string can be accessed using indexing or slicing operations.
Python
# Assigning string to a variablea = 'This is a string'print (a)b = "This is a string"print (b)c= '''This is a string'''print (c)
Output:
This is a string
This is a string
This is a string
Lists are one of the most powerful data structures in python. Lists are sequenced data types.  In Python, an empty list is created using list() function. They are just like the arrays declared in other languages. But the most powerful thing is that list need not be always homogeneous. A single list can contain strings, integers, as well as other objects. Lists can also be used for implementing stacks and queues. Lists are mutable, i.e., they can be altered once declared. The elements of list can be accessed using indexing and slicing operations.
Python
# Declaring a listL = [1, "a" , "string" , 1+2]print L#Adding an element in the listL.append(6)    print L#Deleting last element from a listL.pop()print L#Displaying Second element of the listprint L[1]
The output is:  
Chapters
descriptions off, selected
captions settings, opens captions settings dialog
captions off, selected
English
This is a modal window.
Beginning of dialog window. Escape will cancel and close the window.
End of dialog window.
[1, 'a', 'string', 3]
[1, 'a', 'string', 3, 6]
[1, 'a', 'string', 3]
a
Tuples in Python: A tuple is a sequence of immutable Python objects. Tuples are just like lists with the exception that tuples cannot be changed once declared. Tuples are usually faster than lists.
Python
tup = (1, "a", "string", 1+2)print(tup)print(tup[1])
The output is : 
(1, 'a', 'string', 3)
a
Iterations in Python: Iterations or looping can be performed in python by ‘for’ and ‘while’ loops. Apart from iterating upon a particular condition, we can also iterate on strings, lists, and tuples.
Example 1: Iteration by while loop for a condition
Python
i = 1while (i < 10):    print(i)    i += 1
The output is: 
1
2
3
4
5
6
7
8
9 
Example 2: Iteration by for loop on the string
Python
s = "Hello World"for i in s:    print(i)
The output is: 
H
e
l
l
o
 
W
o
r
l
d
Example 3: Iteration by for loop on list
Python
L = [1, 4, 5, 7, 8, 9]for i in L:    print(i)
The output is: 
1
4
5
7
8
9
Example 4: Iteration by for loop for range
Python
for i in range(0, 10):    print(i)
The output is: 
0
1
2
3
4
5
6
7
8
9 

Next Article – Python: Dictionary and Keywords
Quiz on Data Types in Python
micronick_02
mandvimishra123
sheetal18june
python-list
python-tuple
Python
School Programming
python-list
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
while loop in Julia

19 Feb, 2020
In Julia, while loop is used to execute a block of statements repeatedly until a given condition is satisfied. And when the condition becomes false, the line immediately after the loop in the program is executed. If the condition is false when the while loop is executed first time, then the body of the loop will never be executed.  Syntax :
while expression

    statement(s)

end

Here, ‘while‘ is the keyword to start while loop, ‘expression‘ is the condition to be satisfied, and ‘end‘ is the keyword to end the while loop.
Note: A block of code is the set of statements enclosed between the conditional statement and the ‘end‘ statement.
Example 1:
# Julia program to illustrate # the use of while loop  # Declaring ArrayArray = ["Geeks", "For", "Geeks"]  # Iterator Variablei = 1  # while loopwhile i <= length(Array)      # Assigning value to object    Object = Array[i]          # Printing object    println("$Object")          # Updating iterator globally    global i += 1      # Ending Loopend
Output: Example 2:
# Julia program to generate # the Fibonacci sequence   # The length of Fibonacci sequencelength = 15  # The first two valuesa = 0b = 1  # Iterator Valueitr = 0  # while loop conditionwhile itr < length     # Printing fibonacci value   print(a, ", ")        # Updating value   c = a + b        # Modify values   global a = b   global b = c        # Updating iterator   global itr += 1  # End of while loopend
Julia-loops
Julia
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
HTML | <img> vspace Attribute

06 Jan, 2022
The HTML <img> vspace Attribute is used to specify the number of whitespaces on bottom and top side of an image.
Note: The HTML  vspace Attribute not supported by HTML5
Syntax:
<img vspace="pixels">
Attribute Values:
pixels: It specifies the number of whitespaces on top and bottom of an image in terms of pixels.
Example:
<!DOCTYPE html> <html>   <head>     <title>         HTML img vspace Attribute     </title>           <style>        h1, h2 {            color:green;            text-align:center;        }        h3 {            font-weight:bold;        }    </style></head>   <body>       <h1 style="color:green;">         GeeksforGeeks     </h1>       <h2>HTML <img> vspace Attribute</h2>          <h3>Image without vspace Attribute</h3>          <p>        <img id="myImage" src= "https://media.geeksforgeeks.org/wp-content/uploads/gfg-40.png"            alt="Submit" width="42"            height="42" align="middle"/>        It is a computer science portal for geeks    </p>          <h3>Image with vspace Attribute</h3>          <p>        <img id="myImage" src= "https://media.geeksforgeeks.org/wp-content/uploads/gfg-40.png"            alt="Submit" vspace = "60" width="42" height="42"            align="middle"/>        It is a computer science portal for geeks    </p></body>   </html>                    
Output:
Supported Browsers: The browser supported by HTML <img> vspace Attribute are listed below:
Google Chrome
Internet Explorer
Firefox
Safari
Opera
ManasChhabra2
HTML-Attributes
HTML
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Reading and Writing to text files in Python

Like other languages, Python provides some inbuilt functions for reading, writing, or accessing files. Python can handle mainly two types of files. The normal text file and the binary files.
 For the text files, each lines are terminated with a special character '\n' (It is known as EOL or End Of Line). For the Binary file, there is no line ending character. It saves the data after converting the content into bit stream.
In this section we will discuss about the text files.
r
It is Read Only mode. It opens the text file for reading. When the file is not present, it raises I/O Error.
r+
This mode for Reading and Writing. When the file is not present, it will raise I/O Error.
w
It is for write only jobs. When file is not present, it will create a file first, then start writing, when the file is present, it will remove the contents of that file, and start writing from beginning.
w+
It is Write and Read mode. When file is not present, it can create the file, or when the file is present, the data will be overwritten.
a
This is append mode. So it writes data at the end of a file.
a+
Append and Read mode. It can append data as well as read the data.
Now see how a file can be written using writelines() and write() method.
 Live Demo
#Create an empty file and write some lines
line1 = 'This is first line. \n'
lines = ['This is another line to store into file.\n',
   'The Third Line for the file.\n',
   'Another line... !@#$%^&*()_+.\n',
   'End Line']
#open the file as write mode
my_file = open('file_read_write.txt', 'w')
my_file.write(line1)
my_file.writelines(lines) #Write multiple lines
my_file.close()
print('Writing Complete')
Writing Complete

After writing the lines, we are appending some lines into the file.
 Live Demo
#program to append some lines
line1 = '\n\nThis is a new line. This line will be appended. \n'
#open the file as append mode
my_file = open('file_read_write.txt', 'a')
my_file.write(line1)
my_file.close()
print('Appending Done')
Appending Done

At last, we will see how to read the file content from the read() and readline() method. We can provide some integer number 'n' to get first 'n' characters.
#program to read from file
#open the file as read mode
my_file = open('file_read_write.txt', 'r')
print('Show the full content:')
print(my_file.read())
#Show first two lines
my_file.seek(0)
print('First two lines:')
print(my_file.readline(), end = '')
print(my_file.readline(), end = '')
#Show upto 25 characters
my_file.seek(0)
print('\n\nFirst 25 characters:')
print(my_file.read(25), end = '')
my_file.close()
Show the full content:
This is first line. 
This is another line to store into file.
The Third Line for the file.
Another line... !@#$%^&*()_+.
End Line

This is a new line. This line will be appended. 

First two lines:
This is first line. 
This is another line to store into file.

First 25 characters:
This is first line. 
This
Set.clear() function in JavaScript

The clear() function of the Set object removes all elements from the current Set object.
Its Syntax is as follows
setObj.clear()
 Live Demo
<html>
<head>
   <title>JavaScript Example</title>
</head>
<body>
   <script type="text/javascript">
      const setObj = new Set();
      setObj.add('Java');
      setObj.add('JavaFX');
      setObj.add('JavaScript');
      setObj.add('HBase');
      setObj.clear();
      document.write("Contents of the Set:");
      for (let item of setObj) {
         document.write(item);
         document.write("<br>");
      }
   </script>
</body>
</html>
Contents of the Set:
Autoboxing and Unboxing in Java


Autoboxing refers to the automatic conversion of a primitive type variable to its corresponding wrapper class object. The compiler automatically handles the conversion when a primitive value is −
Passed as an argument to a function which is expecting a wrapper class object.
Passed as an argument to a function which is expecting a wrapper class object.
assigned to a variable of the type of wrapper class.
assigned to a variable of the type of wrapper class.
Consider the following example.
Live Demo
import java.util.ArrayList;
import java.util.List;

public class Tester {
   public static void main(String[] args) {
      List<Integer> list = new ArrayList<>();

      for(int i = 0; i< 10; i++){
         //autoboxing by passing as an argument
         //int values is converted to Integer
         //by compiler during compilation
         list.add(i);
      }

      System.out.println(list);

      char c = 'a';          
      //autoboxing by assigning an char to Character object
      Character ch = c;
      System.out.println(ch);
   }
}
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
a
Unboxing is reverse of Autoboxing and it refers to the automatic conversion of a wrapper object to its corresponding primitive variable. The compiler automatically handles the conversion when a wrapper object is −
Passed as an argument to a function which is expecting a primitive data type variable.
Passed as an argument to a function which is expecting a primitive data type variable.
assigned to a variable of the type of primitive data type variable.
assigned to a variable of the type of primitive data type variable.
Consider the following example.
Live Demo
public class Tester {
   public static void main(String[] args) {
      Integer integer = new Integer(-10);
      //autoboxing by passing as an argument
      //Integer object is converted to int
      //by compiler during compilation
      int i = abs(integer);        
      System.out.println(i);

      //autoboxing by assigning an Integer object to int variable
      int j = integer;        
      System.out.println(j);
   }
 
   private static int abs(int i){
      return (i < 0)? -i: i;
   }
}
10
-10
Advanced Excel Financial - PMT Function

The PMT function calculates the payment for a loan based on constant payments and a constant interest rate.
PMT (rate, nper, pv, [fv], [type])

The present value, or the total amount that a series of future payments is worth now.
Also known as the principal.
The future value, or a cash balance you want to attain after the last payment is made.
If fv is omitted, it is assumed to be 0 (zero), that is, the future value of a loan is 0.
The number 0 (zero) or 1 and indicates when payments are due.
Look at the Type-Payment Table below.
The payment returned by PMT includes principal and interest but no taxes, reserve payments, or fees sometimes associated with loans.
The payment returned by PMT includes principal and interest but no taxes, reserve payments, or fees sometimes associated with loans.
Make sure that you are consistent about the units you use for specifying rate and nper

If you make monthly payments on a four-year loan at an annual interest rate of 12 percent, use 12%/12 for rate and 4*12 for nper
If you make annual payments on the same loan, use 12 percent for rate and 4 for nper


Make sure that you are consistent about the units you use for specifying rate and nper
If you make monthly payments on a four-year loan at an annual interest rate of 12 percent, use 12%/12 for rate and 4*12 for nper
If you make monthly payments on a four-year loan at an annual interest rate of 12 percent, use 12%/12 for rate and 4*12 for nper
If you make annual payments on the same loan, use 12 percent for rate and 4 for nper
If you make annual payments on the same loan, use 12 percent for rate and 4 for nper
To find the total amount paid over the duration of the loan, multiply the returned PMT value by nper.
To find the total amount paid over the duration of the loan, multiply the returned PMT value by nper.
If the specified value of rate is less than or equal to -1, PMT returns #NUM! error value.
If the specified value of rate is less than or equal to -1, PMT returns #NUM! error value.
If the specified value of nper is equal to 0, PMT returns #NUM! error value.
If the specified value of nper is equal to 0, PMT returns #NUM! error value.
If any of the specified arguments is non-numeric, PMT returns #VALUE! error value.
If any of the specified arguments is non-numeric, PMT returns #VALUE! error value.
Excel 2007, Excel 2010, Excel 2013, Excel 2016

    296 Lectures 
     146 hours 

 Arun Motoori

    56 Lectures 
     5.5 hours 

 Pavan Lalwani

    120 Lectures 
     6.5 hours 

 Inf Sid

    134 Lectures 
     8.5 hours 

 Yoda Learning

    46 Lectures 
     7.5 hours 

 William Fiset

    25 Lectures 
     1.5 hours 

 Sasha Miller
 Print
 Add Notes
 Bookmark this page
Make Unordered list with Bootstrap

For unordered list in Bootstrap, you can try to run the following code −
Live Demo
<!DOCTYPE html>
<html>
   <head>
      <title>Bootstrap lists</title>
      <meta name = "viewport" content = "width=device-width, initial-scale = 1">
      <link rel = "stylesheet" href = "https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css">
      <script src = "https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
      <script src = "https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
   </head>
   <body>
      <h1>Lists</h1>
      <h2>Fruits (Ordered List)</h2>
      <ol>
         <li>Kiwi</li>
         <li>Apple</li>
         <li>Mango</li>
      </ol>
      <h2>Vegetables (UnOrdered List)</h2>
      <ul>
         <li>Tomato</li>
         <li>Brinjal</li>
         <li>Broccoli</li>
      </ul>
   </body>
</html>
How to populate a Map using a lambda expression in Java?


A Map is a collection object that maps keys to values in Java. The data can be stored in key/value pairs and each key is unique. These key/value pairs are also called map entries.
In the below example, we can populate a Map using a lambda expression. We have passed Character and Runnable arguments to Map object and pass a lambda expression as the second argument in the put() method of Map class. We need to pass command-line arguments whether the user enters 'h' for Help and 'q' for quit with the help of Scanner class.
import java.util.*;

public class PopulateUsingMapLambdaTest {
   public static void main(String[] args) {
      Map<Character, Runnable> map = new HashMap<>();

      map.put('h', () -> System.out.println("Type h or q"));   // lambda expression
      map.put('q', () -> System.exit(0));    // lambda expression

      while(true) {
         System.out.println("Menu");
         System.out.println("h) Help");
         System.out.println("q) Quit");
         char key = new Scanner(System.in).nextLine().charAt(0);
         if(map.containsKey(key))
            map.get(key).run();
      }
   }
}
Menu
h) Help
q) Quit
Type h or q :
q