code-rag-bench/online-tutorials huggingface dataset:
Entity Framework - Native SQL

In Entity Framework you can query with your entity classes using LINQ. You can also run queries using raw SQL directly against the database using DbCOntext. The techniques can be applied equally to models created with Code First and EF Designer.
The SqlQuery method on DbSet allows a raw SQL query to be written that will return entity instances. The returned objects will be tracked by the context just as they would be if they were returned by a LINQ query. For example −
class Program {

   static void Main(string[] args) {

      using (var context = new UniContextEntities()) {

         var students = context.Students.SqlQuery("SELECT * FROM dbo.Student").ToList();

         foreach (var student in students) {
            string name = student.FirstMidName + " " + student.LastName;
            Console.WriteLine("ID: {0}, Name: {1}, \tEnrollment Date {2} ",
               student.ID, name, student.EnrollmentDate.ToString());
         }

         Console.ReadKey();
      }
   }
}
The above code will retrieve all the students from the database.
A SQL query returning instances of any type, including primitive types, can be created using the SqlQuery method on the Database class. For example −
class Program {

   static void Main(string[] args) {

      using (var context = new UniContextEntities()) {

         var studentNames = context.Database.SqlQuery
            <string>("SELECT FirstMidName FROM dbo.Student").ToList();

         foreach (var student in studentNames) {
            Console.WriteLine("Name: {0}", student);
         }

         Console.ReadKey();
      }
   }
}
ExecuteSqlCommnad method is used in sending non-query commands to the database, such as the Insert, Update or Delete command. Let’s take a look at the following code in which student’s first name is updated as ID = 1
class Program {

