code-rag-bench/online-tutorials huggingface dataset:
Converting digits to word format using switch case in C language

Is it possible to convert the given one or two-digit numbers into English words by using the C Programming language?
We can easily convert the given two-digit number into English word format with the help of a switch case. Not only two digits, but any number can also convert into English like a statement in C.
In this program, we will convert one or two-digit numbers into English word format.
 Live Demo
#include<stdio.h>
int main(){
   int no;
   printf("enter any 1 or 2 digit number:");
   scanf("%d",&no);
   if(no<0 || no>=99) //finding out whether enter no is 2 digit or not
      printf("Invalid number");
   else{
      printf("entered number:");
      switch(no){
         case 0:printf("zero");
            break;
         case 10: printf("ten");
            break;
         case 11: printf("eleven");
            break;
         case 12: printf("twelve");
            break;
         case 13: printf("thirteen");
            break;
         case 14: printf("fourteen");
            break;
         case 15: printf("fifteen");
            break;
         case 16: printf("sixteen");
            break;
         case 17: printf("seventeen");
            break;
         case 18: printf("eighteen");
            break;
         case 19: printf("nineteen");
            break;
         default: switch(no/10) //first digit word{
            case 2: printf("twenty");
               break;
            case 3: printf("thirty");
               break;
            case 4: printf("forty");
               break;
            case 5: printf("fifty");
               break;
            case 6: printf("sixty");
               break;
            case 7: printf("seventy");
               break;
            case 8: printf("eighty");
               break;
            case 9: printf("ninty");
               break;
         }
         switch(no%10) //second digit word{
            case 1: printf("one");
               break;
            case 2: printf("tw0");
               break;
            case 3: printf("three");
               break;
            case 4: printf("four");
               break;
            case 5: printf("five");
               break;
            case 6: printf("six");
               break;
            case 7: printf("seven");
               break;
            case 8: printf("eight");
               break;
            case 9: printf("nine");
               break;
         }
      }
   }
}
enter any 1 or 2 digit number:83
entered number:eightythree

enter any 1 or 2 digit number:6
entered number:six

enter any 1 or 2 digit number:548
Invalid number
Converting string to date in MongoDB?

To convert the string to date in MongoDB, use the following syntax:
db.yourCollectionName.aggregate(
   [
      {
         $project:
         {
            anyVariableName:
            {
               $dateFromString:
               {
                  dateString: '$yourFieldName’
               }
            }
         }
      }
   ]
);
To understand the above syntax, let us create a collection with some documents. The query to create a collection with documents are as follows:
> db.ConvertStringToDateDemo.insertOne({"ArrivalDate":"20-10-2019"});
{
   "acknowledged" : true,
   "insertedId" : ObjectId("5c6ef3596fd07954a489069f")
}
> db.ConvertStringToDateDemo.insertOne({"ArrivalDate":"21-02-2019"});
{
   "acknowledged" : true,
   "insertedId" : ObjectId("5c6ef3616fd07954a48906a0")
}
> db.ConvertStringToDateDemo.insertOne({"ArrivalDate":"10-12-2018"});
{
   "acknowledged" : true,
   "insertedId" : ObjectId("5c6ef36d6fd07954a48906a1")
}
> db.ConvertStringToDateDemo.insertOne({"ArrivalDate":"31-01-2017"});
{
   "acknowledged" : true,
   "insertedId" : ObjectId("5c6ef37b6fd07954a48906a2")
}
Display all documents from a collection with the help of find() method. The query is as follows:
> db.ConvertStringToDateDemo.find().pretty();
The following is the output:
{
   "_id" : ObjectId("5c6ef3596fd07954a489069f"),
   "ArrivalDate" : "20-10-2019"
}
{
   "_id" : ObjectId("5c6ef3616fd07954a48906a0"),
   "ArrivalDate" : "21-02-2019"
}
{
   "_id" : ObjectId("5c6ef36d6fd07954a48906a1"),
   "ArrivalDate" : "10-12-2018"
}
{
   "_id" : ObjectId("5c6ef37b6fd07954a48906a2"),
   "ArrivalDate" : "31-01-2017"
}
Here is the query to convert string to date:
> db.ConvertStringToDateDemo.aggregate( [ {
...    $project: {
...       StringToDate: {
...          $dateFromString: {
...             dateString: '$ArrivalDate'
...          }
...       }
...    }
... } ] ).pretty();
The following is the output:
{
   "_id" : ObjectId("5c6ef3596fd07954a489069f"),
   "StringToDate" : ISODate("2019-10-20T00:00:00Z")
}
{
   "_id" : ObjectId("5c6ef3616fd07954a48906a0"),
   "StringToDate" : ISODate("2019-02-21T00:00:00Z")
}
{
   "_id" : ObjectId("5c6ef36d6fd07954a48906a1"),
   "StringToDate" : ISODate("2018-12-10T00:00:00Z")
}
{
   "_id" : ObjectId("5c6ef37b6fd07954a48906a2"),
   "StringToDate" : ISODate("2017-01-31T00:00:00Z")
}
SQL Tryit Editor v1.6

SELECT * FROM Customers
WHERE City LIKE '[bsp]%';
​
Edit the SQL Statement, and click "Run SQL" to see the result.
This SQL-Statement is not supported in the WebSQL Database.
The example still works, because it uses a modified version of SQL.
Your browser does not support WebSQL.
Your are now using a light-version of the Try-SQL Editor, with a read-only Database.
If you switch to a browser with WebSQL support, you can try any SQL statement, and play with the Database as much as you like. The Database can also be restored at any time.
Our Try-SQL Editor uses WebSQL to demonstrate SQL.
A Database-object is created in your browser, for testing purposes.
You can try any SQL statement, and play with the Database as much as you like. The Database can be restored at any time, simply by clicking the "Restore Database" button.
WebSQL stores a Database locally, on the user's computer. Each user gets their own Database object.
WebSQL is supported in Chrome, Safari, Opera, and Edge(79).
If you use another browser you will still be able to use our Try SQL Editor, but a different version, using a server-based ASP application, with a read-only Access Database, where users are not allowed to make any changes to the data.
Check if value exists for a field in a MongoDB document?

