code-rag-bench/online-tutorials huggingface dataset:
Python | Perform operation on each key dictionary

26 Jul, 2019
Sometimes, while working with dictionaries, we might come across a problem in which we require to perform a particular operation on each value of keys. This type of problem can occur in web development domain. Let’s discuss certain ways in which this task can be performed.
Method #1 : Using loopThis is the naive method in which this task can be performed. In this we simply run a loop to traverse each key in dictionary and perform the desired operation.
# Python3 code to demonstrate working of# Perform operation on each key dictionary# Using loop  # Initialize dictionarytest_dict = {'gfg' : 6, 'is' : 4, 'best' : 7}  # printing original dictionaryprint("The original dictionary : " +  str(test_dict))  # Using loop# Perform operation on each key dictionaryfor key in test_dict:        test_dict[key] *= 3  # printing result print("The dictionary after triple each key's value : " + str(test_dict))
The original dictionary : {‘is’: 4, ‘gfg’: 6, ‘best’: 7}The dictionary after triple each key’s value : {‘is’: 12, ‘gfg’: 18, ‘best’: 21}
 
Method #2 : Using update() + dictionary comprehensionAn alternate one-liner to perform this task, the combination of above functions can be used to perform this particular task. The update function is used to perform the necessary operation over the dictionary.
# Python3 code to demonstrate working of# Perform operation on each key dictionary# Using update() + dictionary comprehension  # Initialize dictionarytest_dict = {'gfg' : 6, 'is' : 4, 'best' : 7}  # printing original dictionaryprint("The original dictionary : " +  str(test_dict))  # Using update() + dictionary comprehension# Perform operation on each key dictionarytest_dict.update((x, y * 3) for x, y in test_dict.items())  # printing result print("The dictionary after triple each key's value : " + str(test_dict))
The original dictionary : {‘is’: 4, ‘gfg’: 6, ‘best’: 7}The dictionary after triple each key’s value : {‘is’: 12, ‘gfg’: 18, ‘best’: 21}
Python dictionary-programs
Python
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Different ways to create Pandas Dataframe
Read a file line by line in Python
Python String | replace()
How to Install PIP on Windows ?
Python program to convert a list to string
Defaultdict in Python
Python | Get dictionary keys as a list
Python | Convert a list to dictionary
Python Program for Fibonacci numbers
Matplotlib.pyplot.figtext() in Python

19 Apr, 2020
Matplotlib is an extensively used Python library for data visualization. It is a multi-platform data visualization library built on NumPy arrays, also designed to work with the SciPy stack.
Figtext is used to add text to a figure at any location on it. You can even add the text outside the Axes. It uses the complete figure for co-ordinates, where bottom-left denotes (0, 0) and top right represents (1, 1). The centre of the figure is (0.5, 0.5).
Syntax:
matplotlib.pyplot.figtext(x, y, s, *args, **kwargs)
Example #1: A sample example demonstrating the use of figtext.
# importing required modules import matplotlib.pyplot as pltimport numpy as np    # values of x and y axes x = np.arange(0, 8, 0.1)y = np.sin(x) plt.plot(x, y)  # pyplot.figtext(x, y, string)plt.figtext(0, 0, "This is a sample example \explaining figtext", fontsize = 10)  plt.xlabel('x') plt.ylabel('y') plt.show()
The above example places text on the bottom left of the figure of the given font size.
Example #2: We can also place text at a relative position in the figure by adjusting the values of x and y.
# importing required modules import matplotlib.pyplot as pltimport numpy as np    # values of x and y axes x = np.arange(0, 8, 0.1)y = np.sin(x) plt.plot(x, y)  plt.figtext(0.55, 0.7,            "Sin curve",            horizontalalignment ="center",             verticalalignment ="center",             wrap = True, fontsize = 14,             color ="green")  plt.xlabel('x') plt.ylabel('y') plt.show()
Alignment arguments- horizontalalignment and verticalalignment place the text in the centre while the wrap argument makes sure that the text lies within the figure width. The color argument gives the font color.
Example #3: We can also add a bounding box around the text by using the bbox argument.
# importing required modules import matplotlib.pyplot as pltimport numpy as np    # values of x and y axes x = np.arange(0, 8, 0.1)y = np.exp(x) plt.plot(x, y)  # pyplot.figtext(x, y, string)plt.figtext(0.55, 0.7,             "Exponential Curve",            horizontalalignment ="center",            wrap = True, fontsize = 10,             bbox ={'facecolor':'grey',                    'alpha':0.3, 'pad':5})  plt.xlabel('x') plt.ylabel('y') plt.show()
Example #4: We can also use *args and **kwargs to add text properties to our plot. *args and **kwargs are used to pass multiple arguments or keyword arguments to a function.Note: For more info refer to the article: *args and **kwargs in Python
# importing required propertiesimport numpy as npimport matplotlib.pyplot as plt  x = np.linspace(0, 100, 501)y = np.sin(x)  figtext_args = (0.5, 0,                "figtext using args and kwargs")  figtext_kwargs = dict(horizontalalignment ="center",                       fontsize = 14, color ="green",                       style ="italic", wrap = True)  plt.plot(x, y) plt.figtext(*figtext_args, **figtext_kwargs)plt.show()
Python-matplotlib
Python
Write From Home
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
TheSpeedX / TBomb – Call and SMS Bomber for Kali Linux

