Ankith Reddy has Published 1070 Articles

Iterator Invalidation in C++

Ankith Reddy

Ankith Reddy

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

1K+ Views

In C++, we have different containers like vector, list, set, map etc. To iterate through these containers, we can use the iterators. We should be careful when we are using iterators in C++. When we are using iterating over a container, then sometimes, it may be invalidated. If the shape, ... Read More

Composite Design Pattern in C++

Ankith Reddy

Ankith Reddy

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

1K+ Views

Composite pattern is used where we need to treat a group of objects in similar way as a single object. Composite pattern composes objects in term of a tree structure to represent part as well as whole hierarchy. This type of design pattern comes under structural pattern as this pattern ... Read More

How to apply NOW() to timestamps field in MySQL Workbench?

Ankith Reddy

Ankith Reddy

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

725 Views

Let us first create a table −create table DemoTable (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    ShippingDate timestamp );Insert some records in the table using insert command. Here, we have included the current date with NOW() −INSERT INTO DemoTable(ShippingDate) VALUES(now());Display all records from the table using select ... Read More

How to create an invisible fixed width component between two components in Java?

Ankith Reddy

Ankith Reddy

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

221 Views

Use the createHorizontalStrut() method to create an invisible width component between two components. Let’s say we have some button and we are creating a fixed width between them −box.add(button4); box.add(Box.createHorizontalStrut(50)); box.add(button5); box.add(Box.createHorizontalStrut(30)); box.add(button6);The following is an example to create an invisible fixed width component between two components −Examplepackage my; import ... Read More

Bidirectional Iterators in C++

Ankith Reddy

Ankith Reddy

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

336 Views

Here we will see the concept of Bidirectional iterators in C++.The bidirectional iterators support all of the features of forward iterators, and also prefix and postfix decrement operators.This type of iterator can access elements in both directions, like towards the end and towards the beginning.The random access iterator is also ... Read More

Concatenate two tables in MySQL with a condition?

Ankith Reddy

Ankith Reddy

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

497 Views

To concatenate two tables, UNION ALL in MySQL. Let us create a table −mysql> create table DemoTable1    (    Id int,    FirstName varchar(20)    ); Query OK, 0 rows affected (1.52 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1 values(10, 'John'); Query OK, ... Read More

How to set the maximized bounds for a Frame in Java?

Ankith Reddy

Ankith Reddy

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

315 Views

To set maximized bounds, use the setMaximizedBounds() method. Here, we will create a frame, which when maximized will form a shape −JFrame frame = new JFrame("Login!");Above, we have created a frame and now we will use the Rectangle class to specify an area of coordinates −Rectangle bounds = new Rectangle(50, ... Read More

HTML size Attribute

Ankith Reddy

Ankith Reddy

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

281 Views

The size attribute of the element is used to set the width of the input. The more the width would lead to a textbox with more width. You can set the size attribute for the following input types − text, search, email, password, tel and url.Following is the syntax ... Read More

How to create a Box Layout in Java?

Ankith Reddy

Ankith Reddy

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

2K+ Views

To create a Box Layout in Java Swing, use the BoxLayout class. Here, we have also set that the components should be laid our left to right or top to bottom −Box box = new Box(BoxLayout.X_AXIS); box.add(button1); box.add(button2); box.add(button3); box.add(button4); box.add(Box.createGlue()); box.add(button5); box.add(button6); box.add(button7); box.add(button8);Above, we have 8 buttons in ... Read More

MySQL query to decrease value by 10 for a specific value?

Ankith Reddy

Ankith Reddy

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

492 Views

Let us first create a table −mysql> create table DemoTable    (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    Score int    ); Query OK, 0 rows affected (0.89 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(Score) values(67); Query OK, 1 row affected ... Read More

Advertisements