- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
In C we have seen different format specifiers. Here we will see another format specifier called %p. This is used to print the pointer type data. Let us see the example to get a better idea.Example#include main() { int x = 50; int *ptr = &x; printf("The address is: %p, the value is %d", ptr, *ptr); }OutputThe address is: 000000000022FE44, the value is 50
This is a C++ program to perform finite state automaton based search. An automaton with a finite number of states is called a Finite Automaton. Here, a text is given text[0 … t-1] and a pattern p[0 ... p-1] is also given. We have to find the pattern in the text and print its all occurrences at the respective indices.AlgorithmsBegin Function void transitiontable(): 1) put the entries in first row and filled it up. All entries in first row are always 0 except the entry for p[0] character. Always we need to go to state 1. for ... Read More
This example demonstrate about How to start an activity when user clicks a notification in AndroidStep 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 app.tutorialspoint.com.notifyme ; import android.app.NotificationChannel ; import android.app.NotificationManager ; import android.app.PendingIntent ; import android.content.Context ; import android.content.Intent ; import android.support.v4.app.NotificationCompat ; import android.support.v7.app.AppCompatActivity ; import android.os.Bundle ; import android.view.View ; import android.widget.Button ; public class MainActivity extends AppCompatActivity { ... Read More
Here we will see how to make timer using C++. Here we are creating one class called later. This class has following properties.int (milliseconds to wait until to run code)bool (If this is true, it returns instantly, and run the code after specified time on another thread)The variable arguments (exactly we want to feed to std::bind)We can change the chrono::milliseconds to nanoseconds or microseconds etc. to change the precision.Example Code#include #include #include #include class later { public: template later(int after, bool async, callable&& f, arguments&&... args){ ... Read More
Let us first create three components −JComponent one = new JLabel("Label One"); one.setBorder(BorderFactory.createLineBorder(Color.yellow)); JComponent two = new JLabel("Label Two"); two.setBorder(BorderFactory.createLineBorder(Color.orange)); JComponent three = new JLabel("Label Three"); three.setBorder(BorderFactory.createLineBorder(Color.blue));Now, we will split one and two components.JSplitPane split1 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, one, two); split1.setDividerLocation(0.5); split1.setDividerSize(2);After that the above splitted pane would be splitted with component three making the process nested −JSplitPane split2 = new JSplitPane(JSplitPane.VERTICAL_SPLIT, split1, three ); split2.setDividerLocation(0.9); split2.setDividerSize(2);The following is an example to create nested JSplitPane −Examplepackage my; import java.awt.BorderLayout; import java.awt.Color; import javax.swing.BorderFactory; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JSplitPane; public class SwingDemo { public static void main(String[] ... Read More
To split a numerical query result, you can use the CONCAT() function in MySQL. Let us first create a table −mysql> create table DemoTable ( StudentId int ); Query OK, 0 rows affected (0.68 sec)Now you can insert some records in the table using insert command −mysql> insert into DemoTable values(2222); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable values(5555); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable values(4567); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable values(8905); Query OK, 1 row affected (0.15 sec)Display all records from ... Read More
The target attribute of the element is used to set where the linked document will open. You can set the document to open in a new window, same frame, parent frame, etc.Following is the syntax −Here, _blank is used to open the linked document in new window or tab, _self opens the linked document in the same frame as it was clicked, _parent opens the document in the parent frame, _top opens the linked document in the entire body of the window, frame opens the linked document in a named frame.Let us now see an example to implement target attribute ... Read More
You might have come across many application where the screen extends to complete screen i.e transparent Status Bar and transparent navigation bar.Here we will be seeing how to create an application where the you’ll be having transparent status and navigation bar.So let’s get startedStep 1 − Open Xcode → New Project → Single View Application → Let’s name it “TransparentViews”Step 2 − Embed the View Controller in Navigation Controller. Add Image View and shown and add image.Step 3 − Run the application without adding any piece of code for making status and navigation bar transparent.The screen looks like belowStep 4 ... Read More
Let us first create a table −mysql> create table DemoTable -> ( -> UserId int -> ); Query OK, 0 rows affected (0.48 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(10); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable values(20); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable values(30); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable values(10); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values(10); Query OK, 1 row affected (0.09 sec) ... Read More
In this problem we will see how we can get the sum of squares of first n natural numbers. Here we are using one for loop, that runs from 1 to n. In each step we are calculating square of the term and then add it to the sum. This program takes O(n) time to complete. But if we want to solve this in O(1) or constant time, we can use this series formula −AlgorithmsquareNNatural(n)begin sum := 0 for i in range 1 to n, do sum := sum + i^2 done return ... Read More