Articles on Trending Technologies

Technical articles with clear explanations and examples

How can I customize value, instead of NULL, of a row by using MySQL IF() function?

Arushi
Arushi
Updated on 11-Feb-2020 148 Views

Suppose in our ‘Employee’ table we are having NULL as the value of ‘salary’ column for two employees. The data, shown as follows, is itself not meaningful.mysql> Select * from employee; +----+--------+--------+ | ID | Name   | Salary | +----+--------+--------+ | 1 | Gaurav  | 50000  | | 2 | Rahul   | 20000  | | 3 | Advik   | 25000  | | 4 | Aarav   | 65000  | | 5 | Ram     | 20000  | | 6 | Mohan   | 30000  | | 7 | Aryan   | NULL   | | 8 ...

Read More

Write a C++ Program without Semicolons?

Anjana
Anjana
Updated on 11-Feb-2020 502 Views

There are multiple ways to write a C++ program without semicolons. Note that doing this is very bad practice and should never be used in real code. This is presented just as informational content. The easiest way to write a C++ Program without Semicolons is using if statements. Almost all statements in C++ can be treated as expressions. So, if we place the statement inside an if statement with a blank pair of parentheses, we don’t have to end it with a semicolon anymore. For example, Example#include int main() {    if (int N = 1) {       ...

Read More

C++ Program Structure

Ayyan
Ayyan
Updated on 11-Feb-2020 1K+ Views

The best way to learn a programming language is by writing programs. Typically, the first program beginners write is a program called "Hello World", which simply prints "Hello World" to your computer screen. Although it is very simple, it contains all the fundamental components C++ programs have. Let's look at the code for this program −#include int main() {    std::cout

Read More

Compound Assignment Operators in C++

Govinda Sai
Govinda Sai
Updated on 11-Feb-2020 4K+ Views

The compound assignment operators are specified in the form e1 op= e2, where e1 is a modifiable l-value not of const type and e2 is one of the following −An arithmetic typeA pointer, if op is + or –The e1 op= e2 form behaves as e1 = e1 op e2, but e1 is evaluated only once.The following are the compound assignment operators in C++ −OperatorsDescription*=Multiply the value of the first operand by the value of the second operand; store the result in the object specified by the first operand./=Divide the value of the first operand by the value of the ...

Read More

What is the ?-->? operator in C++?

Nitya Raut
Nitya Raut
Updated on 10-Feb-2020 405 Views

There is no such operator in C++. Sometimes, we need to create wrapper types. For example, types like unique_ptr, shared_ptr, optional and similar. Usually, these types have an accessor member function called .get but they also provide the operator→ to support direct access to the contained value similarly to what ordinary pointers do.The problem is that sometimes we have a few of these types nested into each other. This means that we need to call .get multiple times or to have a lot of dereference operators until we reach the value.Something like this −wrapper wp; wp.get().get().length(); wp.get()->length();This can be a ...

Read More

How can we implement a moving text using a JLabel in Java?

raja
raja
Updated on 10-Feb-2020 2K+ Views

A JLabel is a subclass of JComponent class and an object of JLabel provides text instructions or information on a GUI. A JLabel can display a single line of read-only text, an image or both text and an image. A JLabel can explicitly generate a PropertyChangeListener interface. We can also implement a moving text in a JLabel by using a Timer class, it can set a timer with speed(in milliseconds) and this as an argument.Exampleimport java.awt.*; import java.awt.event.*; import java.util.*; import javax.swing.*; import javax.swing.Timer; public class MovingTextLabel extends JFrame implements ActionListener {    private JLabel label;    public MovingTextLabel() {       setTitle("MovingTextLabel");       label= new JLabel(" ...

Read More

How to Edit, Compile, and Execute a C++ Program?

Paul Richard
Paul Richard
Updated on 10-Feb-2020 3K+ Views

Create a new cpp file using your text editor. Enter the following in it −#include int main() {     std::cout

Read More

How can we set the background/foreground color for individual column of a JTable in Java?

raja
raja
Updated on 10-Feb-2020 4K+ Views

A JTable is a subclass of JComponent class for displaying complex data structures. A JTable component can follow the Model View Controller (MVC) design pattern for displaying the data in rows and columns. A JTable can generate TableModelListener, TableColumnModelListener, ListSelectionListener, CellEditorListener, RowSorterListener interfaces. We can change the background and foreground color for each column of a JTable by customizing the DefaultTableCellRenderer class and it has only one method getTableCellRendererComponent() to implement it.Exampleimport java.awt.*; import javax.swing.*; import javax.swing.table.*; public class JTableColumnColorTest extends JFrame {    private JTable table;    private TableColumn tColumn;    public JTableColumnColorTest() {       setTitle("JTableColumnColor Test");       table = ...

Read More

What does the volatile keyword mean in C++?

Priya Pallavi
Priya Pallavi
Updated on 10-Feb-2020 2K+ Views

volatile means two things −- The value of the variable may change without any code of yours changing it. Therefore whenever the compiler reads the value of the variable, it may not assume that it is the same as the last time it was read, or that it is the same as the last value stored, but it must be read again.- The act of storing a value to a volatile variable is a "side effect" which can be observed from the outside, so the compiler is not allowed to remove the act of storing a value; for example, if ...

Read More

Why do we use const qualifier in C++?

Srinivas Gorla
Srinivas Gorla
Updated on 10-Feb-2020 2K+ Views

We use the const qualifier to declare a variable as constant. That means that we cannot change the value once the variable has been initialized. Using const has a very big benefit. For example, if you have a constant value of the value of PI, you wouldn't like any part of the program to modify that value. So you should declare that as a const.Objects declared with const-qualified types may be placed in read-only memory by the compiler, and if the address of a const object is never taken in a program, it may not be stored at all.  For ...

Read More
Showing 49861–49870 of 61,248 articles
Advertisements