Heap overflow and Stack overflow in C

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

5K+ Views

Heap OverflowHeap is used to store dynamic variables. It is a region of process’s memory. malloc(), calloc(), resize() all these inbuilt functions are generally used to store dynamic variables.Heap overflow occurs when −A) If we allocate dynamic large number of variables −int main() {    float *ptr = (int *)malloc(sizeof(float)*1000000.0)); }B) If we continuously allocate memory and do not free after using it.int main() {    for (int i=0; i

How to Get the current language in Android device?

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

1K+ Views

While doing internalization in android application, we should know what is the current language in android device. This example demonstrate about how to Get the current language in Android device.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 Button. When user click on button, it will take device country name and language and append to text view.Step 3 − Add the following code ... Read More

How to Transfer Files Using Wi-Fi Pair Connection in Android?

Jennifer Nicholas
Updated on 30-Jul-2019 22:30:25

703 Views

This example demonstrate about How to Transfer Files Using Wi-Fi Pair Connection in AndroidNeed Server and Client ProjectServerStep 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.                         Step 3 − Add the following code to src/MainActivity.javapackage com.server.myapplication.server; import android.annotation.SuppressLint; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; ... Read More

How to check if Location Services are enabled in iOS App?

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

993 Views

Location services as the name suggests gather the user information via GPS, Wifi and cell towers. Every iOS device has on board GPS, WiFi, cell tower location data and Bluetooth to determine the location of the iPhone or iPad. The user can enable or disable location services from the Settings app by toggling the Location Services switch in General.You should check the return value of locationServiceEnabled() method before starting location updates to determine whether the user has location services enabled for the current device.To check if Location Services are enabled in iOS app checkout the codeOpen Xcode → New Project ... Read More

MySQL order by from highest to lowest value?

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

2K+ Views

To order by from highest to lowest value, you can use ORDER BY DESC command −select *from yourTableName order by yourColumnName DESC;If you want the result from lowest to highest, you can use ORDER BY ASC command −select *from yourTableName order by yourColumnName ASC;Let us first create a table −mysql> create table DemoTable (    Value int ); Query OK, 0 rows affected (0.56 sec)Insert records in the table using insert command −mysql> insert into DemoTable values(134); Query OK, 1 row affected (0.20 sec) mysql> insert into DemoTable values(245); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable ... Read More

Why a living person sinks and a dead person floats in water?

Tejas Charukula
Updated on 30-Jul-2019 22:30:25

8K+ Views

This might be one of the most confusing questions that have been bothering a common man. The general idea is that because a man is alive he can make himself stay above the water whereas a dead person has no abilities, therefore, he has to sink. But that isn't the case and there is a perfect explanation for this phenomenon.Why a living person sinks?A person only starts to sink into the water when the air in his lungs is replaced with water. Once the body is submerged under the water, then the body stays under the water until the bacteria ... Read More

Description of 8255 PPI

Nancy Den
Updated on 30-Jul-2019 22:30:25

5K+ Views

Intel 8255 is a peripheral interface (PPI) chip which is programmable. It is used for the connection of peripheral devices and interfacing. We call Peripheral device also as Input Output device. We use Input Output ports for the connection of Input Output devices. Hence 8255 is a programmable Input Output port chip. It is a 40 pin chip available for dual line packaging. Power supply of +5 Volt DC is needed for its working. It consists of two programmable Input Output ports having of size 8 bits and two programmable Input Output ports of size 4 bits. We call them ... Read More

C++ Program to Perform Fermat Primality Test

Nancy Den
Updated on 30-Jul-2019 22:30:25

476 Views

Fermat Primality test performs to check a given number is prime or not. Here is a C++ code of this algorithm.AlgorithmBegin    modulo(base, e, mod)    a = 1    b = base    while (e > 0)       if (e mod 2 == 1)          a = (a * b) % mod          b = (b * b) % mod          e = e / 2       return a % mod End Begin    Fermat(ll m, int iterations)    if (m == 1)     ... Read More

How to create blur activity background in android?

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

2K+ Views

This example demonstrate about How to create blue activity background 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 sample text.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.telephony.TelephonyManager; import android.view.WindowManager; import android.widget.TextView; public class MainActivity extends AppCompatActivity { private static final int PERMISSION_REQUEST_CODE ... Read More

How to show pdf in android webview?

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

3K+ Views

This example demonstrate about How to show pdf in android webview.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 web view to show pdf.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.app.ProgressDialog; import android.os.Build; import android.os.Bundle; import android.support.annotation.RequiresApi; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.webkit.WebChromeClient; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.EditText; public class MainActivity extends AppCompatActivity {    @RequiresApi(api ... Read More

Advertisements