To check if value exists for a field in a MongoDB document, you can use find() along with $exists operator. Let us first create a collection with documents −
> db.checkIfValueDemo.insertOne({"PlayerName":"John Smith","PlayerScores":[5000,98595858,554343]});
{
   "acknowledged" : true,
   "insertedId" : ObjectId("5cc6f507af8e7a4ca6b2ad98")
}
> db.checkIfValueDemo.insertOne({"PlayerName":"John Doe","PlayerScores":[]});
{
   "acknowledged" : true,
   "insertedId" : ObjectId("5cc6f512af8e7a4ca6b2ad99")
}
> db.checkIfValueDemo.insertOne({"PlayerName":"Carol Taylor","PlayerScores":[7848474,8746345353]});
{
   "acknowledged" : true,
   "insertedId" : ObjectId("5cc6f521af8e7a4ca6b2ad9a")
}
> db.checkIfValueDemo.insertOne({"PlayerName":"David Miller","PlayerScores":[]});
{
   "acknowledged" : true,
   "insertedId" : ObjectId("5cc6f531af8e7a4ca6b2ad9b")
}
Following is the query to display all documents from a collection with the help of find() method −
> db.checkIfValueDemo.find().pretty();
This will produce the following output −
{
   "_id" : ObjectId("5cc6f507af8e7a4ca6b2ad98"),
   "PlayerName" : "John Smith",
   "PlayerScores" : [
      5000,
      98595858,
      554343
   ]
}
{
   "_id" : ObjectId("5cc6f512af8e7a4ca6b2ad99"),
   "PlayerName" : "John Doe",
   "PlayerScores" : [ ]
}
{
   "_id" : ObjectId("5cc6f521af8e7a4ca6b2ad9a"),
   "PlayerName" : "Carol Taylor",
   "PlayerScores" : [
      7848474,
      8746345353
   ]
}
{
   "_id" : ObjectId("5cc6f531af8e7a4ca6b2ad9b"),
   "PlayerName" : "David Miller",
   "PlayerScores" : [ ]
}
Following is the query to check if value exists for a field in a document. Here, we are checking for field 'PlayerScores with value [ ] −
> db.checkIfValueDemo.find({'PlayerScores.0' : {$exists: true}}).count();
This will produce the following output
2
Class cast() method in Java with Examples - GeeksforGeeks

27 Dec, 2019
The cast() method of java.lang.Class class is used to cast the specified object to the object of this class. The method returns the object after casting in the form of an object.
Syntax:
public T[] cast(Object obj)

Parameter: This method accepts a parameter obj which is the object to be cast upon
Return Value: This method returns the specified object after casting in the form of an object.
Exception: This method throws:
ClassCastException: if the object is not null and is not assignable to the type T.
Below programs demonstrate the cast() method.
Example 1:
// Java program to demonstrate// cast() method  import java.util.*;  public class Test {      public static Object obj;      public static void main(String[] args)        throws ClassNotFoundException    {          // returns the Class object for this class        Class myClass = Class.forName("Test");          System.out.println("Class represented by myClass: "                           + myClass.toString());          // Cast the object obj to object of myClass        // using cast() method        System.out.println("Object " + obj + " after cast "                           + "upon to class Test: "                           + myClass.cast(obj));    }}
Class represented by myClass: class Test
Object null after cast upon to class Test: null

Example 2:
// Java program to demonstrate// cast() method  import java.util.*;  class Main {      private static int obj = 10;      public static void main(String[] args)        throws ClassNotFoundException    {          try {            // returns the Class object for this class            Class myClass = Class.forName("Main");              System.out.println("Class represented by myClass: "                               + myClass.toString());              // Cast the object obj to object of myClass            // using cast() method            System.out.println("Object " + obj + " after cast "                               + "upon to class Test: "                               + myClass.cast(obj));        }        catch (Exception e) {            System.out.println(e);        }    }}
Class represented by myClass: class Main
java.lang.ClassCastException: Cannot cast java.lang.Integer to Main

Reference: https://docs.oracle.com/javase/9/docs/api/java/lang/Class.html#cast-java.lang.Object-
Java-Functions
Java-lang package
Java.lang.Class
Java
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Initialize an ArrayList in Java
HashMap in Java with Examples
Interfaces in Java
ArrayList in Java
Multidimensional Arrays in Java
Overriding in Java
Stack Class in Java
Set in Java
LinkedList in Java
Singleton Class in Java
How to make a div center align in HTML?

To center div element center ,you can use "div style="text-align:center" " and to center the div ,use "div style="margin: 0 auto" "
In your code, the above css will be written as −
<div style="text-align:center;width: 300px;margin: 0 auto;border-style: dotted;">
<p>hi</p>
</div>
What is onmouseover event in JavaScript?

The onmouseover event triggers when the mouse pointer moves over an element.
You can try to run the following code to learn how to work with onmouseover event in JavaScript −
<html>
   <head>
      <script>
         <!--
            function sayHello() {
               alert("Mouse Over")
            }
         //-->
      </script>
   </head>
   <body>
      <p onmouseover = "sayHello()">This is demo text for mouseover event.</p>
   </body>
</html>
Prototype - AJAX Response() Method