   static void Main(string[] args) {

      using (var context = new UniContextEntities()) {

         //Update command

         int noOfRowUpdated = context.Database.ExecuteSqlCommand("Update 
            student set FirstMidName = 'Ali' where ID = 1");

         context.SaveChanges();

         var student = context.Students.SqlQuery("SELECT * FROM
            dbo.Student where ID = 1").Single();

         string name = student.FirstMidName + " " + student.LastName;

         Console.WriteLine("ID: {0}, Name: {1}, \tEnrollment Date {2} ", 
            student.ID, name, student.EnrollmentDate.ToString());

         Console.ReadKey();
      }
   }
}
The above code will retrieve all the students’ first name from the database.

    19 Lectures 
     5 hours 

 Trevoir Williams

    33 Lectures 
     3.5 hours 

 Nilay Mehta

    21 Lectures 
     2.5 hours 

 TELCOMA Global

    89 Lectures 
     7.5 hours 

 Mustafa Radaideh
 Print
 Add Notes
 Bookmark this page
N-th number which is both a square and a cube - GeeksforGeeks

31 Mar, 2021
Given a number n, find the n-th number which is both a square and a cube. First few such numbers are 1, 64, 729, ...
Examples : 
Input : 3
Output :729
        729 is square of 27 and cube of 3.
Input :5
Output :15625
The idea is simple, n-th such number is n6  
C++
Java
Python3
C#
PHP
Javascript
// C++ program to find n-th number which is both// square and cube.#include <bits/stdc++.h>using namespace std; int nthSquareCube(int n){   return n*n*n*n*n*n;} // Driver codeint main(){    int n = 5;    cout << nthSquareCube(n);    return 0;}
// Java program to find n-th number// which is both square and cube.class GFG {         static int nthSquareCube(int n)    {        return n * n * n * n * n * n;    }         // Driver code    public static void main(String[] args)    {        int n = 5;                 System.out.println(nthSquareCube(n));    }} // This code is contributed by// Smitha Dinesh Semwal
# program to find n-th number# which is both square and cube. def nthSquareCube(n):     return n * n * n * n * n * n  # Driver coden = 5print(nthSquareCube(n))# This code is contributed by# Smitha Dinesh Semwal
// C# program to find n-th number// which is both square and cube.using System; class GFG{         static int nthSquareCube(int n)    {        return n * n * n * n * n * n;    }         // Driver code    static public void Main ()    {        int n = 5;                 Console.WriteLine(nthSquareCube(n));    }} // This code is contributed by Ajit.
<?php// PHP program to find n-th// number which is both// square and cube. function nthSquareCube($n){    return $n * $n * $n *           $n * $n * $n;} // Driver code$n = 5;echo(nthSquareCube($n)); // This code is contributed by Ajit.?>
<script> // JavaScript program to find n-th number// which is bothsquare and cube.function nthSquareCube(n){    return n * n * n * n * n * n;} // Driver codelet n = 5; document.write(nthSquareCube(n)); // This code is contributed by Surbhi Tyagi. </script>
15625
 
Smitha Dinesh Semwal
jit_t
surbhityagi15
maths-cube
series
Mathematical
School Programming
Mathematical
series
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Merge two sorted arrays
Program to find GCD or HCF of two numbers
Prime Numbers
Modulo Operator (%) in C/C++ with Examples
Sieve of Eratosthenes
Python Dictionary
Arrays in C/C++
Reverse a string in Java
Inheritance in C++
C++ Classes and Objects
Python - Plot a Pie Chart for Pandas Dataframe with Matplotlib?

To plot a Pie Chart, use the plot.pie(). The pie plot is a proportional representation of the numerical data in a column.
Import the required libraries −
import pandas as pd
import matplotlib.pyplot as plt
Create a DataFrame −
dataFrame = pd.DataFrame({
   "Car": ['BMW', 'Lexus', 'Tesla', 'Mustang', 'Mercedes', 'Jaguar'],"Reg_Price": [7000, 1500, 5000, 8000, 9000, 6000]
})
Plot a Pie Chart for Registration Price column with label Car column −
plt.pie(dataFrame["Reg_Price"], labels = dataFrame["Car"])

Following is the code −
import pandas as pd
import matplotlib.pyplot as plt

# creating dataframe
dataFrame = pd.DataFrame({
   "Car": ['BMW', 'Lexus', 'Tesla', 'Mustang', 'Mercedes', 'Jaguar'],"Reg_Price": [7000, 1500, 5000, 8000, 9000, 6000]
})

# plot a Pie Chart for Registration Price column with label Car column
plt.pie(dataFrame["Reg_Price"], labels = dataFrame["Car"])
plt.show()
This will produce the following output −
React Native - Running IOS

If you want to test your app in the IOS simulator, all you need is to open the root folder of your app in terminal and run −
react-native run-ios

The above command will start the simulator and run the app.
We can also specify the device we want to use.
react-native run-ios --simulator "iPhone 5s

After you open the app in simulator, you can press command + D on IOS to open the developers menu. You can check more about this in our debugging chapter.
You can also reload the IOS simulator by pressing command + R.

    20 Lectures 
     1.5 hours 

 Anadi Sharma

    61 Lectures 
     6.5 hours 

 A To Z Mentor

    40 Lectures 
     4.5 hours 

 Eduonix Learning Solutions

    56 Lectures 
     12.5 hours 

 Eduonix Learning Solutions

    62 Lectures 
     4.5 hours 

 Senol Atac

    67 Lectures 
     4.5 hours 

 Senol Atac
 Print
 Add Notes
 Bookmark this page
How do I drop a MongoDB database from the command line?

To drop a MongoDB database from the command line, use the following syntax:
mongo yourDatabaseName --eval "db.dropDatabase()"
To understand the above syntax, let us display all the database from MongoDB. The query is as follows −
> show dbs;
The following is the output −
StudentTracker 0.000GB
admin 0.000GB
config 0.000GB
local 0.000GB
sample 0.000GB
test 0.003GB
Drop the database with the name ‘StudentTracker’. The query is as follows to drop a database from command line −
C:\Program Files\MongoDB\Server\4.0\bin>mongo StudentTracker --eval "db.dropDatabase()"
The following is the output −
MongoDB shell version v4.0.5
connecting to: mongodb://127.0.0.1:27017/StudentTracker?gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("afc34e93-b4c0-46f0-85bd-b80ed17b8c11") }
MongoDB server version: 4.0.5
{ "dropped" : "StudentTracker", "ok" : 1 }
Now check the database has been dropped or not. The query is as follows −
> show dbs
The following is the output −
admin 0.000GB
config 0.000GB
local 0.000GB
sample 0.000GB
test 0.003GB
Look at the sample output, the database ‘StudentTracker’ has been dropped.
Difference between file_get_contents and cURL in PHP

13 Sep, 2021
file_get_contents() Function: This PHP function is used to retrieve the contents of a file. The contents can be stored as a string variable. Alternatively, it also simulates HTTP transactions, involving requests via GET method and responses using POST method respectively. Primarily, it is best-suited for simple HTTP manipulations and to get single-line JSON responses. 
Example:
PHP
<?php // Reading contents from the// GeeksforGeeks homepage$homepage = file_get_contents(  "https://www.geeksforgeeks.org/"); echo $homepage; ?>
Output: It will redirect to GeeksforGeeks home page.
cURL: It is a third party library that simulates HTTP requests and responses in a much more efficient way. It can handle asynchronous HTTP requests and complex communications like callback functions or break point continual transferring. It is also suitable for carrying out cross-domain based FTP request. Also, it can be used in different applications like proxy setup and Website Scraping etc. 
Example:
PHP
<?php // From URL to get webpage contents$url = "https://www.geeksforgeeks.org/"; // Initialize a CURL session.$ch = curl_init(); // Return Page contents.curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // Grab URL and pass it to the variablecurl_setopt($ch, CURLOPT_URL, $url); $result = curl_exec($ch); echo $result; ?>
Output: It will redirect to GeeksforGeeks home page.
akshaysingh98088
PHP-function
PHP-Misc
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 receive JSON POST with PHP ?
How to get parameters from a URL string in PHP?
Split a comma delimited string into an array in PHP
How to convert array to string in PHP ?
How to call PHP function on the click of a Button ?
How to get parameters from a URL string in PHP?
Split a comma delimited string into an array in PHP
How to pass JavaScript variables to PHP ?
Python – Read CSV Column into List without header

25 Feb, 2021
Prerequisites: Reading and Writing data in CSV 
CSV files are parsed in python with the help of csv library.  The csv library contains objects that are used to read, write and process data from and to CSV files. Sometimes, while working with large amounts of data, we want to omit a few rows or columns, so that minimum memory gets utilized. Let’s see how we can read a CSV file by skipping the headers.
Import the csv module.Create a reader object (iterator) by passing file object in csv.reader() function.Call the next() function on this iterator object, which returns the first row of CSV.Store the headers in a separate variable.Iterate over remaining rows of the csv file and store them in another list.print this list to verify.
Import the csv module.
Create a reader object (iterator) by passing file object in csv.reader() function.
Call the next() function on this iterator object, which returns the first row of CSV.
Store the headers in a separate variable.
Iterate over remaining rows of the csv file and store them in another list.
print this list to verify.
Example:
The below code reads the Data.csv file.
Below is the full implementation:
Python3
import csv  # reading data from a csv file 'Data.csv'with open('Data.csv', newline='') as file:        reader = csv.reader(file, delimiter = ' ')          # store the headers in a separate variable,    # move the reader object to point on the next row    headings = next(reader)          # output list to store all rows    Output = []    for row in reader:        Output.append(row[:])  for row_num, rows in enumerate(Output):    print('data in row number {} is {}'.format(row_num+1, rows))  print('headers were: ', headings)
Output:
Picked
python-csv
Technical Scripter 2020
Python
Technical Scripter
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python | Pandas Series.skew()

05 Feb, 2019
Pandas series is a One-dimensional ndarray with axis labels. The labels need not be unique but must be a hashable type. The object supports both integer- and label-based indexing and provides a host of methods for performing operations involving the index.
Pandas Series.skew() function return unbiased skew over requested axis Normalized by N-1. Skewness is asymmetry in a statistical distribution, in which the curve appears distorted or skewed either to the left or to the right.
Syntax: Series.skew(axis=None, skipna=None, level=None, numeric_only=None, **kwargs)
Parameter :axis : Axis for the function to be applied on.skipna : Exclude NA/null values when computing the result.level : If the axis is a MultiIndex (hierarchical), count along a particular level, collapsing into a scalar.numeric_only : Include only float, int, boolean columns.**kwargs : Additional keyword arguments to be passed to the function.
Returns : skew : scalar or Series (if level specified)
Example #1 : Use Series.skew() function to find the skewness in the data of the given Series object.
# importing pandas as pdimport pandas as pd  # Creating the Seriessr = pd.Series([100, 25, 32, 118, 24, 65])  # Print the seriesprint(sr)
Output :
Now we will use Series.skew() function to find the skewness in the data.
# find skewnesssr.skew()
Output :
As we can see in the output, Series.skew() function has successfully calculated the skewness in the data of the given Series object.
Example #2 : Use Series.skew() function to find the skewness in the data of the given Series object. We have some missing values in our series object, so skip those missing values.
# importing pandas as pdimport pandas as pd  # Creating the Seriessr = pd.Series([19.5, 16.8, None, 22.78, None, 20.124, None, 18.1002, None])  # Print the seriesprint(sr)
Output :
Now we will use Series.skew() function to find the skewness in the data.
# find skewnesssr.skew(skipna = True)
Output :
As we can see in the output, Series.skew() function has successfully calculated the skewness in the data of the given Series object. Missing values has been skipped while calculating the skewness in the given data.
Python pandas-series
Python pandas-series-methods
Python-pandas
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Python Classes and Objects
Python OOPs Concepts
Introduction To PYTHON
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
Simple Chat Room using Python

In this article we will see how to make a server and client chat room system using Socket Programming with Python.
The sockets are the endpoints of any communication channel. These are used to connect the server and client. Sockets are Bi-Directional. In this area, we will setup sockets for each end and setup the chatroom system among different clients through the server. The server side has some ports to connect with client sockets. When a client tries to connect with the same port, then the connection will be established for the chat room.
There are basically two parts. The server side and the client side. When the server side script is running, it waits for any active connection request. When one connection is established, it can communicate with it.
In this case we are using localhost. If machines are connected via LAN, then we can use IP addresses to communicate. The server will display its IP, and ask for a name for the server. From the client side, we have to mention a name, and also the IP address of the server to connect.
import time, socket, sys
print('Setup Server...')
time.sleep(1)
#Get the hostname, IP Address from socket and set Port
soc = socket.socket()
host_name = socket.gethostname()
ip = socket.gethostbyname(host_name)
port = 1234
soc.bind((host_name, port))
print(host_name, '({})'.format(ip))
name = input('Enter name: ')
soc.listen(1) #Try to locate using socket
print('Waiting for incoming connections...')
connection, addr = soc.accept()
print("Received connection from ", addr[0], "(", addr[1], ")\n")
print('Connection Established. Connected From: {}, ({})'.format(addr[0], addr[0]))
#get a connection from client side
client_name = connection.recv(1024)
client_name = client_name.decode()
print(client_name + ' has connected.')
print('Press [bye] to leave the chat room')
connection.send(name.encode())
whileTrue:
message = input('Me > ')
if message == '[bye]':
message = 'Good Night...'
connection.send(message.encode())
print("\n")
break
connection.send(message.encode())
message = connection.recv(1024)
message = message.decode()
print(client_name, '>', message)
import time, socket, sys
print('Client Server...')
time.sleep(1)
#Get the hostname, IP Address from socket and set Port
soc = socket.socket()
shost = socket.gethostname()
ip = socket.gethostbyname(shost)
#get information to connect with the server
print(shost, '({})'.format(ip))
server_host = input('Enter server\'s IP address:')
name = input('Enter Client\'s name: ')
port = 1234
print('Trying to connect to the server: {}, ({})'.format(server_host, port))
time.sleep(1)
soc.connect((server_host, port))
print("Connected...\n")
soc.send(name.encode())
server_name = soc.recv(1024)
server_name = server_name.decode()
print('{} has joined...'.format(server_name))
print('Enter [bye] to exit.')
whileTrue:
message = soc.recv(1024)
message = message.decode()
print(server_name, ">", message)
message = input(str("Me > "))
if message == "[bye]":
message = "Leaving the Chat room"
soc.send(message.encode())
print("\n")
break
soc.send(message.encode())
Sort an array of strings according to string lengths in C++

Here we will see how to sort a list of strings based on their lengths. So if a string has less number of characters, then that will be placed first, then other longer strings will be placed. Suppose the strings are
str_list = {“Hello”, “ABC”, “Programming”, “Length”, “Population”}
after sorting, they will be −
str_list = {“ABC”, “Hello”, “Length”, “Population”, “Programming”}
Here we will create our own comparison logic to sort them. That comparison logic will be used in the sort function in C++ STL.
compare(str1, str2):
Begin
   if length of str1 < length of str2, then
      return 1
   return 0
End
 Live Demo
#include<iostream>
#include<algorithm>
using namespace std;
int compare(string str1, string str2){
   if(str1.length() < str2.length())
   return 1;
   return 0;
}
main(){
   string str_list[] = {"Hello", "ABC", "Programming", "Length", "Population"};
   int n = 5;
   sort(str_list, str_list + n, compare);
   for(int i = 0; i<n; i++){
      cout << str_list[i] << " ";
   }
}
ABC Hello Length Population Programming
CSS - Fade Out Effect

The image come or cause to come gradually into or out of view, or to merge into another shot.
@keyframes fadeOut {
   0% {opacity: 1;}
   100% {opacity: 0;} 
} 
Transform − Transform applies to 2d and 3d transformation to an element.
Transform − Transform applies to 2d and 3d transformation to an element.
Opacity − Opacity applies to an element to make translucence.
Opacity − Opacity applies to an element to make translucence.
<html>
   <head>
      <style>
         .animated {
            background-image: url(/css/images/logo.png);
            background-repeat: no-repeat;
            background-position: left top;
            padding-top:95px;
            margin-bottom:60px;
            -webkit-animation-duration: 10s;animation-duration: 10s;
            -webkit-animation-fill-mode: both;animation-fill-mode: both;
         }
         
         @-webkit-keyframes fadeOut {
            0% {opacity: 1;}
            100% {opacity: 0;}
         }
         
         @keyframes fadeOut {
            0% {opacity: 1;}
            100% {opacity: 0;}
         }
         
         .fadeOut {
            -webkit-animation-name: fadeOut;
            animation-name: fadeOut;
         }
      </style>
   </head>

   <body>
   
      <div id = "animated-example" class = "animated fadeOut"></div>
      <button onclick = "myFunction()">Reload page</button>
      
      <script>
         function myFunction() {
            location.reload();
         }
      </script>
      
   </body>
</html>
It will produce the following result −


 Academic Tutorials
 Big Data & Analytics 
 Computer Programming 
 Computer Science 
 Databases 
 DevOps 
 Digital Marketing 
 Engineering Tutorials 
 Exams Syllabus 
 Famous Monuments 
 GATE Exams Tutorials
 Latest Technologies 
 Machine Learning 
 Mainframe Development 
 Management Tutorials 
 Mathematics Tutorials
 Microsoft Technologies 
 Misc tutorials 
 Mobile Development 
 Java Technologies 
 Python Technologies 
 SAP Tutorials 
Programming Scripts 
 Selected Reading 
 Software Quality 
 Soft Skills 
 Telecom Tutorials 
 UPSC IAS Exams 
 Web Development 
 Sports Tutorials 
 XML Technologies 
 Multi-Language
 Interview Questions


 Academic Tutorials
 Big Data & Analytics 
 Computer Programming 
 Computer Science 
 Databases 
 DevOps 
 Digital Marketing 
 Engineering Tutorials 
 Exams Syllabus 
 Famous Monuments 
 GATE Exams Tutorials
 Latest Technologies 
 Machine Learning 
 Mainframe Development 
 Management Tutorials 
 Mathematics Tutorials
 Microsoft Technologies 
 Misc tutorials 
 Mobile Development 
 Java Technologies 
 Python Technologies 
 SAP Tutorials 
Programming Scripts 
 Selected Reading 
 Software Quality 
 Soft Skills 
 Telecom Tutorials 
 UPSC IAS Exams 
 Web Development 
 Sports Tutorials 
 XML Technologies 
 Multi-Language
 Interview Questions
Selected Reading
UPSC IAS Exams Notes
Developer's Best Practices
Questions and Answers
Effective Resume Writing
HR Interview Questions
Computer Glossary
Who is Who
 Print
 Add Notes
 Bookmark this page
Debugging Python code using breakpoint() and pdb - GeeksforGeeks

23 Feb, 2019
While developing an application or exploring some features of a language, one might need to debug the code anytime. Therefore, having an idea of debugging the code is quite necessary. Let’s see some basics of debugging using built-in function breakpoint() and pdb module.
We know that debugger plays an important role when we want to find a bug in a particular line of code. Here, Python comes with the latest built-in function breakpoint which do the same thing as pdb.set_trace() in Python 3.6 and below versions.
Debugger finds the bug in the code line by line where we add the breakpoint, if a bug is found then program stops temporarily then you can remove the error and start to execute the code again.
Syntax:
1) breakpoint()           # in Python 3.7 
        
2) import pdb; pdb.set_trace()   # in Python 3.6 and below

 Method #1 : Using breakpoint() functionIn this method, we simply introduce the breakpoint where you have doubt or somewhere you want to check for bugs or errors.
