Print Unicode Character in C++

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

6K+ Views

To print the Unicode characters, the process is very similar to the actual printing process in C++.We can put the Unicode value with the prefix \u. Thus we can successfully print the Unicode character.Note: If the console does not support Unicode, then you cannot get the correct result. Here we have used the Linux system to solve this problem.Example#include using namespace std; int main() {    cout

Add Background Image to JFrame in Java

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

16K+ Views

To add background image to JFrame, use the getImage() method of the Image class −Image img = Toolkit.getDefaultToolkit().getImage("E:\rahul.jpg");Now, draw the image −public void paintComponent(Graphics g) {    super.paintComponent(g);    g.drawImage(img, 0, 0, null); }The following is an example to add Background Image to JFrame −Exampleimport java.awt.Graphics; import java.awt.Image; import java.awt.Toolkit; import java.io.IOException; import javax.swing.JPanel; public class SwingDemo extends javax.swing.JFrame {    Image img = Toolkit.getDefaultToolkit().getImage("E:\rahul.jpg");    public SwingDemo() throws IOException {       this.setContentPane(new JPanel() {          @Override          public void paintComponent(Graphics g) {             super.paintComponent(g);     ... Read More

Open Activity After Receiving Push Notification in Android

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

3K+ Views

This example demonstrate about How to open an activity after receiving a PUSH 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 src/MyFirebaseMessagingService.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 com.google.firebase.messaging.FirebaseMessagingService ; import com.google.firebase.messaging.RemoteMessage ; public class MyFirebaseMessagingService extends FirebaseMessagingService {    public static final String NOTIFICATION_CHANNEL_ID = "10001" ;    private final static String default_notification_channel_id = "default" ;    @Override    public void onNewToken (String s) {       super .onNewToken(s) ;    }    @Override    public void onMessageReceived (RemoteMessage remoteMessage) {       super .onMessageReceived(remoteMessage) ;       Intent notificationIntent = new Intent(getApplicationContext() ,  MainActivity. class ) ;       notificationIntent.putExtra( "NotificationMessage" ,  "I am from Notification" ) ;       notificationIntent.addCategory(Intent. CATEGORY_LAUNCHER ) ;       ... Read More

Query Array for True Value at Index N in MongoDB

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

172 Views

You can use dot(.) notation for this. Let us first create a collection with documents −>db.containsTrueValueDemo.insertOne({"IsMarried":[true, false, true, true, true, true, false, true, false, false, true]}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd5039c2cba06f46efe9ef5") }Following is the query to display all documents from a collection with the help of find() method −> db.containsTrueValueDemo.find().pretty();This will produce the following output −{    "_id" : ObjectId("5cd5039c2cba06f46efe9ef5"),    "IsMarried" : [       true,       false,       true,       true,       true,       true,       false,       true, ... Read More

Add Tooltip to a Component in Java

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

531 Views

Let us first create a component −JLabel label1; label1 = new JLabel("Id", SwingConstants.CENTER); Now, set the tooltip for the above component − label1.setToolTipText("Enter Id");ExampleThe following is an example to add a tooltip to a component in Java −package my; import java.awt.GraphicsEnvironment; import java.awt.GridLayout; import java.awt.Point; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPasswordField; import javax.swing.JTextField; import javax.swing.SwingConstants; public class SwingDemo {    public static void main(String[] args) throws Exception {       JFrame.setDefaultLookAndFeelDecorated(true);       JFrame frame = new JFrame("Register!");       JLabel label1, label2, label3;       frame.setLayout(new GridLayout(2, 2));       label1 = new JLabel("Id", ... Read More

Set Titled Justification Position of Title Text in Java

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

423 Views

To set the titled justification of the titled border, use the setTitleJustification() method. The following is an example to set the title justification of the titled border −Examplepackage my; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Container; import javax.swing.BorderFactory; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.border.LineBorder; import javax.swing.border.TitledBorder; public class SwingDemo {    public static void main(String args[]) {       JFrame frame = new JFrame("Demo");       frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);       LineBorder linedBorder = new LineBorder(Color.YELLOW);       TitledBorder titledBorder = BorderFactory.createTitledBorder(linedBorder, "Demo Title");       titledBorder.setTitleJustification(TitledBorder.LEFT);       JLabel label = new JLabel();       ... Read More

HTML tt Tag

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

144 Views

The element in HTML is used to set keyboard input. Since the element deprecated now, therefore use instead.Note: The tag is not supported in HTML.Let us now see an example to implement the tag in HTML−Example Live Demo Shortcut Keys Use the following shortcut keys: Cut: CTRL+X Copy: CTRL+C Paste: CTRL+V Undo: CTRL+Z OutputIn the above example, we have set the shortcut keys using the element−Paste: CTRL+VWe have set one of the shortcut for pasting text as shown above −CTRL + V

Update String Field by Concatenating in MySQL Query

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

977 Views

For concatenating a string field, use CONCAT() function. Let us first create a table −mysql> create table DemoTable    -> (    -> SequenceId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> StudentId varchar(100)    -> ); Query OK, 0 rows affected (0.59 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(StudentId) values('STU'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable(StudentId) values('STU1'); Query OK, 1 row affected (0.18 sec)Display all records from the table using select statement −mysql> select *from DemoTable;Output+------------+-----------+ | SequenceId | StudentId | +------------+-----------+ | 1 ... Read More

Addition of Two Numbers Without Propagating Carry

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

544 Views

Here we will see one problem, where we will add two n digit numbers but the carry will not be propagated. We can understand this concept through an example −So we can see that here only digits are getting added and answer is placed. Here is one trick. We have to scan the numbers from right to left. So the sum of 3+2 = 6 will be calculated first, but it will be placed at the end. So we will use stack to store intermediate results.AlgorithmnoPropagateCarry(a, b)begin    size = max of length of a and length of b   ... Read More

Permutation and Combination in Python

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

1K+ Views

In this section, we are going to learn how to find permutation and combination of a given sequence using python programming language.One of the key advantage of python over other programming language is that it comes with huge set of libraries with it.We are going to use python inbuilt package to find permutation and combinations of a given sequence.Algorithm to find the Permutation and combinationStep 1 : Import required package. First step is to import the required package, as we are going to use itertools package, so we just import it using.>>> import itertools >>>Step 2: Get all permutation & combination ... Read More

Advertisements