- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Javascript has provided a navigator object with which we can find any information regarding the browser. To get the application name and version information, navigator object has provided navigator.appName() and navigator.appVersion() respectively. Let's discuss each of them individually.Application Name of the browserTo get the application name, the navigator object has provided navigator.appName(). It may sound weird that "Netscape" is the application name for IE11, Chrome, Firefox, and Safari. So the output we get when we use navigator.appName() is Netscape.ExampleLive Demo document.write(navigator.appName); OutputNetscapeBrowser version informationTo get the browser version information, the navigator object has provided ... Read More
Here we will see how we can write a program that can add n binary numbers given as strings. The easier method is by converting binary string to its decimal equivalent, then add them and convert into binary again. Here we will do the addition manually.We will use one helper function to add two binary strings. That function will be used for n-1 times for n different binary strings. The function will work like below.AlgorithmaddTwoBinary(bin1, bin2)begin s := 0 result is an empty string now i := length of bin1, and j := length of bin2 ... Read More
The HTML DOM lastChild property returns the last element node as node object of the specified node.NOTE − This property does not ignore text and comment nodesSyntaxFollowing is the syntax −Returning lastChild nodenodeList.lastChildExampleLet us see an example for HTML DOM lastChild property − Live Demo HTML DOM lastChild form { width:70%; margin: 0 auto; text-align: center; } * { padding: 2px; margin:5px; } input[type="button"] { border-radius: 10px; } ul{ width: ... Read More
To toggle visibility with JCheckBox, use isVisible() method:JCheckBox toggleVisibility = new JCheckBox("Hide/Show"); toggleVisibility.setSelected(comboBox.isVisible()); toggleVisibility.addItemListener(e -> { comboBox.setVisible(e.getStateChange() == ItemEvent.SELECTED); });The following is an example to hide and display JCombobox with a JCheckBox in Java:Exampleimport java.awt.BorderLayout; import java.awt.event.ItemEvent; import javax.swing.*; public class SwingDemo { JFrame frame; SwingDemo(){ frame = new JFrame("ComboBox"); String Sports[]={"Select", "Tennis", "Cricket", "Football"}; JComboBox comboBox = new JComboBox(Sports); comboBox.setBounds(50, 50, 90, 20); frame.add(comboBox, BorderLayout.CENTER); JCheckBox toggleVisibility = new JCheckBox("Hide/Show"); toggleVisibility.setSelected(comboBox.isVisible()); toggleVisibility.addItemListener(e ... Read More
The SQL GROUP BY clause is used in collaboration with the SELECT statement to arrange identical data into groups. This GROUP BY clause follows the WHERE clause in a SELECT statement and precedes the ORDER BY clause.SyntaxThe basic syntax of a GROUP BY clause is shown in the following code block. The GROUP BY clause must follow the conditions in the WHERE clause and must precede the ORDER BY clause if one is used.SELECT column1, column2 FROM table_name WHERE [ conditions ] GROUP BY column1, column2 ORDER BY column1, column2The supportsGroupBy() method of the DatabaseMetaData interface is used to determine whether ... Read More
add and assignment(+=) operatorThe add and assignment(+=) operator reduces the code little bit.It may not much influential in small codes whereas coming to long codes it's use can't be ignored. Live DemoExample var tot = 0; var a = [1,45,78,9,78,40]; for(var i = 0; i
Shared memory is a memory shared between two or more processes. However, why do we need to share memory or some other means of communication?To reiterate, each process has its own address space, if any process wants to communicate with some information from its own address space to other processes, then it is only possible with IPC (inter process communication) techniques. As we are already aware, communication can be between related or unrelated processes.Usually, inter-related process communication is performed using Pipes or Named Pipes. Unrelated processes (say one process running in one terminal and another process in another terminal) communication ... Read More
Let’s say we added a menu to the MenuBar −JMenuBar menuBar = new JMenuBar(); JMenu fileMenu = new JMenu("File"); fileMenu.setMnemonic(KeyEvent.VK_F); menuBar.add(fileMenu);Add the glue component in between the menus to align some of them on the right, for example −menuBar.add(Box.createHorizontalGlue());The menu added after the usage of above method, would get right-aligned −JMenu sourceMenu = new JMenu("Source"); sourceMenu.setMnemonic(KeyEvent.VK_S); menuBar.add(sourceMenu);The following is an example to right-align a menu in the menu bar with Java −Examplepackage my; import java.awt.event.KeyEvent; import javax.swing.Box; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; public class SwingDemo { public static void main(final String args[]) { ... Read More
For this, use STR_TO_DATE(). Following is the syntax −insert into yourTableName values(STR_TO_DATE(yourDateValue, yourFormatSpecifier));Let us first create a table −mysql> create table DemoTable ( ShippingDate date ); Query OK, 0 rows affected (0.81 sec)Insert some records in the table using insert command : Here, we are inserting formatted dates using date formats like m, d, y, etc −mysql> insert into DemoTable values(STR_TO_DATE('06-01-2019', '%m-%d-%Y')); Query OK, 1 row affected (0.22 sec) mysql> insert into DemoTable values(STR_TO_DATE('01-31-2019', '%m-%d-%Y')); Query OK, 1 row affected (0.22 sec) mysql> insert into DemoTable values(STR_TO_DATE('02-01-2018', '%m-%d-%Y')); Query OK, 1 row affected (0.27 sec)Display all records ... Read More
Remove an element from C++ std::vector by index can be done by following way −Example Live Demo#include #include using namespace std; int main() { vector v; //declare vector //insert elements into vector v.push_back(-10); v.push_back(7); v.push_back(6); // Deletes the first element (v[0]) v.erase(v.begin() ); for (int i = 0; i < v.size(); i++) cout
To Continue Learning Please Login
Login with Google