def debugger(a, b):    breakpoint()    result = a / b    return result  print(debugger(5, 0))
Output :
In order to run the debugger just type c and press enter. 
Commands for debugging :
c -> continue execution
q -> quit the debugger/execution
n -> step to next line within the same function
s -> step to next line in this function or a called function

 
Method #2 : Using pdb moduleAs the same suggests, PDB means Python debugger. To use the PDB in the program we have to use one of its method named set_trace(). Although this will result the same but this the another way to introduce the debugger in python version 3.6 and below.
def debugger(a, b):    import pdb; pdb.set_trace()    result = a / b    return result  print(debugger(5, 0))
Output :
In order to run the debugger just type c and press enter.
Example :
def debugger(a):    import pdb; pdb.set_trace()    result = [a[element] for element in range(0, len(a)+5)]    return result  print(debugger([1, 2, 3]))
Output :
Python-Miscellaneous
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Read a file line by line in Python
How to Install PIP on Windows ?
Different ways to create Pandas Dataframe
Python String | replace()
Create a Pandas DataFrame from Lists
Reading and Writing to text files in Python
*args and **kwargs in Python
How To Convert Python Dictionary To JSON?
sum() function in Python
Memory leaks in Java

In Java, garbage collection (the work of destructor) is done automatically using garbage collection. But what if there are objects that have references to them in the code? It can’t be de-allocated, i.e their memory can’t be cleared. If such a situation occurs again and again, and the created or referred objects are not used at all, they become useless. This is what is known as a memory leak.
If the memory limit is exceeded, the program gets terminated by throwing an error, i.e ‘OutOfMemoryError’. This is the reason why it is always suggested to remove all references to an object so that Java Garbage collector can automatically destroy it.
Below is an example that illustrates how the compiler runs out of space when too much memory is trying to be used −
 Live Demo