This AJAX Ajax.Response is the object passed as the first argument of all Ajax requests callbacks.
This is a wrapper around the native xmlHttpRequest object. It normalizes cross-browser issues while adding support for JSON via the responseJSON and headerJSON properties.
document Object
or null
Object, Array
or null
Object, Array
or null
Following is the example to show the usage of status and  responseText properties −
<html>
   <head>
      <title>Prototype examples</title>
      <script type = "text/javascript" src = "/javascript/prototype.js"></script>
      
      <script>
         function SubmitRequest() {
            new Ajax.Request('/cgi-bin/ajax.cgi', {
               method: 'get',
               onSuccess: successFunc,
               onFailure:  failureFunc
            });
         }
         function successFunc(response) {
            if (200 == response.status) {
               alert("Call is success");
            }
            var container = $('notice');
            var content = response.responseText;
            container.update(content);
         }
         function failureFunc(response) {
            alert("Call is failed" );
         }
      </script>
   </head>

   <body>
      <p>Click submit button to see how current notice changes.</p>
      <br />
 
      <div id = "notice">Current Notice</div>
      <br />
      <br />
      <input type = "button" value = "Submit" onclick = "SubmitRequest();"/>
   </body>
</html>
Here is the content of ajax.cgi.
#!/usr/bin/perl

print "Content-type: text/html\n\n";

print "This content is returned by AJAX cgi ";
print "Current Time " . localtime;
Click submit button to see how current notice changes.
String or
null
String or
null
Following is the example to show the usage of getAllHeaders() and  getResponseHeader(name) methods −
<html>
   <head>
      <title>Prototype examples</title>
      <script type = "text/javascript" src = "/javascript/prototype.js"></script>
      
      <script>
         function SubmitRequest() {
            new Ajax.Request('/cgi-bin/ajax.cgi', {
               method: 'get',
               onSuccess: successFunc
            });
         }
         function successFunc(response) {
            var content = response.getAllHeaders();
            var container = $(header1);
            container.update(content);
            var content = response.getResponseHeader('Content-Type');
            var container = $(header2);
            container.update(content);
         }
      </script>
   </head>

   <body>
      <p>Click submit button to see the result:</p>
      <br />
 
      <div id = "header1">All Headers</div>
      <div id = "header2">Content Type</div>
      <br />
      <br />
      <input type = "button" value = "Submit" onclick = "SubmitRequest();"/>
   </body>
</html>
Click submit button to see the result:

    127 Lectures 
     11.5 hours 

 Aleksandar Cucukovic
 Print
 Add Notes
 Bookmark this page
Display strikethrough text in HTML

The HTML <strike> tag specifies strikethrough text. This tag is deprecated now, use <del> instead. The HTML <del> tag is used for markup of deleted text i.e. strikethrough text.
You can try to run the following code to display strikethrough text in HTML −
<!DOCTYPE html>
<html>
   <head>
      <title>HTML strike Tag</title>
   </head>
   <body>
      The HTML strike tag renders a <del>strike</del> through the middle of the text.
   </body>
</html>
How do JavaScript primitive/object types passed in functions?

Following is the code to pass JavaScript primitive and object types to function −
 Live Demo
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<style>
   body {
      font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
   }
   .result {
      font-size: 18px;
      font-weight: 500;
      color: blueviolet;
   }
</style>
</head>
<body>
<h1>Passing primitive/object types to function</h1>
<div class="result"></div>
<div class="result"></div>
<button class="Btn">Click here</button>
<h3>Click on the above button to pass primitive and object to a function and call it</h3>
<script>
   let BtnEle = document.querySelector(".Btn");
   let resEle = document.querySelector(".result");
   let person = { name: "Rohan", age: 12, city: "Delhi" };
   function printObj(obj) {
      resEle.innerHTML = "Name = " + obj.name + "<br>";
      resEle.innerHTML += "age = " + obj.age + "<br>";
      resEle.innerHTML += "city = " + obj.city + "<br>";
   }
   function printPrimitive(prim) {
      resEle.innerHTML += prim;
   }
   BtnEle.addEventListener("click", () => {
      printObj(person);
      printPrimitive(22);
   });
</script>
</body>
</html>
On clicking the ‘CLICK HERE’ button −
Hashing by Division in Data Structure

Here we will discuss about the hashing with division. For this we use the hash function −
h(x) = x mod m
To use this hash function we maintain an array A[0, ... m – 1]. Where each element of the array is a pointer to the head of the linked list. The linked list Li is pointed to array element A[i] holds all elements x such that h(x) = i. This technique is known as hashing by chaining.
In such hash table, if we want to increase an element x, this will take O(1) time. we compute the index i = h(x). Then append or prepend x to the list Li. If we want to search or delete an element, that process is not so easy. We have to find index i = h(x). Then traverse list Li. Until we reach the desired value or the list is exhausted. This operation is taking time corresponding to the size of list Li. If our set S has 0, m, 2m, 3m, ...., nm elements, then all elements stored in L0 will take linear time to search and delete.
This kind of situation is very rare. For example, if S are uniformly and independently distributed in the universal set U, and u is a multiple of m, then the expected size of each list Li is only n/m. In this case the searching and deleting takes O(1 + α) amount of time. To avoid the mentioned scenario, we have to choose m wisely. generally, we avoid m as power of 2. Taking m as a prime which is not too closer to power of 2 is recommended.
Boxing and Unboxing in C#

Boxing is the implicit conversion of a value type to a reference type.
Unboxing is the explicit conversion of the reference type created by boxing, back to a value type.
Let us see an example code snippet −
// int
int myVal = 12;
// Boxing
object myBoxed = myVal;
// Unboxing
int myUnBoxed = (int) myBoxed;
Let us see another example that shows an array list in C# −
int a = 5;
ArrayList arr = new ArrayList();
// Boxing
arr.Add(a);
// UnBoxing
int b = (int)arr[0];
How to mark strikethrough text in HTML?

