Compile 32-bit Program on 64-bit GCC in C and C++

Anvi Jain
Updated on 30-Jul-2019 22:30:25

3K+ Views

Nowadays the compiler comes with default 64-bit version. Sometimes we need to compile and execute a code into some 32bit system. In that time, we have to use this feature.At first, we have to check the current target version of the gcc compiler. To check this, we have to type this command.gcc –v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-linux-gnu ........... ........... ...........Here it is showing that Target is x86_64. So we are using the 64-bit version of gcc. Now to use the 32-bit system, we have to write the following command.gcc –m32 program_name.cSometimes this command may generate ... Read More

Memory Write (MW) Machine Cycle in 8085 Microprocessor

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

3K+ Views

In the last three clock cycles the instructions ‘MVI M, 25H’ are the example for Memory Write machine cycle. We have shown the Waveforms for MW machine cycle are shown in fig below.The address which is sent out from the register pair in a Memory Write machine cycle is completely dependent on the MW machine cycle under the consideration as it is shown in the chart below.Reg. pairExampleSPWe push the information above the top of the stack in PUSH BHLWe save register C in the memory which is pointed by HL in MOV M, CBCWe save register A register in the ... Read More

Generate CREATE TABLE Command from Existing Table in MySQL

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

215 Views

You can generate a create table command based on an existing table in MySQL with the help of SHOW CREATE command.The syntax is as followsSHOW CREATE TABLE yourTableName;To understand the above syntax, let us create a table. The query to create a table is as followsmysql> create table StudentInformation    - > (    - > StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    - > StudentName varchar(20),    - > StudentAge int DEFAULT 18,    - > StudentRollNo int,    - > StudentAddress varchar(200),    - > StudentMarks int,    - > StudentDOB datetime,    - > StudentAdmissionDate datetime ... Read More

Implement Start Foreground for a Service

Vrundesha Joshi
Updated on 30-Jul-2019 22:30:25

2K+ Views

Before getting into example, we should know what service is in android. Service is going to do back ground operation without interact with UI and it works even after activity destroyThis example demonstrate about How to implementing start Foreground for a service.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml. In the above code, we have taken text view, when user click on text view, it will start startForeground().Step 3 ... Read More

Use Abstract List in Volley JSON Array in Android

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

192 Views

This example demonstrate about How to use Abstract list in volley json array in android.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     In the above code, we have taken text view to show Abstract list items.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.os.Build; import android.os.Bundle; import android.support.annotation.RequiresApi; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.widget.TextView; import com.android.volley.Request; import com.android.volley.RequestQueue; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.StringRequest; import com.android.volley.toolbox.Volley; import org.json.JSONArray; ... Read More

LocalDate getChronology Method in Java

Samual Sam
Updated on 30-Jul-2019 22:30:25

89 Views

The value of the specified field from the LocalDate can be obtained using the get() method in the LocalDate class in Java. This method requires a single parameter i.e. ChronoField that is required and it returns the value of the specified field from the LocalDate.A program that demonstrates this is given as follows −Example Live Demoimport java.time.*; import java.time.temporal.ChronoField; public class Main {    public static void main(String[] args) {       LocalDate ld = LocalDate.parse("2019-02-16");       System.out.println("The LocalDate is: " + ld);       System.out.println("The DAY_OF_MONTH is: " + ld.get(ChronoField.DAY_OF_MONTH));    } }OutputThe LocalDate is: 2019-02-16 ... Read More

Check Current Number of Connections to MongoDB

Anvi Jain
Updated on 30-Jul-2019 22:30:25

846 Views

You can check the current number of connections to MongoDB with the help of the following syntax −var anyVariableName= db.serverStatus(); yourVariableName.connections;The second syntax is as follows −db.serverStatus().connections;To understand both the above syntaxes, let us see them one by one −Case 1 − The first query is as follows −> var checkCurrentNumberOfConnections = db.serverStatus() > checkCurrentNumberOfConnections.connections;The following is the output −{ "current" : 1, "available" : 999999, "totalCreated" : 1 }Case 2 − The second query is as follows −> db.serverStatus().connectionsThe following is the output −{ "current" : 1, "available" : 999999, "totalCreated" : 1 }

Multithreading in C

Nitya Raut
Updated on 30-Jul-2019 22:30:25

22K+ Views

Multithreading is a specialized form of multitasking and a multitasking is the feature that allows your computer to run two or more programs concurrently. In general, there are two types of multitasking: process-based and thread-based.Process-based multitasking handles the concurrent execution of programs. Thread-based multitasking deals with the concurrent execution of pieces of the same program.A multithreaded program contains two or more parts that can run concurrently. Each part of such a program is called a thread, and each thread defines a separate path of execution.C does not contain any built-in support for multithreaded applications. Instead, it relies entirely upon the ... Read More

Use Remove in Android PriorityBlockingQueue

Vrundesha Joshi
Updated on 30-Jul-2019 22:30:25

138 Views

Before getting into example, we should know what PriorityBlockingQueue is. It is an unbounded queue and follows same order as priority queue. The main usage of priority blocking queue is, it going to handle out of memory error.This example demonstrate about How to use remove() in android PriorityBlockingQueueStep 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     In the above code, we have taken a text view to show PriorityBlockingQueue elements.Step 3 − ... Read More

Padding MySQL INT Field with Leading Zeroes

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

475 Views

You can use LPAD() from MySQL to pad the beginning of a MySQL INT field with zeroes. Let us first create a table.mysql> create table paddingDemo    -> (    -> Number int    -> ); Query OK, 0 rows affected (0.49 sec)Following is the query to insert some records in the table using insert command −mysql> insert into paddingDemo values(78); Query OK, 1 row affected (0.14 sec) mysql> insert into paddingDemo values(560); Query OK, 1 row affected (0.17 sec) mysql> insert into paddingDemo values(888995); Query OK, 1 row affected (0.13 sec) mysql> insert into paddingDemo values(999994); ... Read More

Advertisements