import java.util.Vector;
public class Demo{
   public static void main(String[] args){
      Vector my_v1 = new Vector(314567);
      Vector my_v2 = new Vector(784324678);
      System.out.println("This is the last line to be printed");
   }
}
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at java.base/java.util.Vector.<init>(Vector.java:142)
at java.base/java.util.Vector.<init>(Vector.java:155)
at Demo.main(Demo.java:7)
A class named Demo contains the main function where two vector objects have been created by assigning them too large of a space. The last print line is just written to check if the compiler reaches that line. In reality, it doesn’t, since the space occupied by these vectors is huge and so much memory can’t be allocated, resulting in an error.
Print multiples of Unit Digit of Given Number in C Program

Input number N and fetch the unit digit of a given number and display the multiples of that number.
Input − N=326
Output − unit digit is 6 and its multiples are 2 and 3
Note − Unit digit of any number can be fetched by calculating the %10 with that number
For example − if your’re given with a number N and you need to find its unit digit that
you can use N%10 it will return you unit digit of number N
START
Step 1 -> Declare start variables num, num2 and i
Step 2 -> input number num
Step 3 -> store num%10 in num2 to fetch unit digit
Step 4 -> print num2
Step 5 -> Loop For i=2 and i<=num2/2 and ++i
   IF num2%i=0\
      Print i
   End IF