To mark strikethrough text in HTML, use the <strike>...</strike> tag. It renders a strikethrough text. HTML deprecated this tag and it shouldn’t be used in HTML5. As an alternative, use the CSS text-decoration property.
To use the CSS property, use the style attribute. The style attribute specifies an inline style for an element. The attribute can be used with the HTML <p> tag. Just keep in mind, HTML5 does not support the <strike> tag, so the CSS style should be used.
You can try to run the following code to mark strikethrough text in HTML
<!DOCTYPE html>
<html>
<head>
<title>HTML Strikethrough text</title>
</head>

<body>
<h1>Heading</h1>
<p style="text-decoration: line-through;">
Strikethrough text
</p>
</body>
</html>
Using OpenCV with Tkinter

Open CV is a Python library that is used to work with Computer Vision and other artificial artifacts. Open CV has inbuilt functions and methods which provide access to work with Computer Vision in Artificial Intelligence and Machine Learning. Some of the examples of Open CV are: face detection, object detection, X-ray and other industrial uses.
Using Tkinter Library, we can create an interactive application that uses OpenCV as the essential part of the application.
To create the application, you are required to install OpenCV in your local machine and make sure that Python Pillow package is pre-installed. You can install these packages by typing the following commands in the notebook.
pip install open-cv
pip install Pillow
Once the installation is complete, we can start creating the structure and GUI of the application. The basic functionality of our application would be to open the web camera (if possible) using OpenCV. So, to display each and every captured frame, we can use Python Pillow (PIL) package which converts the frame into an Image. The Image now can be used in a Label widget that iteratively displays every captured frame in the window.
# Import required Libraries
from tkinter import *
from PIL import Image, ImageTk
import cv2

# Create an instance of TKinter Window or frame
win= Tk()

# Set the size of the window
win.geometry("700x350")# Create a Label to capture the Video frames
label =Label(win)
label.grid(row=0, column=0)
cap= cv2.VideoCapture(0)

# Define function to show frame
   def show_frames():
      # Get the latest frame and convert into Image
      cv2image= cv2.cvtColor(cap.read()[1],cv2.COLOR_BGR2RGB)
      img = Image.fromarray(cv2image)

      # Convert image to PhotoImage
      imgtk = ImageTk.PhotoImage(image = img)
      label.imgtk = imgtk
      label.configure(image=imgtk)

# Repeat after an interval to capture continiously
label.after(20, show_frames)

show_frames()
win.mainloop()
When we execute the above code, it will display a window that opens the user camera to capture the frames.
VBA - CDate Function

The Function converts a valid date and time expression to type date.
cdate(date)

Add a button and add the following function.
Private Sub Constant_demo_Click()
   Dim a as Variant
   Dim b as Variant
   
   a = cdate("Jan 01 2020")
   msgbox("The Value of a : " & a)
   
   b = cdate("31 Dec 2050")
   msgbox("The Value of b : " & b)
End Sub
When you execute the function, it produces the following output.
The Value of a : 1/01/2020
The Value of b : 31/12/2050 


    101 Lectures 
     6 hours 

 Pavan Lalwani

    41 Lectures 
     3 hours 

 Arnold Higuit

    80 Lectures 
     5.5 hours 

 Prashant Panchal

    25 Lectures 
     2 hours 

 Prashant Panchal

    26 Lectures 
     2 hours 

 Arnold Higuit

    92 Lectures 
     10.5 hours 

 Vijay Kumar Parvatha Reddy
 Print
 Add Notes
 Bookmark this page
How to display regression slope using model in a plot created by ggplot2 in R?

To display regression slope using model in a plot created by ggplot2, we can follow the below steps −
First of all, create the data frame.
Use annotate function of ggplot2 to create the scatterplot with regression slope displayed on the plot.
Check the regression slope.
Let's create a data frame as shown below −
 Live Demo
x<-rnorm(25)
y<-rnorm(25)
df<-data.frame(x,y)
df
On executing, the above script generates the below output(this output will vary on your system due to randomization) −
      x          y
1 -0.3344355 -1.107060779
2 0.9164450 -2.499279489
3 -1.2110213 -1.232242802
4 -0.2469611 -0.002048849
5 0.8153152 0.096430178
6 1.5256898 0.366641036
7 0.2477990 -0.887210596
8 -0.5315179 1.594046357
9 -0.3118217 -0.059540798
10 -2.3218482 -0.578005944
11 -0.2519221 -1.470768208
12 0.8210061 -0.252782378
13 0.3679411 0.907479636
14 -1.1653608 -1.645537248
15 -2.7027016 -0.543878325
16 -0.2973516 0.217316266
17 0.1234872 0.749658413
18 1.1059414 0.204091591
19 0.6868014 0.976441196
20 -1.2037182 0.560449928
21 0.1567828 -0.799122836
22 0.5292457 -2.364608009
23 -0.9377216 0.347594404
24 0.5401030 -1.615585141
25 -0.5440631 0.637820747
Creating the scatterplot with regression line and slope of the model displayed on the plot −
 Live Demo
x<-rnorm(25)
y<-rnorm(25)
df<-data.frame(x,y)
library(ggplot2)
ggplot(df,aes(x,y))+geom_point()+stat_smooth(method="lm",se=F)+annotate("text",x=-
2,y=1,label=(paste0("slope==",coef(lm(df$y~df$x))[2])),parse=TRUE)
`geom_smooth()` using formula 'y ~ x'
Use coeff function to find the slope of the model and check if it matches with the one displayed in the plot −
x<-rnorm(25)
y<-rnorm(25)
df<-data.frame(x,y)
coef(lm(df$y~df$x))[2]
df$x
0.01180069
DAX Math & Trigonometric - ROUND function

