Smita Kapse has Published 558 Articles

How to turn a String into a JavaScript function call?

Smita Kapse

Smita Kapse

Updated on 03-Oct-2019 07:00:23

370 Views

To turn a string into a JavaScript function call, try to run the following codeExampleLive Demo                    function myFunction(argument) {             alert('My function ' + argument);          }          functionName = 'myFunction';          window[functionName]('is working.');          

Which one is better to use for a JavaScript link, “#” or “javascript:void(0)”?

Smita Kapse

Smita Kapse

Updated on 13-Sep-2019 13:14:45

134 Views

Using “javascript:void(0)” is definitely better, since its faster. Try to run both the examples in Google Chrome with the developer tools. The “javascript:void(0)” method takes less time than the only #.Here’s the usage of “javascript: void(0)”:If inserting an expression into a web page results in an unwanted effect, then use ... Read More

How to create vertical button column with GridLayout in Java?

Smita Kapse

Smita Kapse

Updated on 30-Jul-2019 22:30:26

1K+ Views

To create a vertical button column, let us first create some buttons and set the layout as well −JPanel btnPanel = new JPanel(new GridLayout(10, 1, 10, 5)); btnPanel.add(new JButton("First Button")); btnPanel.add(new JButton("Second Button")); btnPanel.add(new JButton("Third Button")); btnPanel.add(new JButton("Fourth Button")); btnPanel.add(new JButton("Fifth Button")); btnPanel.add(new JButton("Sixth Button")); btnPanel.add(new JButton("Seventh Button")); btnPanel.add(new JButton("Eighth ... Read More

How to prevent a user from accessing a specific schema in MySQL?

Smita Kapse

Smita Kapse

Updated on 30-Jul-2019 22:30:26

375 Views

To prevent a user from accessing a specific schema, you need to use delete command. Following is the syntax −DELETE FROM mysql.db WHERE Db IN("yourSpecificSchema", "yourSpecificSchema\_%")    AND User = "yourUserName" AND Host = "yourHostName";Let us implement the above syntax to prevent a user from accessing a specific schema. First ... Read More

How to display JTextArea in the form of a table with GridLayout in Java?

Smita Kapse

Smita Kapse

Updated on 30-Jul-2019 22:30:26

606 Views

Display a component in the form of rows and columns using the GridLayout. Here, we have set a panel, within which we will create a layout with 3 rows and 5 columns −JPanel panel = new JPanel(new GridLayout(3, 5, 5, 5));Now, loop through and display JTextArea from 1 to 15 ... Read More

How can fetch records from specific month and year in a MySQL table?

Smita Kapse

Smita Kapse

Updated on 30-Jul-2019 22:30:26

557 Views

Use YEAR() and MONTH() to display records from specific month and year respectively. Let us first create a table −mysql> create table DemoTable    (    CustomerId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    CustomerName varchar(20),    CustomerTotalBill int,    PurchasingDate date    ); Query OK, 0 rows affected (0.83 ... Read More

C++ Program to Create a Random Linear Extension for a DAG

Smita Kapse

Smita Kapse

Updated on 30-Jul-2019 22:30:26

72 Views

Here we will see how to create Random Linear Extension of a Directed Acyclic Graph (DAG). The Linear extension is basically the topological sorting of DAG. Let us consider the graph is like below −The topological sorting for a directed acyclic graph is the linear ordering of vertices. For every ... Read More

How to combine FlowLayout and BoxLayout in Java?

Smita Kapse

Smita Kapse

Updated on 30-Jul-2019 22:30:26

473 Views

To combine both the layouts, here we have created two panels −Frame f = new JFrame("Combining Layouts"); JPanel panel1 = new JPanel(); JPanel panel2 = new JPanel();Now, set the layouts accordingly −panel1.setLayout(new BoxLayout(panel1, BoxLayout.Y_AXIS)); panel2.setLayout(new FlowLayout());Then after adding components to both the panels, add them to the frame −f.add(panel1, BorderLayout.WEST); ... Read More

Use result from MongoDB in shell script?

Smita Kapse

Smita Kapse

Updated on 30-Jul-2019 22:30:26

465 Views

Let us first create a collection with a document −>db.useResultDemo.insertOne({"StudentFirstName":"Robert"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cda70f5b50a6c6dd317adcd") }Display all documents from a collection with the help of find() method −> db.useResultDemo.find();Following is the output −{ "_id" : ObjectId("5cda70f5b50a6c6dd317adcd"), "StudentFirstName" : "Robert" }Here is the query to use result ... Read More

C++ program to Solve Tower of Hanoi Problem using Binary Value

Smita Kapse

Smita Kapse

Updated on 30-Jul-2019 22:30:26

241 Views

This C++ program displays the solution to the Tower of Hanoi problem using binary value.There is one binary digit for each disk.The most significant bit represents the largest disk. A value of 0 indicates that the largest disk is on the initial peg, while a 1 indicates that it’s on ... Read More

Advertisements