The HTML DOM Input Date min property returns/sets min attribute of Input date type.SyntaxFollowing is the syntax −Returning string valueinputDateObject.minSetting min to string valueinputDateObject.min = YYYY-MM-DDString ValuesHere, “YYYY-MM-DD” can be the following −stringValueDetailsYYYYIt defines year (eg:1998)MMIt defines month (eg: 05 for May)DDIt defines Day (eg: 24)ExampleLet us see an example of Input Date min property − Live Demo Input Date Min Date Select: Change Min Date var inputDate = document.getElementById("date"); var divDisplay = document.getElementById("divDisplay"); divDisplay.textContent = 'Min of date input: '+inputDate.min; function getMinDate() { var oldInputDate = inputDate.max; inputDate.min = '1998-07-01'; divDisplay.textContent = 'Min of date input: ... Read More
The wcstoll() function is used to convert the wide character string to long long integers. It sets the pointer to point to the first character after the last one. The syntax is like below.long long wcstoll(const wchar_t* str, wchar_t** str_end, int base)This function takes three arguments. These arguments are like below −str: This is the starting of a wide string.str_end: The str_end is set by the function to the next character, after the last valid character, if there is any character, otherwise null.base: This specifies the base. The base values can be of (0, 2, 3, …, 35, 36)This function ... Read More
Here we will see, why we should use the strict aliasing in C. Before discussing that part, let us see one code, and try to analyze the output.Example#include int temp = 5; int* var = &temp; int my_function(double* var) { temp = 1; *var = 5.10; //this will change the value of temp return (temp); } main() { printf("%d", my_function((double*)&temp)); }Output1717986918If we call the function my_function, then it will return 1. We can also call this using my_function((double*)&temp). This is supposed to return 1, but here we can see that this is returning something else. This code was made to return constant 1 only. To fix this problem, we can use Strict ... Read More
Let us first create a collection with a document −>db.replacingEntireDocumentDemo.insertOne({"StudentFirstName":"John", "StudentLastName":"Smith", "StudentCountryName":"US"}); { "acknowledged" : true, "insertedId" : ObjectId("5cd3119bb64f4b851c3a13e8") }Following is the query to display document from a collection with the help of find() method −> db.replacingEntireDocumentDemo.find().pretty();This will produce the following output −{ "_id" : ObjectId("5cd3119bb64f4b851c3a13e8"), "StudentFirstName" : "John", "StudentLastName" : "Smith", "StudentCountryName" : "US" }Following is the query to update a MongoDB document while replacing the entire document −>db.replacingEntireDocumentDemo.update({"StudentFirstName":"John", "StudentLastName":"Smith", "StudentCountryName":"US"}, {"StudentFirstName":"David", "StudentLastName":"Miller", "StudentCountryName":"AUS"}); WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })Let us display all the records from the collection ... Read More
Yes, we can hide the header from a table. Use the setTableHeader() method and set it to null -table.setTableHeader(null);Above, the table is our JTable -JTable table = new JTable(marks, col)The following is an example to hide the table header -Examplepackage my; import java.awt.Color; import java.awt.Font; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.table.JTableHeader; public class SwingDemo { public static void main(String[] argv) throws Exception { Integer[][] marks = { { 70, 66, 76, 89, 67, 98 }, { 67, 89, 64, 78, 59, 78 }, ... Read More
ClosureOne of the strengths of javascript is closures. Javascript allows nested functions, a function inside a function, to access the variables of parent functions. This process of accessing outer function's variable by an inner function is called a closure. A memory leak occurs when a declared variable is automatically available to the inner nested function and resides in a memory despite it is not referenced in the inner nested function.In the following example 'childFunction' is the inner function defined within the 'parentFunction' the outer function. When a call is made to 'parentFunction' with a parameter "outer val", the outer variable ... Read More
You can use $pull operator to remove a string from an array. Let us first create a collection with documents −> db.removeAStringDemo.insertOne({"Score":[45, 67, 89, "John", 98, 99, 67]}); { "acknowledged" : true, "insertedId" : ObjectId("5cda5224b50a6c6dd317adbd") }Following is the query to display all documents from a collection with the help of find() method −> db.removeAStringDemo.find().pretty();This will produce the following output −{ "_id" : ObjectId("5cda5224b50a6c6dd317adbd"), "Score" : [ 45, 67, 89, "John", 98, 99, 67 ] ... Read More
A circle inscribed in a square is a circle which touches the sides of the circle at its ends. I.e. the diameter of the inscribed circle is equal to the side of the square. The area can be calculated using the formula “((丌/4)*a*a)” where ‘a’ is the length of side of square.Logic of the Code - The area of circle inscribed inside the circle is calculated using the formula ((丌/4)*a*a) for this we need to define the value of pie (丌) that mathematically is 22/7 or 3.14. The expression that evaluates to the result is saved in a float variable.Example Live ... Read More
The HTML DOM Input Date Object represents an input HTML element with type date.SyntaxFollowing is the syntax −Creating an with type datevar dateObject = document.createElement(“input”); dateObject.type = “date”;AttributesHere, “dateObject” can have the following attributes −AttributesDescriptionautocompleteIt defines the value of autocomplete attribute of a date fieldautofocusIt defines if the date field should be focused on initial page load.defaultValueIt sets/returns the default value of date fielddisabledIt defines if date field is disabled/enabledformIt returns a reference of enclosing form that contains the date fieldmaxIt returns/sets the value of max attribute of date fieldminIt returns/sets the value of min attribute of date fieldnameIt ... Read More
BeautifulSoup is a class in the bs4 module of python. Basic purpose of building beautifulsoup is to parse HTML or XML documents.Installing bs4 (in-short beautifulsoup)It is easy to install beautifulsoup on using pip module. Just run the below command on your command shell.pip install bs4Running above command on your terminal, will see your screen something like -C:\Users\rajesh>pip install bs4 Collecting bs4 Downloading https://files.pythonhosted.org/packages/10/ed/7e8b97591f6f456174139ec089c769f89a94a1a4025fe967691de971f314/bs4-0.0.1.tar.gz Requirement already satisfied: beautifulsoup4 in c:\python\python361\lib\site-packages (from bs4) (4.6.0) Building wheels for collected packages: bs4 Building wheel for bs4 (setup.py) ... done Stored in directory: C:\Users\rajesh\AppData\Local\pip\Cache\wheels\a0\b0\b2\4f80b9456b87abedbc0bf2d52235414c3467d8889be38dd472 Successfully built bs4 Installing collected packages: bs4 Successfully installed bs4-0.0.1To verify, ... Read More