Rounds a number to the specified number of digits.
ROUND (<number>, <num_digits>) 

number
The number you want to round.
num_digits
The number of digits to which you want to round.
A decimal number.
If num_digits > 0, then the number is rounded to the specified number of decimal places.
If num_digits > 0, then the number is rounded to the specified number of decimal places.
If num_digits = 0, the number is rounded to the nearest integer.
If num_digits = 0, the number is rounded to the nearest integer.
If num_digits < 0, the number is rounded to the left of the decimal point.
If num_digits < 0, the number is rounded to the left of the decimal point.
You can also use the following DAX functions in specific instances −
DAX ROUNDUP function to always round up (away from zero).
DAX ROUNDUP function to always round up (away from zero).
DAX ROUNDDOWN function to always round down (toward zero).
DAX ROUNDDOWN function to always round down (toward zero).
DAX MROUND function to round a number to a specific multiple.
DAX MROUND function to round a number to a specific multiple.
DAX TRUNC and INT functions to obtain the integer portion of the number.
DAX TRUNC and INT functions to obtain the integer portion of the number.
= ROUND (5.5555555,2) returns 5.56. 
= ROUND (5.5555555,0) returns 6. 
= ROUND (5.5555555, -1) returns 10. 
= ROUND (5.5555555, -2) returns 0. 

    53 Lectures 
     5.5 hours 

 Abhay Gadiya

    24 Lectures 
     2 hours 

 Randy Minder

    26 Lectures 
     4.5 hours 

 Randy Minder
 Print
 Add Notes
 Bookmark this page
Wand implode() function – Python

25 Aug, 2021
The implode() function is an inbuilt function in the Python Wand ImageMagick library which is used to create a “imploding” effect by pulling pixels towards the center of the image. 
Syntax: 
implode(amount, method)
Parameters: This function accepts two parameters as mentioned above and defined below: 
amount: This parameter stores the normalized degree of effect between 0.0 & 1.0.
method: This parameter stores the interpolation method.
Return Value: This function returns the Wand ImageMagick object.
Original Image:  
Example 1: 
Python3
# Import library from Imagefrom wand.image import Image # Import the imagewith Image(filename ='../geeksforgeeks.png') as image:    # Clone the image in order to process    with image.clone() as implode:        # Invoke implode function        implode.implode(0.5, "blend")        # Save the image        implode.save(filename ='implode1.jpg')
Output: 
Example 2: 
Python3
# Import libraries from the wand from wand.image import Imagefrom wand.drawing import Drawingfrom wand.color import Color with Drawing() as draw:    # Set Stroke color the circle to black    draw.stroke_color = Color('black')    # Set Width of the circle to 2    draw.stroke_width = 1    # Set the fill color to 'White (# FFFFFF)'    draw.fill_color = Color('white')     # Invoke Circle function with center at 50, 50 and radius 25    draw.circle((200, 200), # Center point                (100, 100)) # Perimeter point    # Set the font style    draw.font = '../Helvetica.ttf'    # Set the font size    draw.font_size = 30         with Image(width = 400, height = 400, background = Color('# 45ff33')) as pic:        # Set the text and its location        draw.text(int(pic.width / 3), int(pic.height / 2), 'GeeksForGeeks !')        # Draw the picture        draw(pic)        # Invoke implode function        pic.implode(0.7, "catrom")        # Save the image        pic.save(filename ='implode2.jpg')
Output: 
 
sagartomar9927
Image-Processing
Python-wand
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Python Classes and Objects
Python OOPs Concepts
Introduction To PYTHON
How to drop one or multiple columns in Pandas Dataframe
Python | os.path.join() method
How To Convert Python Dictionary To JSON?
Check if element exists in list in Python
Python | datetime.timedelta() function
Python | Get unique values from a list
reflect.TypeOf() Function in Golang with Examples

28 Apr, 2020
Go language provides inbuilt support implementation of run-time reflection and allowing a program to manipulate objects with arbitrary types with the help of reflect package.The reflect.TypeOf() Function in Golang is used to get the reflection Type that represents the dynamic type of i. To access this function, one needs to imports the reflect package in the program.
Syntax:
func TypeOf(i interface{}) Type

Parameters: This function takes only one parameters of interface( i ).
Return Value: This function returns the reflection Type.
Below examples illustrate the use of above method in Golang:
Example 1:
// Golang program to illustrate// reflect.TypeOf() Function   package main  import (    "fmt"    "reflect")  // Main functionfunc main() {      tst1 := "string"    tst2 := 10    tst3 := 1.2    tst4 := true    tst5 := []string{"foo", "bar", "baz"}    tst6 := map[string]int{"apple": 23, "tomato": 13}            // use of TypeOf method           fmt.Println(reflect.TypeOf(tst1))       fmt.Println(reflect.TypeOf(tst2))    fmt.Println(reflect.TypeOf(tst3))    fmt.Println(reflect.TypeOf(tst4))    fmt.Println(reflect.TypeOf(tst5))    fmt.Println(reflect.TypeOf(tst6))  }
Output:
string
int
float64
bool
[]string
map[string]int

Example 2:
// Golang program to illustrate// reflect.TypeOf() Function   package main  import (    "fmt"    "io"    "os"    "reflect")  // Main functionfunc main() {          // use of TypeOf method    tt := reflect.TypeOf((*io.Writer)(nil)).Elem()      fileType := reflect.TypeOf((*os.File)(nil))    fmt.Println(fileType.Implements(tt))  }
Output:
true

