Use TIME Type in MySQL

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

270 Views

Let us first create a table. Within that we have set a column with type TIME to get the login time −mysql> create table DemoTable (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    LoginTime TIME NULL ); Query OK, 0 rows affected (0.69 sec)Insert records in the table using insert command −mysql> insert into DemoTable(LoginTime) values('12:34:45'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable(LoginTime) values('13:56:01'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable(LoginTime) values('04:12:23'); Query OK, 1 row affected (0.13 sec)Following is the query to display all records from the table using ... Read More

Configuration File Parser in Python - ConfigParser

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

14K+ Views

The configparser module from Python's standard library defines functionality for reading and writing configuration files as used by Microsoft Windows OS. Such files usually have .INI extension.The INI file consists of sections, each led by a [section] header. Between square brackets, we can put the section’s name. Section is followed by key/value entries separated by = or : character. It may include comments, prefixed by # or ; symbol. A sample INI file is shown below −[Settings] # Set detailed log for additional debugging info DetailedLog=1 RunStatus=1 StatusPort=6090 StatusRefresh=10 Archive=1 # Sets the location of the MV_FTP log file LogFile=/opt/ecs/mvuser/MV_IPTel/log/MV_IPTel.log ... Read More

Get Android Serial Number Programmatically

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

4K+ Views

This example demonstrate about How to get programmatically android serial number.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 serial number.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.Manifest; import android.app.ProgressDialog; import android.content.pm.PackageManager; import android.os.Build; import android.os.Bundle; import android.support.annotation.RequiresApi; import android.support.v4.app.ActivityCompat; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.webkit.CookieManager; import android.webkit.WebChromeClient; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.EditText; import ... Read More

Dynamic Channel Allocation in Computer Network

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

6K+ Views

When there are more than one user who desire to access a shared network channel, an algorithm is deployed for channel allocation among the competing users. Dynamic channel allocation encompasses the channel allocation schemes where channels are allotted to users dynamically as per their requirements, from a central pool.Working PrincipleIn dynamic channel allocation schemes, frequency channels are not permanently allotted to any user. Channels are assigned to the user as needed depending upon the network environment. The available channels are kept in a queue or a spool. The allocation of the channels is temporary. Distribution of the channels to the ... Read More

Insert Element at Specified Position in Java CopyOnWriteArrayList

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

129 Views

Using the add() method, insert the specified element at the specified position in the CopyOnWriteArrayList.The syntax is as followsvoid add(int index, E ele)Here, the parameter index is where you want to insert the element and ele is the element to be inserted to this list. To work with CopyOnWriteArrayList class, you need to import the following packageimport java.util.concurrent.CopyOnWriteArrayList;The following is an example to add elements in the CopyOnWriteArrayList class in JavaExample Live Demoimport java.util.concurrent.CopyOnWriteArrayList; public class Demo {    public static void main(String[] args) {       CopyOnWriteArrayList arrList = new CopyOnWriteArrayList();       arrList.add(100);       arrList.add(250); ... Read More

Get Units from Duration in Java

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

90 Views

The list of different units that are supported by a duration can be obtained using the method getUnits() in the Duration class in Java. This method requires no parameters and it returns the list of different units that are supported by a duration.A program that demonstrates this is given as follows −Example Live Demoimport java.time.Duration; public class Demo {    public static void main(String[] args) {       Duration d = Duration.ofSeconds(5);       System.out.println("The duration is: " + d);       System.out.println("The units are: " + d.getUnits());    } }OutputThe duration is: PT5S The units are: [Seconds, ... Read More

Add +1 to Existing MySQL Values

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

764 Views

Let us see an example and create a table first.mysql> create table Add1ToExistingValue    -> (    -> Value int    -> ); Query OK, 0 rows affected (0.56 sec)Insert some records in the table using insert command.The query is as followsmysql> insert into Add1ToExistingValue values(10); Query OK,  1 row affected (0.12 sec) mysql> insert into Add1ToExistingValue values(13); Query OK,  1 row affected (0.15 sec) mysql> insert into Add1ToExistingValue values(15); Query OK,  1 row affected (0.13 sec) mysql> insert into Add1ToExistingValue values(16); Query OK,  1 row affected (0.14 sec) mysql> insert into Add1ToExistingValue values(20); Query OK,  1 row affected (0.16 sec) mysql> insert into Add1ToExistingValue values(40); Query OK,  1 row affected (0.15 sec) mysql> insert into Add1ToExistingValue values(50); Query OK,  1 row affected (0.11 sec) mysql> insert into Add1ToExistingValue values(55); Query OK,  1 row affected (0.17 sec) mysql> insert into Add1ToExistingValue values(56); Query OK,  1 row affected (0.17 sec)Display all records from the table using select statement.The query is as followsmysql> select *from Add1ToExistingValue;The following is the output+-------+ | Value | +-------+ | 10   ... Read More

What Does Stand For in Host Column and How to Change User's Password

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

360 Views

The localhost means you can access from same machine while from % the remote host access is possible. The syntax is as follows to change the user password.SET PASSWORD FOR 'yourUserName'@'localhost' ='yourPassword';First check the user and host from MySQL.user table. The query is as follows −mysql> select user, host from MySQL.user;Here is the output −+------------------+-----------+ | user             | host      | +------------------+-----------+ | Bob              | %       | | Manish | % ... Read More

Complex Numbers in C++

George John
Updated on 30-Jul-2019 22:30:25

9K+ Views

In this section we will see how to create and use complex numbers in C++. We can create complex number class in C++, that can hold the real and imaginary part of the complex number as member elements. There will be some member functions that are used to handle this class.In this example we are creating one complex type class, a function to display the complex number into correct format. Two additional methods to add and subtract two complex numbers etc.Example Live Demo#include using namespace std; class complex {    int real, img;    public:       complex() {   ... Read More

Send Data Between Activities in Android Using Intent

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

699 Views

This example demonstrate about How to send data from one activity to another in Android using intent.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.         Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.EditText; public class MainActivity extends AppCompatActivity {    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main); ... Read More

Advertisements