Comma Operator in C/C++

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

340 Views

Comma Operator in C/C++ programming language has two contexts −As a Separator −As an operator − The comma operator { , } is a binary operator that discards the first expression (after evaluation) and then use the value of the second expression. This operator has the least precedence.Consider the following codes and guess the output −Example Live Demo#include int main(void) {    char ch = 'a', 'b', 'c';    printf("%c", ch);    return 0; }OutputIt gives an error because the works as a separator.prog.c: In function ‘main’: prog.c:5:20: error: expected identifier or ‘(’ before 'b' char ch = 'a', 'b', ... Read More

Get Max Columns in Table Using DatabaseMetadata in Java

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

108 Views

The getMaxColumnsInTable() method of the DatabaseMetaData interface is used to find out the maximum number of columns that the underlying database allows in a table.This method returns an integer value, representing the maximum number of columns allowed in a table. If this value is 0 it indicates that there is no limit or, limit is unknown.To get the DatabaseMetaData object −Make sure your database is up and running.Register the driver using the registerDriver() method of the DriverManager class. Pass an object of the driver class corresponding to the underlying database.Get the connection object using the getConnection() method of the DriverManager ... Read More

Use CHAR_LENGTH in MySQL CREATE TABLE Query

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

133 Views

Use CHAR_LENGTH(yourColumnName) at the time of table creation. Let us first see an example and create a table −mysql> create table DemoTable    (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    Title varchar(200),    `Number_of_characters` int as (char_length(Title))    ); Query OK, 0 rows affected (0.18 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(Title) values('Introduction To MySQL'); Query OK, 1 row affected (0.06 sec) mysql> insert into DemoTable(Title) values('Introduction To Java'); Query OK, 1 row affected (0.06 sec) mysql> insert into DemoTable(Title) values('Introduction To MongoDB'); Query OK, 1 row affected (0.04 ... Read More

Select All Cells in a Table Using Java

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

477 Views

To select all cells in a table in Java Swing, you need to use the selectAll() method. Let’s say the following are our table rows and columns −String[][] rec = {    { "001", "Shirts", "40" },    { "002", "Trousers", "250" },    { "003", "Jeans", "25" },    { "004", "Applicances", "90" },    { "005", "Mobile Phones", "200" },    { "006", "Hard Disk", "150" }, }; String[] header = { "ID", "Product", "Quantity" };Set it for a table −JTable table = new JTable(rec, header);Now select all the rows and columns −table.selectAll();The following is an example to ... Read More

Determine Sum of Corresponding Elements of Two Arrays in 8086

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

3K+ Views

Here we will see how to find sum of two array elements and store result into memory.Problem StatementWrite 8086 Assembly language program to find summation of two arrays stored at 501 onwards and 601 onwards. The size of array is stored at location 500. After calculating the sum results are store result at 501 onwards.DiscussionTo solve this problem, we are taking elements from first array using source register SI, and second array using destination register DI. Repeatedly take elements from SI to AL, then add with the content of DI, and store again into SI address. Thus it is solved.InputAddressData……500055012C5020B5037D5042550521……601BA6024560369604CA60595…… Flow ... Read More

Separate or Split a Byte into Two Nibbles in 8085

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

2K+ Views

Here we will see how to split two nibbles of an 8-bit number.Problem StatementWrite 8085 Assembly language program to split two nibbles of an 8-bit number. Number is stored at F050, we will store result at F051 and F052.DiscussionTo get the nibbles separately, at first we are taking number into B register as a copy. Now mask upper nibble to get lower nibble and store it, then take the number from B again, mask lower nibble to get upper nibble, then rotate it four times to make it lower order nibble, after that store it to another location.InputAddressDataF05035 AddressDataF050BE Flow Diagram ProgramAddressHEX CodesLabelsMnemonicsCommentsF0003A, ... Read More

HTML th colspan Attribute

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

432 Views

The colspan attribute of the element is used to set the number of columns a header cell should span.Following is the syntax −Above, num is the count of columns a header cell should span.Let us now see an example to implement the colspan attribute of the element −Example Live Demo table, th, td {    border: 2px solid green; } Product Expenses           Expenses               Product Development       500000               Marketing       500000               Services       100000               Support       100000               Maintenance       100000               Total Budget = INR 1300000     OutputIn the above example, we have set the column count to span the header cell −ExpensesThe count is 2, therefore two columns will span the header cell.

Add a Column Using MySQL SELECT in an Already Created Table

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

318 Views

Let us first create a table −mysql> create table DemoTable    -> (    -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> Name varchar(100),    -> Age int    -> ); Query OK, 0 rows affected (0.49 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(Name, Age) values('Robert', 24); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable(Name, Age) values('Chris', 22); Query OK, 1 row affected (0.13 sec)Display all records from the table using select statement −mysql> select *from DemoTable;Output+----+--------+------+ | Id | Name | Age | +----+--------+------+ ... Read More

HTML DOM InputEvent Object

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

235 Views

The InputEvent Object represents all the events that correspond to content change of a form element.PropertiesHere, “InputEvent” can have the following properties/methods −Property/MethodDescriptiondataIt returns the string corresponding to inserted characterdataTransferIt returns an object containing information about the interested/deleted datagetTargetRanges()Returns an array containing target ranges that will be affected by the insertion/deletion.inputTypeIt returns the type of inputisComposingIt returns the state of the eventExampleLet us see an example for InputEvent data property − Live Demo InputEvent Data    form {       width:70%;       margin: 0 auto;       text-align: center;    }    * {   ... Read More

Understand if a BIGINT is Signed or Unsigned in MySQL

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

2K+ Views

If you do not specify unsigned, then bigint will be signed. If you specify an unsigned, then bigint will be unsigned.Let us first create a table −mysql> create table DemoTable    (    Number bigint, // signed    Number2 bigint unsigned // unsigned    ); Query OK, 0 rows affected (1.08 sec)Insert records in the table using insert command −mysql> insert into DemoTable values(18446744073709551615, 18446744073709551615); ERROR 1264 (22003): Out of range value for column 'Number' at row 1 mysql> insert into DemoTable values(9223372036854775807, 18446744073709551615); Query OK, 1 row affected (0.28 sec)Display all records from the table using select statement −mysql> ... Read More

Advertisements