Golang-reflect
Go Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
strings.Replace() Function in Golang With Examples
fmt.Sprintf() Function in Golang With Examples
Arrays in Go
Golang Maps
How to Split a String in Golang?
Interfaces in Golang
Data Types in Go
Slices in Golang
Different Ways to Find the Type of Variable in Golang
How to Parse JSON in Golang?
GATE | GATE-CS-2016 (Set 1) | Question 29

16 Sep, 2021
Consider the following code segment.
x = u - t;
y = x * v;
x = y + w;
y = t - z;
y = x * y; 
The minimum number of total variables required to convert the above code segment to static single assignment form is
 Note : This question was asked as Numerical Answer Type.(A) 6(B) 8(C) 9(D) 10Answer: (D)Explanation: Static Single Assignment is used for intermediate code in compiler design. In Static Single Assignment form(SSA) each assignment to a variable should be specified with distinct names. We use subscripts to distinguish each definition of variables.
In the given code segment, there are two assignments of the variable x
x = u - t;
x = y + w;

and three assignments of the variable y.
y = x * v;
y = t - z;
y = x * y 
So we use two variables x1, x2 for specifying distinct assignments of x and y1, y2 and y3 each assignment of y. So, total number of variables is 10 (x1, x2, y1, y2, y3, t, u, v, w, z).Static Single Assignment form(SSA) of the given code segment is:
x1 = u - t;
y1 = x1 * v;
x2 = y1 + w;
y2 = t - z;
y3 = x2 * y2;
Please refer below link for detailshttps://www.cs.cmu.edu/~fp/courses/15411-f08/lectures/09-ssa.pdf
GATE PYQ - Code Generation and Optimization | Joyojyoti Acharya | GeeksforGeeks GATE | - YouTubeGeeksforGeeks GATE Computer Science17.5K subscribersGATE PYQ - Code Generation and Optimization | Joyojyoti Acharya | GeeksforGeeks GATE |Watch laterShareCopy linkInfoShoppingTap to unmuteIf playback doesn't begin shortly, try restarting your device.More videosMore videosYou're signed outVideos you watch may be added to the TV's watch history and influence TV recommendations. To avoid this, cancel and sign in to YouTube on your computer.CancelConfirmSwitch cameraShareInclude playlistAn error occurred while retrieving sharing information. Please try again later.Watch on0:000:0023:59 / 59:20•Live•<div class="player-unavailable"><h1 class="message">An error occurred.</h1><div class="submessage"><a href="https://www.youtube.com/watch?v=4ab8S2Qs7h8" target="_blank">Try watching this video on www.youtube.com</a>, or enable JavaScript if it is disabled in your browser.</div></div>Quiz of this Question
GATE-CS-2016 (Set 1)
GATE-GATE-CS-2016 (Set 1)
GATE
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
PHP | Converting string to Date and DateTime

31 Jul, 2021
Converting the string to Date and DateTime uses several functions/methods like strtotime(), getDate(). We will see what these functions do.strtotime() – This is basically a function which returns the number of seconds passed since Jan 1, 1970, just like a linux machine timestamp. It returns the number of seconds passed according to the parameter passed to the function.Syntax
 strtotime(parameter);
Parameter
Time/Date
now(optional)
Return Type Returns the number of seconds passed since Jan 1, 1970.
getDate() This function return the date/time information of the passed parameter(date/time);Syntax
getDate(parameter);
Parameter The parameter is optional as it takes the current local time as default parameter.Return Type It returns the information of the date, day, year, month etc in an array.
Code for converting a string to date
<?php$time_input = strtotime("2011/05/21"); $date_input = getDate($time_input); print_r($date_input);                ?>
Array
(
    [seconds] => 0
    [minutes] => 0
    [hours] => 0
    [mday] => 21
    [wday] => 6
    [mon] => 5
    [year] => 2011
    [yday] => 140
    [weekday] => Saturday
    [month] => May
    [0] => 1305936000
)

Code for converting a string to dateTime
<?php$input = '06/10/2011 19:00:02';$date = strtotime($input);echo date('d/M/Y h:i:s', $date);?>
10/Jun/2011 07:00:02

Note1 We can use “D” in the place of “d” for getting the day in the output
<?php$input = '05/10/2011 15:00:02';$date = strtotime($input);echo date('D/M/Y h:i:s', $date);?>
Tue/May/2011 03:00:02

Note 2 We can use “H” in the place of “h” for getting the time in 24 Hour format in the output
<?php$input = '05/10/2011 15:00:02';$date = strtotime($input);echo date('D/M/Y H:i:s', $date);?>
Tue/May/2011 15:00:02

Similarly, the “i” and “s” could also be changed to uppercase to find different outputs, it is possible but not of much use.
PHP is a server-side scripting language designed specifically for web development. You can learn PHP from the ground up by following this PHP Tutorial and PHP Examples.
date-time-program
PHP-date-time
PHP-string
Picked
Technical Scripter 2018
PHP
Technical Scripter
PHP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to execute PHP code using command line ?
How to Insert Form Data into Database using PHP ?
PHP in_array() Function
How to delete an array element based on key in PHP?
How to convert array to string in PHP ?
How to pop an alert message box using PHP ?
How to Upload Image into Database and Display it using PHP ?
How to check whether an array is empty using PHP?
Comparing two dates in PHP
Split a comma delimited string into an array in PHP
How to ignore the multiple properties of a JSON object in Java?