17 Jun, 2021
TBomb is a free and open-source tool available on GitHub which is used to perform call and SMS bombing on the target phone number. This is the best tool for performing pranks on someone. This tool is written in python, so you must have python installed in your kali linux operating system. 
This tool works with open-source intelligence APIs that’s why this tool requires an internet connection to perform bombing. This tool doesn’t take your phone number, you only have to enter the target phone number and the tool will do the rest of the work. You must ensure that you always install the latest version of TBomb from GitHub in order to not get stuck with the working of the tool. 
Step 1: Open your kali linux operating system and use the following command to install the tool from GitHub and then move to the tool directory using the second command.
git clone https://github.com/TheSpeedX/TBomb.git
cd TBomb
Step 2: Now you are in the TBomb directory, use the following command to run the tool.
bash tBomb.sh
The tool has been installed successfully and running successfully. Now we will have an example of using the tool.
Example 1: Use the TBomb tool to perform SMS Bombing on a phone number.
For SMS bombing press 1
1
after that give all the details to the tool such as country code, phone number, number of SMS you want to send etc.
Kali-Linux
Linux-Tools
Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
ZIP command in Linux with examples
tar command in Linux with examples
curl command in Linux with Examples
SORT command in Linux/Unix with examples
TCP Server-Client implementation in C
Conditional Statements | Shell Script
Tail command in Linux with examples
UDP Server-Client implementation in C
Docker - COPY Instruction
scp command in Linux with Examples
SQL SELECT Statement

The SELECT statement is used to select data from a database.
The data returned is stored in a result table, called the result-set.
Here, column1, column2, ... are the field names of the table you want to 
select data from. If you 
want to select all the fields available in the table, use the following syntax:
Below is a selection from the "Customers" table in the Northwind sample database:
The following SQL statement selects the "CustomerName" and "City" columns 
from the "Customers" table:
The following SQL statement selects all the columns from the "Customers" 
table:
Insert the missing statement to get all the columns from the Customers table.
 * FROM Customers;

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

In the C programming language, there is an option to create an arc of a circle of a given radius with a given center coordinates and degree of the arc.
The arc()
function is used to create an arc. This arc function is included in graphics.h library in C which contains methods that can draw figures on the output screen.
void arc(int x, int y, int startangle, int endangle, int radius);
Now, let's get deep into the function and understand each parameter passed and output returned by the function.
x − type = int, function: defines the x coordinate of the center of the arc.
y − type = int, function: defines the y coordinate of the center of the arc.
start angle − type = int, function: defines the starting angle of arc.
entangle − type = int, function: defines the ending angle of arc.
Radius − type = int, function: defines the radius of the arc.
#include <graphics.h>
int main(){
   int gd = DETECT, gm;
   int x = 250;
   int y = 250;
   int start_angle = 155;
   int end_angle = 300;
   int radius = 100;
   initgraph(&gd, &gm, "");
   arc(x, y, start_angle, end_angle, radius);
   getch();
   closegraph();
   return 0;
}
C++ Queue Library - queue() Function

The C++ default constructor std::queue::queue() constructs queue object. If cntr argument is passed to constructor, copy of argument is assigned to container otherwise empty queue object is created.
Following is the declaration for std::queue::queue() constructor form std::queue header.
explicit queue (const container_type& ctnr = container_type());

ctnr − Container type which is second parameter of class template.
Constructor never returns value.
Linear if container of non-zero size is passed as argument otherwise constant.
The following example shows the usage of std::queue::queue() constructor.
#include <iostream>
#include <queue>

using namespace std;

int main(void) {   
   deque<int> d(5, 100);
   queue<int>q1;
   queue<int> q2(d);

   cout << "Size of q1 = " << q1.size() << endl;
   cout << "Size of q2 = " << q2.size() << endl;

   return 0;
}
Let us compile and run the above program, this will produce the following result −
Size of q1 = 0
Size of q2 = 5

 Print
 Add Notes
 Bookmark this page
C++ Map Library - end() Function

The C++ function std::map::end() returns an iterator which points to past-the-end element in the map.
The past-the-end element is the theoretical element that would follow the last element in the map.
Following is the declaration for std::map::end() function form std::map header.
iterator end();
const_iterator end() const;

iterator end() noexcept;
const_iterator end() const noexcept;

None
If object is constant qualified then method returns constant iterator otherwise non-constant iterator.
This member function never throws exception.
Constant i.e. O(1)
The following example shows the usage of std::map::end() function.
#include <iostream>
#include <map>

using namespace std;

int main(void) {
   /* Initializer_list constructor */
   map<char, int> m = {
            {'a', 1},
            {'b', 2},
            {'c', 3},
            {'d', 4},
            {'e', 5},
            };

   cout << "Map contains following elements" << endl;

   for (auto it = m.begin(); it != m.end(); ++it)
      cout << it->first << " = " << it->second << endl;

   return 0;
}
Let us compile and run the above program, this will produce the following result −
Map contains following elements
a = 1
b = 2
c = 3
d = 4
e = 5

 Print
 Add Notes
 Bookmark this page
Arduino – base64 encode and decode