Step 6 -> End For Loop
STOP
#include<stdio.h>
int main() {
   int num,num2,i;
   printf("\nenter a number");
   scanf("%d" , &num);
   num2=num%10;    //storing unit digit in num2
   printf("\n unit digit of %d is: %d",num,num2);
      for(i=2;i<=num2/2;++i) {    //loop till half of unit digit
      if(num2%i==0) { //calculate multiples
         printf("\n multiple of %d is : %d ",num2,i);
      }
   }
return 0;
}
If we run above program then it will generate following output
enter a number329
unit digit of 329 is: 9
multiple of 9 is : 3
How to add text to an image using Java OpenCV library?

You can add text to an image using the putText() method of the org.opencv.imgproc.Imgproc class. This method renders the specified text in the given image. It accepts −
An empty mat object to store the source image.
An empty mat object to store the source image.
A string object to specify the desired text.
A string object to specify the desired text.
A Point object specifying the position of the text.
A Point object specifying the position of the text.
Integer constant specifying the font of the text.
Integer constant specifying the font of the text.
scale factor that is multiplied by the font-specific base size.
scale factor that is multiplied by the font-specific base size.
A Scalar object specifying the color of the text.
A Scalar object specifying the color of the text.
An integer value specifying the color of the text
An integer value specifying the color of the text
import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.core.Point;
import org.opencv.core.Scalar;
import org.opencv.highgui.HighGui;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.imgproc.Imgproc;
public class AddingText {
   public static void main(String args[]) throws Exception {
      //Loading the OpenCV core library
      System.loadLibrary( Core.NATIVE_LIBRARY_NAME );
      //Reading the contents of the image
      String file ="D:\\Images\\shapes.jpg";
      Mat src = Imgcodecs.imread(file);
      //Preparing the arguments
      String text = "JavaFX 2D shapes";
      Point position = new Point(170, 280);
      Scalar color = new Scalar(0, 0, 255);
      int font = Imgproc.FONT_HERSHEY_SIMPLEX;
      int scale = 1;
      int thickness = 3;
      //Adding text to the image
      Imgproc.putText(src, text, position, font, scale, color, thickness);
      //Displaying the resultant Image
      HighGui.imshow("Contours operation", src);
      HighGui.waitKey();
   }
}
Tryit Editor v3.6 - Show Python