The @JsonIgnoreProperties Jackson annotation can be used to specify a list of properties or fields of a class to ignore. The @JsonIgnoreProperties
annotation can be placed above the class declaration instead of above the individual properties or fields to ignore.
@Target(value={ANNOTATION_TYPE,TYPE,METHOD,CONSTRUCTOR,FIELD})
@Retention(value=RUNTIME)
public @interface JsonIgnoreProperties
import java.io.*;
import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.databind.*;
public class JsonIgnorePropertiesTest {
   public static void main(String[] args) throws IOException {
      Customer customer = new Customer("120", "Ravi", "Hyderabad");
      System.out.println(customer);
      ObjectMapper mapper = new ObjectMapper();
      String jsonString = mapper.writeValueAsString(customer);
      System.out.println("JSON: " + jsonString);
      System.out.println("---------");
      jsonString = "{\"id\":\"130\",\"name\":\"Rahul\", \"address\":\"Mumbai\"}";
      System.out.println("JSON: " + jsonString);
      customer = mapper.readValue(jsonString, Customer.class);
      System.out.println(customer);
   }
}
// Customer class
@JsonIgnoreProperties({"id", "address"}) 
class Customer {
   private String id;
   private String name;
   private String address;
   public Customer() {
   }
   public Customer(String id, String name, String address) {
      this.id = id;
      this.name = name;
      this.address = address;
   }
   public String getId() {
      return id;
   }
   public String getName() {
      return name;
   }
   public String getAddress() {
      return address;
   }
   @Override
   public String toString() {
      return "Customer [id=" + id + ", name=" + name + ", address=" + address + "]";
   }
}
Customer [id=120, name=Ravi, address=Hyderabad]
JSON: {"name":"Ravi"}
---------
JSON: {"id":"130","name":"Rahul", "address":"Mumbai"}
Customer [id=null, name=Rahul, address=null]
Min and max values of an array in MongoDB?

To get the min and max values, use minandmax. Let us create a collection with documents −
> db.demo286.insertOne({"details":[{Value1:70,Value2:50},{Value1:30,Value2:36}]});
{
   "acknowledged" : true,
   "insertedId" : ObjectId("5e4ac743f49383b52759cbbc")
}
Display all documents from a collection with the help of find() method −
> db.demo286.find().pretty();
This will produce the following output −
{
   "_id" : ObjectId("5e4ac743f49383b52759cbbc"),
   "details" : [
      {
         "Value1" : 70,
         "Value2" : 50
      },
      {
         "Value1" : 30,
         "Value2" : 36
      }
   ]
}
Here is the query to get min and max values of an array −
> db.demo286.aggregate([   { "$project": { "name": 1, "MinValue1": { "$min": "$details.Value1" },     "MaxValue2": { "$max": "$details.Value2" } }} ])
This will produce the following output −
{ "_id" : ObjectId("5e4ac743f49383b52759cbbc"), "MinValue1" : 30, "MaxValue2" : 50 }
String compareToIgnoreCase() Method

This method compares two strings lexicographically, ignoring case differences.
Here is the syntax of this method −
int compareToIgnoreCase(String str)

Here is the detail of parameters −
str − the String to be compared.
str − the String to be compared.
This method returns a negative integer, zero, or a positive integer as the specified String is greater than, equal to, or less than this String, ignoring case considerations.
This method returns a negative integer, zero, or a positive integer as the specified String is greater than, equal to, or less than this String, ignoring case considerations.
public class Test {

   public static void main(String args[]) {
      String str1 = "Strings are immutable";
      String str2 = "Strings are immutable";
      String str3 = "Integers are not immutable";

      int result = str1.compareToIgnoreCase( str2 );
      System.out.println(result);

      result = str2.compareToIgnoreCase( str3 );
      System.out.println(result);

      result = str3.compareToIgnoreCase( str1 );
      System.out.println(result);
   }
}
This will produce the following result −
0
10
-10


    16 Lectures 
     2 hours 

 Malhar Lathkar

    19 Lectures 
     5 hours 

 Malhar Lathkar

    25 Lectures 
     2.5 hours 

 Anadi Sharma

    126 Lectures 
     7 hours 

  Tushar Kale

    119 Lectures 
     17.5 hours 

 Monica Mittal

    76 Lectures 
     7 hours 

 Arnab Chakraborty
 Print
 Add Notes
 Bookmark this page
GeeksforGeeks | A computer science portal for geeks

Events at GeeksforGeeks






Courses at GeeksforGeeks






Write an Article






Java Tutorial






Python Tutorial






Data Structures Tutorial






Coding Practice






Events at GeeksforGeeks






Courses at GeeksforGeeks






Write an Article






Java Tutorial






Python Tutorial






Data Structures Tutorial






Coding Practice




Get Hired With GeeksforGeeks and Win Exciting Rewards!
                    
October 30, 2021

October 30, 2021

Master the Coding Interview – Contest Series Based On Real Interviews
                    
October 5, 2021

October 5, 2021

Recently Asked Interview Questions in Product Based Companies
                    
May 11, 2021

May 11, 2021

Bridge the Gap Between Engineering and Your Dream Job – Complete Interview Preparation
                    
May 1, 2021

May 1, 2021

100 Days of Code – A Complete Guide For Beginners and Experienced
                    
May 1, 2021

May 1, 2021



Guest Blogs





Must Do Coding Questions
                                            Company-wise





Practice for cracking any coding
                                            interview





Placements





Complete Interview Preparation With
                                            Doubt Assistance





GATE Computer Science Notes





Machine Learning





Django Tutorial





Computer Science Projects





Amazon SDE Test Series





Company Interview Corner





The C++ Standard Template Library
                                            (STL)





Software Design Patterns





SQL Tutorial





Advanced Data Structures
C# - Break Statement

