Concatenating Two Strings in MySQL with Space

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

1K+ Views

For this, you can use concat() function from MySQL. Let us first create a table −mysql> create table DemoTable    -> (    -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> Name varchar(20),    -> Subject varchar(100)    -> ); Query OK, 0 rows affected (17.73 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(Name, Subject) values('John', 'MySQL'); Query OK, 1 row affected (1.19 sec) mysql> insert into DemoTable(Name, Subject) values('Chris', 'SQL Server'); Query OK, 1 row affected (0.88 sec) mysql> insert into DemoTable(Name, Subject) values('Robert', 'MongoDB'); Query OK, 1 row affected ... Read More

Use of exec() Regex Method in JavaScript

vineeth.mariserla
Updated on 30-Jul-2019 22:30:26

123 Views

exec()The exec() method is a regex method. It searches a string for a specified pattern and, unlike test() regex method, returns the found text as an object. If there are no matches it will give null as an output. Let's discuss it in detail.Example-1In the following example, a variable pattern "est" is checked through the exec() method. The exec() regex method, after scrutinizing the given pattern throughout the text, returned the pattern as an object.Live Demo var obj = /est/.exec("Tutorix is the best e-learning platform"); document.write( "The object is ... Read More

Array Fill and Array Swap in C++ STL

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

577 Views

In this section we will see what are the usage of array::fill() and the array::swap() in C++ STL.The array::fill() function is used to fill the array with some specified value. Let us see one example to get the idea.Example Live Demo#include #include using namespace std; main() {    array arr = {00, 11, 22, 33, 44, 55, 66, 77, 88, 99};    cout

Manage Executable Python Zip Archives with zipapp

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

685 Views

The zipapp module has been introduced in Python's standard library since ver 3.5. This module is used to manage the creation of zip files containing Python code, which can be executed directly by the Python interpreter. The module provides both a Command-Line Interface and a programming interface.To use zipapp module programmatically, we should have a module in which main function is present. The executable archive is built by following command −python -m zipapp myapp -m "example:main"Here, the current path should have a folder called myapp. In this folder, there should be example.py which must have main() function.Create myapp folder and ... Read More

Remove Notification from Notification Bar Programmatically in Android

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

3K+ Views

This example demonstrate about How to remove notification from notification bar programmatically 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 res/layout/custom_notification_layout.xml.             Step 4 − Add the following code to src/MainActivity.package app.tutorialspoint.com.notifyme ; import android.app.NotificationChannel ; import android.app.NotificationManager ; import android.os.Bundle ; import android.support.v4.app.NotificationCompat ; import android.support.v7.app.AppCompatActivity ; import android.view.View ; import android.widget.RemoteViews ; public class MainActivity ... Read More

Difference Between .py and .pyc Files

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

3K+ Views

Python compliles the .py files and save it as .pyc fileThe .pyc contain the compiled bytecode of Python source files, A .pyc is not created for your main program file that you execute (only for imported modules).The .pyc file contains encoded python bytecode.If We Want to import module.The Module calculate Addition of Two NumbersExample Live Demodef recursive_sum(n): """Function to return the sum of recursive numbers""" if n

Add Internal Frame to a JDesktopPane in Java

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

679 Views

At first, create a JDesktoPane −JDesktopPane desktopPane = new JDesktopPane();Now, create an Internal frame and add it to the JDesktopPane −JInternalFrame intFrame = new JInternalFrame("Our Frame", true, true, true, true); desktopPane.add(intFrame); The following is an example to add Internal Frame to a JDesktopPane − package my; import java.awt.BorderLayout; import javax.swing.JButton; import javax.swing.JDesktopPane; import javax.swing.JFrame; import javax.swing.JInternalFrame; import javax.swing.JLabel; public class SwingDemo {    public static void main(final String[] args) {       JFrame frame = new JFrame();       frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);       JDesktopPane desktopPane = new JDesktopPane();       JInternalFrame intFrame = new JInternalFrame("Our Frame", true, ... Read More

Return Specific Values from a MongoDB Query

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

182 Views

Yes, using map(). Let us first create a collection with documents −> dblistOfSpecificValuesDemoinsertOne({"StudentName":"John"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cefcc8fef71edecf6a1f6bb") } > dblistOfSpecificValuesDemoinsertOne({"StudentName":"Chris"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cefcc94ef71edecf6a1f6bc") } > dblistOfSpecificValuesDemoinsertOne({"StudentName":"Robert"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cefcc98ef71edecf6a1f6bd") } > dblistOfSpecificValuesDemoinsertOne({"StudentName":"David"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cefcc9cef71edecf6a1f6be") }Following is the query to display all documents from a collection with the help of find() method −> dblistOfSpecificValuesDemofind();Output{ "_id" : ObjectId("5cefcc8fef71edecf6a1f6bb"), "StudentName" : "John" } { "_id" : ObjectId("5cefcc94ef71edecf6a1f6bc"), "StudentName" : "Chris" } { "_id" : ObjectId("5cefcc98ef71edecf6a1f6bd"), "StudentName" : "Robert" } ... Read More

Get LocalDateTime Object from Java SQL Date using JDBC

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

4K+ Views

The java.time package of Java8 provides a class named LocalDateTime is used to get the current value of local date and time. Using this in addition to date and time values you can also get other date and time fields, such as day-of-year, day-of-week and week-of-year.Converting java.sql.Date to LocalDateTimeThe java.sql.TimeStamp class provides a method with name toLocalDateTime() this method converts the current timestamp object to a LocalDateTime object and returns it.To convert date to LocalDateTime object.Create a Timestamp object from Date object using the getTime() method as −Date date = rs.getDate("DispatchDate"); //Converting Date to Timestamp Timestamp timestamp = new Timestamp(date.getTime());Now, ... Read More

Get Memory Usage at Runtime Using C++

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

8K+ Views

We can get the memory usage like virtual memory usage or resident set size etc. at run time. To get them we can use some system libraries. This process depends on operating systems. For this example, we are using Linux operating system.So here we will see how to get the memory usage statistics under Linux environment using C++. We can get all of the details from “/proc/self/stat” folder. Here we are taking the virtual memory status, and the resident set size.Example#include #include #include #include #include using namespace std; void mem_usage(double& vm_usage, double& resident_set) {   ... Read More

Advertisements