Arduino contains a library that helps with base64 encode and decode. You can download it from the Library Manager. Search for base64, and install the library by Densaugeo.
Now, open a new sketch and run the following sample code −
#include "base64.hpp"

unsigned char normal_text[20] = "Hello World";
unsigned char base64_text[20];
unsigned char decoded_text[20];

void setup() {
   // put your setup code here, to run once:
   Serial.begin(9600);
   Serial.println();

   int base64_length = encode_base64(normal_text,12,base64_text);
   Serial.print("Base64 Text: ");Serial.println((char *) base64_text);
   Serial.print("Base64 Length: ");Serial.println(base64_length);

   int decoded_length = decode_base64(base64_text,decoded_text);
   Serial.print("Decoded Text: ");Serial.println((char *)decoded_text);
   Serial.print("Decoded Length: ");Serial.println(decoded_length);
}

void loop() {
   // put your main code here, to run repeatedly:
}
The Serial Monitor Output is shown below −
You can verify this output on websites like: https://base64.guru/converter/decode
As you can see, this library deals with unsigned character arrays. The base64_encode function takes three arguments −
The array to be converted
The array to be converted
The number of elements in the array to be converted
The number of elements in the array to be converted
The array in which to store the encoded values
The array in which to store the encoded values
It returns the length of the encoded array.
The base64_decode function takes in two arguments −
The array containing the encoded values
The array containing the encoded values
The array in which to store the decoded results
The array in which to store the decoded results
Since Serial.print() and its variations don't deal with unsigned char arrays, you need to cast it to a char array for printing.
How to set the text direction with JavaScript?

To set the text direction, use the direction property with JavaScript. Set rtl for right-to-left or ltr for left-to-right text direction.
You can try to run the following code to set the text direction with JavaScript −
Live Demo
<!DOCTYPE html>
<html>
   <body>
      <h1 id="myID">Heading 1</h1>
      <p>Click below to set the direction of heading to Left-to-right</p>
      <button type="button" onclick="display()">Click to change the direction</button>
      <script>
         function display() {
            document.getElementById("myID").style.direction = "rtl";
         }
      </script>
   </body>
</html>
How can a binary semaphore implement mutual exclusion among n processes?

A semaphore is a shared variable which is used to implement mutual exclusion between
system processes. It is mainly helpful to solve critical section problems and is a
technique to achieve process synchronization.
Binary semaphore − Can take only two values, 0 or 1 which means at a time only one process can enter into the critical section. Semaphore is initialized to 1.
Binary semaphore − Can take only two values, 0 or 1 which means at a time only one process can enter into the critical section. Semaphore is initialized to 1.
Counting semaphore − Can take any non-negative value N which means at a time at most N processes can enter into CS. Semaphore is initialized to N.
Counting semaphore − Can take any non-negative value N which means at a time at most N processes can enter into CS. Semaphore is initialized to N.
P(s)
P(s)
CS
CS
V(s)
V(s)
Each of these operations is defined below −
Wait(P) − Whenever a process enters into CS, first it executes P operation where it decreases semaphore value and if after that s>=0 then enters into CS otherwise added to the waiting queue.
P(Semaphore s)
{
   s = s - 1;
   if (s < 0) {
      block(p);
   }
}
Signal(V) − When a process exists CS operation V is performed which increases the value of semaphore indicating another process can enter into CS which is currently blocked by P operation.
V(Semaphore s)
{
   s = s + 1;
   if (s >= 0) {
      wakeup(p);
   }
}
Now let see how binary semaphore can be used to implement mutual exclusion among n
processes.
We know that semaphore is a variable that can be used to control access by multiple
processes to a common resource in multitasking OS. As per the question suppose if there are
n processes that commonly share a semaphore to each process then process allocation
is organized based on the following algorithm.
do {
   wait(mutex);
   signal(mutex);
} while (true);
It is processed using a do-while loop that means it performs 'do' conditions until we get
satisfied while condition.
Here it performs wait and signal operations of mutex until it becomes true.
Python | numpy.printoptions() method

03 Oct, 2019
With the help of numpy.printoptions() method, we can get the custom printing options like we can set the precisions of floating value by using numpy.printoptions() method.
Syntax : numpy.printoptions(precision=value)Return : Return the customized printing like precision.
Example #1 :In this example we can see that by using numpy.printoptions() method, we are able to get the customized printing options like we can set the precision values.
# import numpyimport numpy as np  # using numpy.printoptions() methodwith np.printoptions(precision = 3):     print(np.array([1, 2, 3])/2.38)
Output :
[0.42 0.84 1.261]
Example #2 :
# import numpyimport numpy as np  # using numpy.printoptions() methodwith np.printoptions(precision = 5):     print(np.array([[5, 10, 15], [20, 25, 30], [35, 40, 45]])/2.3865)
Output :
[[ 2.09512 4.19024 6.28536][ 8.38047 10.47559 12.57071][14.66583 16.76095 18.85607]]
Python-numpy
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to use the ErrorActionPreference variable in PowerShell?