The break statement in C# has following two usage −
When the break statement is encountered inside a loop, the loop is immediately terminated and program control resumes at the next statement following the loop.
When the break statement is encountered inside a loop, the loop is immediately terminated and program control resumes at the next statement following the loop.
It can be used to terminate a case in the switch statement.
It can be used to terminate a case in the switch statement.
If you are using nested loops (i.e., one loop inside another loop), the break statement will stop the execution of the innermost loop and start executing the next line of code after the block.
The syntax for a break statement in C# is as follows −
break;

using System;

namespace Loops {
   class Program {
      static void Main(string[] args) {
         /* local variable definition */
         int a = 10;
         
         /* while loop execution */
         while (a < 20) {
            Console.WriteLine("value of a: {0}", a);
            a++;
            
            if (a > 15) {
               /* terminate the loop using break statement */
               break;
            }
         }
         Console.ReadLine();
      }
   }
} 
When the above code is compiled and executed, it produces the following result −
value of a: 10
value of a: 11
value of a: 12
value of a: 13
value of a: 14
value of a: 15


    119 Lectures 
     23.5 hours 

 Raja Biswas

    37 Lectures 
     13 hours 

 Trevoir Williams

    16 Lectures 
     1 hours 

 Peter Jepson

    159 Lectures 
     21.5 hours 

 Ebenezer Ogbu

    193 Lectures 
     17 hours 

 Arnold Higuit

    24 Lectures 
     2.5 hours 

 Eric Frick
 Print
 Add Notes
 Bookmark this page
Find specific records from a column with comma separated values in MySQL

For this, you can use FIND_IN_SET(). Let us first create a table −
mysql> create table DemoTable
   -> (
   -> ListOfValue varchar(20)
   -> );
Query OK, 0 rows affected (0.52 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable values('78,89,65');
Query OK, 1 row affected (0.12 sec)
mysql> insert into DemoTable values('88,96,97');
Query OK, 1 row affected (0.30 sec)
mysql> insert into DemoTable values('95,96,99,100');
Query OK, 1 row affected (0.11 sec)
mysql> insert into DemoTable values('78,45,67,98');
Query OK, 1 row affected (0.10 sec)
Display all records from the table using select statement −
mysql> select * from DemoTable;
This will produce the following output −
+--------------+
| ListOfValue  |
+--------------+
| 78,89,65     |
| 88,96,97     |
| 95,96,99,100 |
| 78,45,67,98  |
+--------------+
4 rows in set (0.00 sec)
Following is the query to find specific records from a column with comma-separated values −
mysql> select * from DemoTable
   -> where find_in_set('89',ListOfValue)
   -> or
   -> find_in_set('99',ListOfValue);
This will produce the following output −
+--------------+
| ListOfValue  |
+--------------+
| 78,89,65     |
| 95,96,99,100 |
+--------------+
2 rows in set (0.00 sec)
What is the character wrapper class and its methods in Java?

The Character class of the java.lang package wraps a value of the primitive datatype char. It offers a number of useful class (i.e., static) methods for manipulating characters. You can create a Character object with the Character constructor.
Character ch = new Character('a');

Following are the notable methods of the Character class.
isLetter()
Determines whether the specified char value is a letter.
isDigit()
Determines whether the specified char value is a digit.
isWhitespace()
Determines whether the specified char value is white space.
isUpperCase()
Determines whether the specified char value is uppercase.
isLowerCase()
Determines whether the specified char value is lowercase.
toUpperCase()
Returns the uppercase form of the specified char value.
toLowerCase()
Returns the lowercase form of the specified char value.
toString()
Returns a String object representing the specified character value that is, a one-character string.
 Live Demo
public class CharacterClassExample {
   public static void main(String[] args) {
      char ch1, ch2;
      ch1 = '9';
      ch2 = 'V';
      
      boolean b1, b2;
      b1 = Character.isDigit(ch1);
      b2 = Character.isDigit(ch2);
      
      String str1 = ch1 + " is a digit is " + b1;
      String str2 = ch2 + " is a digit is " + b2;
      System.out.println( str1 );
      System.out.println( str2 );
   }
}
9 is a digit is true
V is a digit is false
Setup Web Server Over Docker Container in Linux - GeeksforGeeks

04 May, 2020
Before setting up a server we must know the real meaning or definition of a server. So, the Server is a program that provides the client with any kind of services. For example, a web server provides our websites, a database server provides us data. This means every server has work to do and for every different work we want them to do, we have to choose different servers.For knowing more about servers and their working click here. To check more about dockers – click here.
Linux Operating system Like Ubuntu, Redhat, Kali Linux.Internet connectivityDocker installed on system
Linux Operating system Like Ubuntu, Redhat, Kali Linux.
Internet connectivity
Docker installed on system
Let’s now understand the installation and configuration.
Install the Server Program
Configuration of Server
Start the server
Start docker services.
systemctl start docker
Open the docker container, you can use centos 7 images to launch.If you don’t have centos images you can download it from the www.hub.docker.com
docker run -it --network host centos:7
We are going to use HTTPD server.It could be installed using YUM command and DNF if you are using RHEL 8.
yum install httpd
webserver installation
Actually the server is already been configured and now its the time to update or make a website over this server.Server website can be accessed using the IP address of the host.Setup website
cd /var/www/html/
In this directory you could save your website and it would be available over the network.
systemctl start httpd
If this doesn’t start the server, try this
/usr/sbin/httpd
To access the content of the webserver you must know the ip address, which could be known using “ifconfig” command.And then do the further steps.
 curl http://IP of host/page_name.html
Visit Webpage
linux
Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
TCP Server-Client implementation in C
ZIP command in Linux with examples
SORT command in Linux/Unix with examples
tar command in Linux with examples
curl command in Linux with Examples
Conditional Statements | Shell Script
'crontab' in Linux with Examples
Tail command in Linux with examples
UDP Server-Client implementation in C
diff command in Linux with examples