#if this page is executed with no errors, you have the "mysql.connector" module installed.
Clojure - While Statement

Following is the syntax of the ‘while’ statement.
(while(expression)
   (do
      codeblock))

The while statement is executed by first evaluating the condition expression (a Boolean value), and if the result is true, then the statements in the while loop are executed. The process is repeated starting from the evaluation of the condition in the while statement. This loop continues until the condition evaluates to false. When the condition is false, the loop terminates. The program logic then continues with the statement immediately following the while statement. Following is the diagrammatic representation of this loop.
Following is an example of a while loop statement.
(ns clojure.examples.hello
   (:gen-class))

;; This program displays Hello World
(defn Example []
   (def x (atom 1))
   (while ( < @x 5 )
      (do
         (println @x)
         (swap! x inc))))
(Example)
In the above example, we are first initializing the value of ‘x’ variable to 1. Note that we are using an atom value, which is a value which can be modified. Then our condition in the while loop is that we are evaluating the condition of the expression to be such as ‘x’ should be less than 5. Till the value of ‘x’ is less than 5, we will print the value of ‘x’ and then increase its value. The swap statement is used to populate the atom variable of ‘x’ with the new incremented value.
The above code produces the following output.
1
2
3
4

 Print
 Add Notes
 Bookmark this page
How to draw a hollow circle in SVG?

To draw a hollow circle in SVG, use the <circle> element. For that, use fill=”none” and draw the outline.
SVG stands for Scalable Vector Graphics and is a language for describing 2D-graphics and graphical applications in XML and the XML is then rendered by an SVG viewer. Most of the web browsers can display SVG just like they can display PNG, GIF, and JPG.
You can try to run the following code to learn how to draw a hollow circle in SVG
<!DOCTYPE html>
<html>
   <head>
      <title>HTML5 SVG Hollow Circle</title>
   <head>
   <body>
      <svg id="svgelem" height="200" xmlns="http://www.w3.org/2000/svg">
         <circle cx="100" cy="50" r="40" stroke="black" stroke-width="7" fill="none" />
      </svg>
   </body>
</html>
\lower - Tex Command