ErrorActionPreference variable in PowerShell is to control the non-terminating errors by converting them to terminating errors. Error handling depends upon which value you assign to $ErrorActionPreference variable.
The values are as below.
Continue − This is the default value of the variable and when the error occurs, an error is displayed in the PowerShell console, and the script continues the execution.
Continue − This is the default value of the variable and when the error occurs, an error is displayed in the PowerShell console, and the script continues the execution.
Get-WmiObject -Class Win32_Logicaldisk -ComputerName Nonexist
Write-Host "Hello World"
Get-WmiObject -Class Win32_Logicaldisk -ComputerName Nonexist
Write-Host "Hello World"
Get-WmiObject : The RPC server is unavailable.
At line:2 char:1
+ Get-WmiObject -Class Win32_Logicaldisk -ComputerName Nonexist
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Get-WmiObject],
COMException
+ FullyQualifiedErrorId :
GetWMICOMException,Microsoft.PowerShell.Commands.GetWmiObj
ectCommand
Hello World
Stop − Error will not be displayed in the console and further pipeline execution is stopped. In the below example, there will be no output.
Stop − Error will not be displayed in the console and further pipeline execution is stopped. In the below example, there will be no output.
$ErrorActionPreference = "Stop"
Get-WmiObject -Class Win32_Logicaldisk -ComputerName Nonexist
Write-Host "Hello World"
SilentlyContinue − Error output will not be displayed and the script executes the next commands in the pipeline.
SilentlyContinue − Error output will not be displayed and the script executes the next commands in the pipeline.
$ErrorActionPreference = "SilentlyContinue"
Get-WmiObject -Class Win32_Logicaldisk -ComputerName Nonexist
Write-Host "`nHello World" -BackgroundColor DarkGreen
Output −
PS C:\WINDOWS\system32>> $ErrorActionPreference = "SilentlyContinue" Get-WmiObject -Class Win32_Logicaldisk -ComputerName Nonexist Write-Host "`nHello World" -BackgroundColor DarkGreen

Hello World
Inquire − It waits for user prompt if an error occurs and asks for continue. An error will be displayed.
Inquire − It waits for user prompt if an error occurs and asks for continue. An error will be displayed.
$ErrorActionPreference = "Inquire"
Get-WmiObject -Class Win32_Logicaldisk -ComputerName Nonexist
Write-Host "`nHello World" -BackgroundColor DarkGreen
If you press “Yes/Yes to All” then error output will be displayed and “Halt Command/Suspend” will not display an error.
Suspend − This value is used in the PowerShell workflow to suspend workflow for investigation purposes and then resume.
Suspend − This value is used in the PowerShell workflow to suspend workflow for investigation purposes and then resume.
When you close the PowerShell session, the value of the $ErrorActionPreference will be set to default i.e. Continue.
How to check if onClick exists on element in jQuery?

These codes might help you −
$('body').click(function(){ alert('test' )})

var foo = $.data( $('body').get(0), 'events' ).click
// you can query $.data( object, 'events' ) and get an object back, then see what events are attached to it.
 $.each( foo, function(i,o) {
    alert(i) // guid of the event
    alert(o) // the function definition of the event handler
});
Python – Test Boolean Value of Dictionary

10 May, 2020
Sometimes, while working with data, we have a problem in which we need to accept or reject a dictionary on the basis of its true value, i.e all the keys are Boolean true or not. This kind of problem has possible applications in data preprocessing domains. Let’s discuss certain ways in which this task can be performed.
Method #1 : Using loopThis is brute force method to solve this problem. In this, we iterate for each key and tag it as false if we find first occurrence of false value and break from loop.
# Python3 code to demonstrate working of # Test Boolean Value of Dictionary# Using loop  # initializing dictionarytest_dict = {'gfg' : True, 'is' : False, 'best' : True}  # printing original dictionaryprint("The original dictionary is : " + str(test_dict))  # Test Boolean Value of Dictionary# Using loopres = True for ele in test_dict:    if not test_dict[ele]:        res = False         break  # printing result print("Is Dictionary True ? : " + str(res)) 
The original dictionary is : {‘is’: False, ‘best’: True, ‘gfg’: True}Is Dictionary True ? : False
 
Method #2 : Using all() + values()This is a shorthand approach to solve this problem. In this, all() is used to check status of all values extracted using values().
# Python3 code to demonstrate working of # Test Boolean Value of Dictionary# Using all() + values()  # initializing dictionarytest_dict = {'gfg' : True, 'is' : False, 'best' : True}  # printing original dictionaryprint("The original dictionary is : " + str(test_dict))  # Test Boolean Value of Dictionary# Using all() + values()res = all(test_dict.values())  # printing result print("Is Dictionary True ? : " + str(res)) 
The original dictionary is : {‘is’: False, ‘best’: True, ‘gfg’: True}Is Dictionary True ? : False
Python dictionary-programs
Python
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Different ways to create Pandas Dataframe
Enumerate() in Python
Read a file line by line in Python
Python String | replace()
How to Install PIP on Windows ?
Python program to convert a list to string
Defaultdict in Python
Python | Get dictionary keys as a list
Python | Convert a list to dictionary
Python Program for Fibonacci numbers
Perl import Function

This function is an ordinary method (subroutine) defined (or inherited) by modules that wish to export names to another module. The use function calls the import method for the package used.
Following is the simple syntax for this function −
import LIST

This function does not return any value.
Following is the example code showing its basic usage −
#!/usr/bin/perl

package Util;
use base 'Exporter';

our @EXPORT_OK = ('foo', 'bar');

sub foo {
   print "foo!";
}
sub bar {
   print "bar!";
}

package Amy;
use Util 'foo';  # only import foo()
foo();           # works fine
bar();           # blows up
Python | Creating DataFrame from dict of narray/lists

22 Jun, 2021
As we know Pandas is all-time great tools for data analysis. One of the most important data type is dataframe. It is a 2-dimensional labeled data structure with columns of potentially different types. It is generally the most commonly used pandas object. Pandas DataFrame can be created in multiple ways. Let’s discuss how to create Pandas dataframe using dictionary of ndarray (or lists).Let’s try to understand it better with few examples.Code #1:  
Python3
# Python code demonstrate creating# DataFrame from dict narray / lists# By default addresses. import pandas as pd # initialise data of lists.data = {'Category':['Array', 'Stack', 'Queue'],        'Marks':[20, 21, 19]} # Create DataFramedf = pd.DataFrame(data) # Print the output.print(df )
Category  Marks
0    Array     20
1    Stack     21
2    Queue     19
 
Note: To create DataFrame from dict of narray/list, all the narray must be of same length. If index is passed then the length index should be equal to the length of arrays. If no index is passed, then by default, index will be range(n) where n is the array length.  Code #2: 
Python3
# Python code demonstrate creating# DataFrame from dict narray / lists# By default addresses. import pandas as pd # initialise data of lists.data = {'Category':['Array', 'Stack', 'Queue'],        'Student_1':[20, 21, 19], 'Student_2':[15, 20, 14]} # Create DataFramedf = pd.DataFrame(data) # Print the output.print(df.transpose())
              0      1      2
Category   Array  Stack  Queue
Student_1     20     21     19
Student_2     15     20     14
 
  Code #3: Providing index list to dataframe  
Python3
# Python code demonstrate creating# DataFrame from dict narray / lists# By default addresses. import pandas as pd # initialise data of lists.data = {'Area':['Array', 'Stack', 'Queue'],        'Student_1':[20, 21, 19], 'Student_2':[15, 20, 14]} # Create DataFramedf = pd.DataFrame(data, index =['Cat_1', 'Cat_2', 'Cat_3']) # Print the output.print(df)
        Area  Student_1  Student_2
Cat_1  Array         20         15
Cat_2  Stack         21         20
Cat_3  Queue         19         14
 
adnanirshad158
pandas-dataframe-program
Python pandas-dataFrame
Python-pandas
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Different ways to create Pandas Dataframe
Enumerate() in Python
Read a file line by line in Python
Python String | replace()
How to Install PIP on Windows ?
*args and **kwargs in Python
Python Classes and Objects
Iterate over a list in Python
Python OOPs Concepts
How to Rotate Container Background Image using CSS ?

13 May, 2020
The CSS background-image property is used to add an image to the background of an element. In this article, the task is to rotate the image which is used in the background.
Approach: The CSS transform property is used to apply two-dimensional or three-dimensional transformation to a element. This property can be used to rotate, scale, move or even skew an element.
Syntax:
.class_name { transform: value } 
Example: We can use the CSS transform property to fix this issue and make rotations as given below:
<!DOCTYPE html><html>  <head>    <!-- Bootstrap CDN -->    <link rel="stylesheet"          href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">      <!-- CSS -->    <style>        .background-image {            background-image: url('Geeksforgeeks_image.jpg');            background-repeat: no-repeat;            height: 300px;        }                  .rotated-background-image {            background-image: url('Geeksforgeeks_image.jpg');            background-repeat: no-repeat;            height: 100%;            margin-top: 250px;            transform: rotate(90deg);            /* All browsers support */            -moz-transform: rotate(90deg);            -webkit-transform: rotate(90deg);            -o-transform: rotate(90deg);            -ms-transform: rotate(90deg);        }                  .custom {            height: 100px;            padding-top: 10px;        }    </style></head>  <body>    <!-- Normal image which is not rotated -->    <div class="container custom">        <div class="background-image">        </div>    </div>    <!-- Rotated image -->    <div class="container">        <div class="rotated-background-image">        </div>    </div>  </body>  </html>
Output:
CSS-Misc
Picked
CSS
Web Technologies
Web technologies Questions
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Design a Tribute Page using HTML & CSS
Types of CSS (Cascading Style Sheet)
How to set space between the flexbox ?
How to position a div at the bottom of its container using CSS?
How to Upload Image into Database and Display it using PHP ?
Installation of Node.js on Linux
Difference between var, let and const keywords in JavaScript
How to fetch data from an API in ReactJS ?
Differences between Functional Components and Class Components in React
Remove elements from a JavaScript Array
How to Compress and Extract Files Using the tar Command on Linux