\lower - Used to lower the argument by the amount specified in dimen.
{ \lower <dimen> #1 }
\lower command lowers the argument by the amount specified in dimen.

l\lower 2pt {owe} r

lower



l\lower 2pt {owe} r

lower


l\lower 2pt {owe} r

    14 Lectures 
     52 mins

 Ashraf Said

    11 Lectures 
     1 hours 

 Ashraf Said

    9 Lectures 
     1 hours 

 Emenwa Global, Ejike IfeanyiChukwu

    29 Lectures 
     2.5 hours 

 Mohammad Nauman

    14 Lectures 
     1 hours 

 Daniel Stern

    15 Lectures 
     47 mins

 Nishant Kumar
 Print
 Add Notes
 Bookmark this page
Differences between CompletableFuture and Future in Java 9?

CompletableFuture<T> class implements Future<T> interface in Java. CompletableFuture can be used as a Future that has explicitly completed. The Future interface doesn’t provide a lot of features, we need to get the result of asynchronous computation using the get() method, which is blocked, so there is no scope to run multiple dependent tasks in a non-blocking fashion whereas CompleteFuture class can provide the functionality to chain multiple dependent tasks that run asynchronously, so we can create a chain of tasks where the next task is triggered when the result of the current task is available.
public class CompletableFuture<T> extends Object implements Future<T>, CompletionStage<T>
import java.util.function.Supplier;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;

public class CompletableFutureTest {
   public static void main(String args[]) throws ExecutionException, InterruptedException {
      Calculator calc = new Calculator(4, 7);
      CompletableFuture<Integer> future = CompletableFuture.supplyAsync(calc);
      future.thenAccept(result -> {
         System.out.println(result);
      });
      System.out.println("CompletableFutureTest End.... ");
      Thread.sleep(10000);
   }
}

// Calculator class
class Calculator implements Supplier<Integer> {
   private int x, y;
   public Calculator(int x, int y) {
      this.x = x;
      this.y = y;
   }
   @Override
   public Integer get() {
      try {
         Thread.sleep(3000);
      } catch(InterruptedException e) {
         e.printStackTrace();
      }
      return x + y;
   }
}
CompletableFutureTest End....
11
How to get the length of an object in JavaScript?

The length property is only applicable to arrays and strings. So when we call the length property on an object we will get undefined.
Live Demo
<html>
<body>
<script>
   var object = {prop:1, prop:2};
   document.write(object.length);
</script>
</body>
</html>
undefined
Whereas arrays and strings will display their length when length property is used on them.
Live Demo
<html>
<body>
<script>
   var string = 'hello';
   var array = [1,2,3];
   var len1 = string.length;
   var len2 = array.length;
   document.write(len1);
   document.write("</br>");
   document.write(len2);
</script>
</body>
</html>
5
3
In javascript, we have Object.keys() property, which checks whether there are any properties or not. If we use the length property with Object.keys() then the number of properties will be displayed which is nothing but the length of the object. 
Live Demo
<html>
<body>
<script>
   var object = {one: 1, two:2, three:3};
   document.write(Object.keys(object).length);
</script>
</body>
</html>
3
How to draw profile icon shape in android?

This example demonstrate about How to draw profile icon shape in android.
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"?>
<LinearLayout 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"
   android:orientation="vertical"
   android:gravity="center"
   android:layout_marginTop="30dp"
   tools:context=".MainActivity">
   <ImageView
      android:layout_width="100dp"
      android:layout_height="100dp"
      android:background="@drawable/background"/>
</LinearLayout>
In the above code, we have taken imageview and added background as background.xml.
Step 3 − Add the following code to drawable/ background.xml
<vector xmlns:android="http://schemas.android.com/apk/res/android"
   android:width="24dp"
   android:height="24dp"
   android:autoMirrored="true"
   android:viewportWidth="277.58"
   android:viewportHeight="277.58">
   <path
      android:fillColor="#D80027"
      android:pathData="M138.46,164.287c-38.628,0 -69.925,-37.519 -69.925,-83.767C68.535,
                        34.277 99.832,0 138.46,0c38.634,0 69.957,34.277 69.957,80.52C208.417,
                        126.768 177.093,164.287 138.46,164.287zM29.689,277.528c0,0 -14.832,
                        0.979 -21.365,-8.023c-3.53,-4.863 -1.071,-14.718 1.343,-20.217l5.912,
                        -13.473c0,0 16.35,-36.567 34.962,-57.757c11.433,-12.994 25.031,
                        -10.035 33.826,-5.809c5.417,2.6 11.542,10.176 16.018,14.191c6.168,
                        5.532 17.057,11.819 34.859,12.173h10.922c17.791,-0.354 28.68,
                        -6.641 34.843,-12.173c4.471,-4.014 10.427,-11.825 15.795,
                        -14.511c8.072,-4.041 20.358,-6.527 31.492,6.13c18.618,21.191 33.363,
                        58.421 33.363,58.421l6.059,13.212c2.507,5.461 5.075,15.267 1.643,
                        20.195c-6.124,8.811 -19.874,7.642 -19.874,7.642S29.689,277.528 29.689,
                        277.528z" />
</vector>
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
Palindrome Partitioning II in C++

Suppose we have a string s, we have to find the number of cuts needed to divide this string into different substring and each part is a palindrome. So if the string is like “ababba”, then this will take 2 cuts. [aba|bb|a]
To solve this, we will follow these steps −
n := number of characters in the string s
n := number of characters in the string s
create one array called res of size n + 1
create one array called res of size n + 1
res[n] := -1
res[n] := -1
for i in range n – 1 down to 0res[i] := n – i – 1for j in range i to nif substring of a, from index i, to j – i is a palindrome, thenres[i] := min of res[i] and 1 + res[j + 1]
for i in range n – 1 down to 0
res[i] := n – i – 1
res[i] := n – i – 1
for j in range i to nif substring of a, from index i, to j – i is a palindrome, thenres[i] := min of res[i] and 1 + res[j + 1]
for j in range i to n
if substring of a, from index i, to j – i is a palindrome, thenres[i] := min of res[i] and 1 + res[j + 1]
if substring of a, from index i, to j – i is a palindrome, then
res[i] := min of res[i] and 1 + res[j + 1]
res[i] := min of res[i] and 1 + res[j + 1]
return res[0]
return res[0]
Let us see the following implementation to get a better understanding −
 Live Demo
#include <bits/stdc++.h>
using namespace std;
bool isPalindrome(string A) {
   int left = 0;
   int right = A.size()-1;
   while(left < right) {
      if(A[left] != A[right]) {
         return 0;
      }
      left++;
      right--;
   }
   return 1;
}
int solve(string A) {
   int n = A.size();
   vector<int>result(n+1);
   result[n] = -1;
   for(int i=n-1;i>=0;i--) {
      result[i] = n-i-1;
      for(int j=i;j<n;j++) {
         if(isPalindrome(A.substr(i, j-i+1))) {
            result[i] = min(result[i], 1 + result[j+1]);
         }
      }
   }
   return result[0];
}
class Solution {
   public:
   int minCut(string s) {
      return solve(s);
   }
};
main(){
   Solution ob;
   cout << (ob.minCut("ababba"));
}
“ababba”
2
GATE CS 2021 Official Important Dates - GeeksforGeeks

03 Jul, 2021
IIT Bombay is organizing GATE 2021. In this year, The GATE authority 2021 has made major changes and has also revised the syllabus of various GATE Papers.
They also increase the number of consecutive days from three weeks to two weeks, due to COVID-19 pandemic. Before, it GATE exam was organized in three weeks but not it is going in only two weeks (may because of COVID-19 pandemic).
These are Official date(s) of the respective event of the GATE 2021 exam :
GATE CS 2022 TS
GATE 2021 Examination
Forenoon:  9:00 AM to 12:00 Noon
           (Tentative)
Afternoon: 3:00 PM to 6:00 PM
           (Tentative) 
Friday
Saturday
Sunday

Friday
Saturday
Sunday 
5th February 2021
6th February 2021
7th February 2021

12th February 2021
13th February 2021
14th February 2021 
The health and safety of the candidates are of utmost priority. Due to current COVID-19 pandemic situation, dates mentioned here are subject to change. In rare cases, it may be necessary to postpone the GATE 2021 examination because of situations beyond the control of GATE committee. All updates will be available on this website.
Official website for GATE 2021 exam – GATE IIT BombayGATE CS Notes according to GATE 2021 syllabusGATE CS previous year solved papersImportant topics for GATE 2021 Computer ScienceLast minute notes for GATE CSGATE CS 2017 Mock TestsGATE CS 2018 Mock TestsGATE CS 2019 Mock TestsArticles on Computer Science subjects
Official website for GATE 2021 exam – GATE IIT Bombay
GATE CS Notes according to GATE 2021 syllabus
GATE CS previous year solved papers
Important topics for GATE 2021 Computer Science
Last minute notes for GATE CS
GATE CS 2017 Mock Tests
GATE CS 2018 Mock Tests
GATE CS 2019 Mock Tests
Articles on Computer Science subjects
Computer Subject
GATE CS
GBlog
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Difference between NP hard and NP complete problem
Software Engineering | Classification of Software Requirements
Cloud Based Services
Functional Programming Paradigm
What is Transmission Control Protocol (TCP)?
Layers of OSI Model
ACID Properties in DBMS
TCP/IP Model
Types of Operating Systems
Page Replacement Algorithms in Operating Systems
C program to print string tokens

Suppose we have a string s that contains a sentence with few words. We shall have to print each word into new lines. To do this we can use the strtok() function under the string.h header file. This function takes the string and a delimiter. Here the delimiter is blank space " ".
So, if the input is like s = "Let us see some string tokenizing fun", then the output will be
Let
us
see
some
string
tokenizing
fun
To solve this, we will follow these steps −
token := first word by using strtok(s, " ") here delimiter is " "
token := first word by using strtok(s, " ") here delimiter is " "
while token is non-zero, do:display tokentoken := next token of s, from now pass NULL as first argument of strtok with same delimiter space " ".
while token is non-zero, do:
display token
display token
token := next token of s, from now pass NULL as first argument of strtok with same delimiter space " ".
token := next token of s, from now pass NULL as first argument of strtok with same delimiter space " ".
Let us see the following implementation to get better understanding −
#include <stdio.h>
#include <string.h>
int main(){
    char s[] = "Let us see some string tokenizing fun";
    char* token = strtok(s, " ");
    while (token) {
        printf("%s\n", token);
        token = strtok(NULL, " ");
    }
}

Let us see some string tokenizing fun
Let
us
see
some
string
tokenizing
fun
Decimal.Divide() Method in C#

The Decimal.Divide() method in C# is used to divide two specified Decimal values.
Following is the syntax −
public static decimal Divide (decimal val1, decimal val2);
Above, val1 is the dividend, whereas val2 is the divisor.
Let us now see an example to implement the Decimal.Divide() method −
using System;
public class Demo {
   public static void Main(){
      Decimal val1 = 65.15m;
      Decimal val2 = 5.15m;
      Console.WriteLine("Decimal 1 = "+val1);
      Console.WriteLine("Decimal 2 = "+val2);
      Console.WriteLine("After Division = "+(Decimal.Divide(val1,val2)));
   }
}
This will produce the following output −
Decimal 1 = 65.15
Decimal 2 = 5.15
After Division = 12.650485436893203883495145631
Let us now see another example to implement the Decimal.Divide() method −
using System;
public class Demo {
   public static void Main(){
      Decimal val1 = 1.0m;
      Decimal val2 = 1.0m;
      Console.WriteLine("Decimal 1 = "+val1);
      Console.WriteLine("Decimal 2 = "+val2);
      Console.WriteLine("After Division = "+(Decimal.Divide(val1,val2)));
   }
}
This will produce the following output −
Decimal 1 = 1.0
Decimal 2 = 1.0
After Division = 1
How to calculate the Size of Folder using C#?

To calculate the size of a folder in C#, use the Directory.EnumerateFiles Method and get the files.
To get the sub- directories, use the EnumerateDirectories method. Our folder is set using DirectoryInfo class −
DirectoryInfo info = new DirectoryInfo(@"D:/new");
Now find the size −
long totalSize = info.EnumerateFiles().Sum(file => file.Length);

For the directories, use −
info.EnumerateDirectories()
Other manipulations you can perform on Directories in C# are:
Cognos - Report Functions

There are various Report functions that can be used in a Cognos report.
Some of these different report functions include −
This function is used to return a positive or a negative number representing the number of days between the two datetime expressions. If a timestamp_exp1 < timestamp_exp2 then the result will be a –ve number.
_days_between(timestamp_exp1, timestamp_exp2)

This function is used to return a number representing the number of days remaining in the month represented by the datetime expression timestamp_exp.
_days_to_end_of_month(timestamp_exp)

This function is used to return a datetime that is the first day of the month represented by timestamp_exp.
This function is used to return the datetime resulting from adding integer_exp days to timestamp_exp.
_add_days(timestamp_exp, integer_exp)

This function is used to return the datetime resulting from adding integer_exp months to timestamp_exp.
_add_months(timestamp_exp, integer_exp)

This function is used to return the datetime resulting from adding integer_exp years to timestamp_exp.
_add_years(timestamp_exp, integer_exp)

This function is used to return a number that is obtained from subtracting timestamp_exp from today's date in YYYYMMDD format (years, months, days).
_age(timestamp_exp)

This function is used to return the day of week (between 1 and 7), where 1 is the first day of the week as indicated by integer_exp (between 1 and 7, 1 being Monday and 7 being Sunday). Note that in ISO 8601 standard, a week begins with Monday being day 1. In North America where Sunday is the first day of the week being day 7.
_day_of_week(timestamp_exp, integer_exp)

This function is used to return the ordinal for the day of the year in date_ exp (1 to 366). Also known as the Julian day.
_day_of_year(timestamp_exp)

Like these, there are various other Report functions as well that can be used.