29 Jun, 2021
An archive is a special file that contains any number of files inside. It can be restored via special programs, for example, tar.inside.
.tar – archive files are usually not compressed.
.tar.gz – archive file compressed with gzip tool
.tar.bz2 – archive file compressed with bzip2 tool
Syntax: 
tar options [archive_name.tar] files_to_archive
The tar command does not create a compressed archive, instead, it uses external utilities like gzip and bzip2.
Command functionality:
–diff
Chapters
descriptions off, selected
captions settings, opens captions settings dialog
captions off, selected
English
This is a modal window.
Beginning of dialog window. Escape will cancel and close the window.
End of dialog window.
–delete
Showing the difference between archives
Delete file from the archive
Command parameters:
–verbose
–total
Show process information
Show final result 
1) Compress one file using the tar command:
tar -czvf one-file-compressed.tar.gz hello_world
2) Compress directory using the tar command:
tar -czvf dir-compressed.tar.gz test_directory/
3) Show the archive content:
tar -tf archive.tar.gz
4) Add content to the existing archive:
tar -rvf existing-archive-name.tar file-directory-to-compress/
5) Update content in an archive: 
6) Compress with bzip2:
tar -cjvf one-file-compressed.tar.bz2 hello_world
7) Extract files from a .tar archive:
tar -xf archive.tar.gz
The same with .tar.gz and .tar.bz2
Linux-file-commands
Picked
Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Docker - COPY Instruction
scp command in Linux with Examples
chown command in Linux with Examples
SED command in Linux | Set 2
mv command in Linux with examples
nohup Command in Linux with Examples
chmod command in Linux with examples
Introduction to Linux Operating System
Array Basics in Shell Scripting | Set 1
Basic Operators in Shell Scripting
How to Install Apache Tomcat 8 on Linux?

06 Oct, 2021
Apache Tomcat (short for “Tomcat”) is a free and open-source Java Servlet, JavaServer Pages, Java Expression Language, and WebSocket implementation. [two] Tomcat is an HTTP web server that runs Java code in a “pure Java” environment.
Tomcat is developed and maintained by a free group of developers under the Apache Software Foundation’s auspices and is licensed under the Apache License 2.0. In this article, we are going to see how to install Apache Tomcat 8 on Linux systems.
Create a directory named tomcat in the /opt folder:
$ mkdir /opt/tomcat
Create a directory
Change directory to tomcat:
$ cd /opt/tomcat
Change directory to tomcat
Go to the Apache Tomcat 8 Download page by clicking this link. Place your cursor under 8.5.65 Binary Distributions, right-click on the tar file and select the copy link address from the menu that appears (as shown in the picture below). At the time of writing, Tomcat 8 is the most recent edition, but you are free to use whatever version is most current.
Next, use the wget command to download the tar from the URL you copied in the previous stage to the tomcat folder on your server:
$ sudo wget https://apachemirror.wuchna.com/tomcat/tomcat-8/v8.5.65/bin/apache-tomcat-8.5.65.tar.gz
Decompress the file in your tomcat folder after it has finished downloading:
$ tar xvzf apache-tomcat-8.5.65.tar.gz
Decompress the file
You must first install the Java Development Kit before you can use Tomcat (JDK). Check to see if Java is installed first:
$ apt-get install default-jdk
Installing the Java Development Kit
Now verify java installed properly:
$ java -version
Verify java installed properly
Use the following command to set the environment variables in .bashrc: 
$ nano ~/.bashrc
Add the following lines to the file’s end:
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64
export CATALINA_HOME=/opt/tomcat/apache-tomcat-8.5.65
After you’ve saved your changes and exited the .bashrc file, run the following command to make the changes take effect:
$ . ~/.bashrc
Your server should now have Tomcat and Java enabled and configured. Run the following script to start Tomcat:
$ $CATALINA_HOME/bin/startup.sh
In a web browser, go to YourIPAddress:8080 to see if Tomcat is up and running. http://127.0.0.1:8080, for example.
how-to-install
Picked
How To
Installation Guide
Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Set Git Username and Password in GitBash?
How to Install Jupyter Notebook on MacOS?
How to Install and Use NVM on Windows?
How to Install Python Packages for AWS Lambda Layers?
How to Install Git in VS Code?
Installation of Node.js on Linux
Installation of Node.js on Windows
How to Install Jupyter Notebook on MacOS?
How to Install and Use NVM on Windows?
How to Install Python Packages for AWS Lambda Layers?
Lodash _.min() Method

02 Sep, 2020
Lodash is a JavaScript library that works on the top of underscore.js. Lodash helps in working with arrays, strings, objects, numbers, etc. 
The _.min() method is used to find the minimum element from the array. If the array is empty then undefined is returned.
Syntax:
_.min( array )

Parameters: This method accepts a single parameter as mentioned above and described below:
array: It is the array that the method iterates over to get the minimum element.
Return Value: This method returns the minimum element from the array.
Example 1:
Javascript
// Requiring the lodash library  const _ = require("lodash");      // Use of _.min() method let min_val = _.min([]);         // Printing the output  console.log(min_val);
Output:
undefined

Example 2:
Javascript
// Requiring the lodash library  const _ = require("lodash");      // Use of _.min() method let min_val = _.min([15, 7, 38, 46, 82]);         // Printing the output  console.log(min_val);
Output:
7

Example 3:  
Javascript
// Requiring the lodash library  const _ = require("lodash");      // Use of _.min() method let min_val = _.min([-15, 7, 38, -46, -82]);         // Printing the output  console.log(min_val);
Output:
-82

JavaScript-Lodash
JavaScript
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Difference between var, let and const keywords in JavaScript
Differences between Functional Components and Class Components in React
Remove elements from a JavaScript Array
Hide or show elements in HTML using display property
Difference Between PUT and PATCH Request
Installation of Node.js on Linux
Top 10 Projects For Beginners To Practice HTML and CSS Skills
Difference between var, let and const keywords in JavaScript
How to insert spaces/tabs in text using HTML/CSS?
How to fetch data from an API in ReactJS ?
HTML | controls Attribute

08 Jul, 2019
The HTML controls Attribute is used to specify that the audio and video controls must be displayed. It is a Boolean attribute and also new in HTML5. We can use this attribute in two tags <audio> and <video>
The controls attribute includes the following properties on <audio> tag:
Play
Pause
Seeking
Volume
The controls attribute includes the following properties on <video> tag:
Play
Pause
Seeking
Volume
Fullscreen toggle (for video only)
Captions/Subtitles (for video only, when available)
Track (for video only, when available)
Syntax:
<element controls> 
Below example illustrates the use of controls attribute in <audio> element.
Example:
<!DOCTYPE html><html>  <head>    <title>        HTML Audio controls Attribute    </title></head>  <body style="text-align: center">      <h1 style="color: green">         GeeksforGeeks     </h1>    <h2 style="font-family: Impact">         HTML Audio controls Attribute     </h2>    <br>      <audio id="Test_Audio" controls autoplay>          <source src="https://media.geeksforgeeks.org/wp-content/uploads/20190531165842/Recording1514.ogg"                            type="audio/ogg">          <source src="https://media.geeksforgeeks.org/wp-content/uploads/20190531165842/Recording1514.mp3"                            type="audio/mpeg">    </audio>  </body>  </html>
Output:
Below example illustrates the use of controls attribute in <video> element.
Example:
<!DOCTYPE html> <html>   <head>     <title>HTML video controls Attribute</title> </head>   <body>     <center>         <h1 style="color:green;">GeeksforGeeks</h1>           <h3>HTML video controls Attribute</h3>           <video width="400" height="200" controls >             <source src= "https://media.geeksforgeeks.org/wp-content/uploads/20190616234019/Canvas.move_.mp4"                    type="video/mp4">             <source src= "https://media.geeksforgeeks.org/wp-content/uploads/20190616234019/Canvas.move_.ogg"                    type="video/ogg">         </video>     </center> </body>   </html> 
Output:
Supported Browsers: The browser supported by HTML controls Attribute are listed below:
Google Chrome 4.0
Internet Explorer 9.0
Firefox 3.5
Safari 4.0
Opera 10.5
HTML-Attributes
HTML
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to update Node.js and NPM to next version ?
REST API (Introduction)
CSS to put icon inside an input element in a form
Design a Tribute Page using HTML & CSS
Types of CSS (Cascading Style Sheet)
Installation of Node.js on Linux
Difference between var, let and const keywords in JavaScript
How to fetch data from an API in ReactJS ?
Differences between Functional Components and Class Components in React
Remove elements from a JavaScript Array
Compute the covariance matrix of two given NumPy arrays

29 Aug, 2020
In NumPy for computing the covariance matrix of two given arrays with help of numpy.cov(). In this, we will pass the two arrays and it will return the covariance matrix of two given arrays.
Syntax: numpy.cov(m, y=None, rowvar=True, bias=False, ddof=None, fweights=None, aweights=None)
Example 1:
Python
import numpy as np    array1 = np.array([0, 1, 1])array2 = np.array([2, 2, 1])  # Original array1print(array1)  # Original array2print(array2)  # Covariance matrixprint("\nCovariance matrix of the said arrays:\n",      np.cov(array1, array2))
Output:
[0 1 1]
[2 2 1]

Covariance matrix of the said arrays:
 [[ 0.33333333 -0.16666667]
 [-0.16666667  0.33333333]]

Example 2:
Python
import numpy as np    array1 = np.array([2, 1, 1, 4])array2 = np.array([2, 2, 1, 1])  # Original array1print(array1)  # Original array2print(array2)  # Covariance matrixprint("\nCovariance matrix of the said arrays:\n",       np.cov(array1, array2))
Output:
[2 1 1 4]
[2 2 1 1]

Covariance matrix of the said arrays:
 [[ 2.         -0.33333333]
 [-0.33333333  0.33333333]]

Example 3:
Python
import numpy as np    array1 = np.array([1, 2])array2 = np.array([1, 2])  # Original array1print(array1)  # Original array2print(array2)  # Covariance matrixprint("\nCovariance matrix of the said arrays:\n",       np.cov(array1, array2))
Output
[1 2]
[1 2]

Covariance matrix of the said arrays:
 [[0.5 0.5]
 [0.5 0.5]]

Example 4:
Python
import numpy as np     x = [1.23, 2.12, 3.34, 4.5] y = [2.56, 2.89, 3.76, 3.95]     # find out covariance with respect # rows cov_mat = np.stack((x, y), axis = 1)      print("shape of matrix x and y:",       np.shape(cov_mat))   print("shape of covariance matrix:",      np.shape(np.cov(cov_mat)))   print(np.cov(cov_mat))
Output
shape of matrix x and y: (4, 2)
shape of covariance matrix: (4, 4)
[[ 0.88445  0.51205  0.2793  -0.36575]
 [ 0.51205  0.29645  0.1617  -0.21175]
 [ 0.2793   0.1617   0.0882  -0.1155 ]
 [-0.36575 -0.21175 -0.1155   0.15125]]

Python numpy-Statistics Functions
Python-numpy
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Python Classes and Objects
Python OOPs Concepts
Introduction To PYTHON
How to drop one or multiple columns in Pandas Dataframe
Python | os.path.join() method
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
Python | Get unique values from a list
Python | datetime.timedelta() function
Search A pandas Column For A Value

17 Dec, 2020
Prerequisites: pandas
In this article let’s discuss how to search data frame for a given specific value using pandas.
where() -is used to check a data frame for one or more condition and return the result accordingly. By default, The rows not satisfying the condition are filled with NaN value.
dropna() -This method allows the user to analyze and drop Rows/Columns with Null values. In this article it is used to deal with the cases where the rows that will have value as NaN because they will not satisfy a certain condition. 
Import modules
Create data
Traverse through the column looking for a specific value
If matched, select
There is a basic difference between selecting a specific values and selecting rows that have a specific value. For the later case the indices to be retrieved has to be stored in a list. Implementation of both cases is included in this article:
Data frame in use:
Example 1: Select tuple containing salary as 200
Python3
import pandas as pdx = pd.DataFrame([["A", 100, "D"], ["B", 200, "E"], ["C", 100, "F"]],                 columns=["Name", "Salary", "Department"])  # Searching in whole columnfor i in range(len(x.Name)):    if 200 == x.Salary[i]:                  # indx will store the tuple having that         # particular value in column.        indx = i  # below line will print that tuplex.iloc[indx]
Output:
Example 2: Search for people having salary of 100 and store the output in a dataframe again. 
Python3
import pandas as pdx = pd.DataFrame([["A", 100, "D"], ["B", 200, "E"], ["C", 100, "F"]],                  columns=[ "Name", "Salary", "Department"])  # initialize the indx as a listindx = []  # Searching in whole columnfor i in range(len(x.Name)):    if 100 == x.Salary[i]:                # indx will store all the tuples having         # that particular value in column.        indx.append(i)  # Final Dataframe having tuplesdf = pd.DataFrame()  # this will append all tuples to the final# dataframe.for indexes in indx:    df = df.append(x.iloc[indexes])  df = x.where(x.Salary == 100)  # It will remove NaN rows.df.dropna()
Output:
Picked
Python pandas-dataFrame
Python Pandas-exercise
Python-pandas
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Python Classes and Objects
Python OOPs Concepts
Introduction To PYTHON
How to drop one or multiple columns in Pandas Dataframe
Python | os.path.join() method
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
Python | Get unique values from a list
Python | datetime.timedelta() function
Python – Star or Asterisk operator ( * )

26 Nov, 2020
There are a many places you’ll see * and ** used in Python. Many Python Programmer even at the intermediate level is often puzzled when it comes to the asterisk ( * ) character in Python. 
After studying this article, you will have a solid understanding of the asterisk ( * ) operator in Python and become a better coder in the process!
Multiplication :In Multiplication, we multiply two numbers using Asterisk /  Star Operator as infix an Operator.
Python3
# using asteriskmul = 5 * 7print (mul)
Output:
35
Exponentiation :Using two(**) Start Operator we can get the exponential value of any integer value.
Python3
a = 5b = 3  # using asteriskresult = a ** bprint(result)
Output:
125
Multiplication of a list :With the help of  ‘ * ‘ we can multiply elements of a list, it transforms the code into single line.
Python3
# using asterisklist = ['geeks '] * 3  print(list)
Output:
['geeks ', 'geeks ', 'geeks ']
Unpacking a function using positional argument.This method is very useful while printing your data in a raw format (without any comma and brackets ). Many of the programmer try to remove comma and bracket by using a convolution of functions, Hence this simple prefix asterisk can solve your problem in unpacking them.  
Python3
arr = ['sunday', 'monday', 'tuesday', 'wednesday']  # without using asteriskprint(' '.join(map(str,arr)))   # using asteriskprint (*arr)
Output:
sunday monday tuesday wednesday
sunday monday tuesday wednesday
Passing a Function Using with an arbitrary number of positional argumentHere single asterisk( * ) is also used in *args. It  is used to pass a variable number of arguments to a function, it is mostly used to pass a non-key argument and variable-length argument list.It has many uses, one such example is illustrated below, we make an addition function that takes any number of arguments and able to add them all together using *args.
Python3
# using asteriskdef addition(*args):  return sum(args)  print(addition(5, 10, 20, 6))
Output:
41
Passing a  Function Using with an arbitrary number of positional argumentHere double asterisk( ** ) is also used as **kwargs, the double asterisks allow passing keyword argument. This special symbol is used to pass a keyword arguments and variable-length argument list. It has many uses, one such example is illustrated below 
Python3
# using asteriskdef food(**kwargs):  for items in kwargs:    print(f"{kwargs[items]} is a {items}")            food(fruit = 'cherry', vegetable = 'potato', boy = 'srikrishna')
Output:
cherry is a fruit
potato is a vegetable
srikrishna is a boy
Just another example of using **kwargs, for much better understanding.
Python3
# using asteriskdef food(**kwargs):  for items in kwargs:    print(f"{kwargs[items]} is a {items}")            dict = {'fruit' : 'cherry', 'vegetable' : 'potato', 'boy' : 'srikrishna'}# using asteriskfood(**dict)
Output:
cherry is a fruit
potato is a vegetable
srikrishna is a boy
Python-Operators
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.