Set SQL Mode Permanently in MySQL

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

977 Views

If you are using Windows Operating System, check your directory my.cnf or my.ini file.mysql> select @@datadir;The following is the output+---------------------------------------------+ | @@datadir | +---------------------------------------------+ | C:\ProgramData\MySQL\MySQL Server 8.0\Data\ | +---------------------------------------------+ 1 row in set (0.00 sec)Reach the above location ‘C:\ProgramData\MySQL\MySQL Server 8.0\Data\”. The screenshot is as follows for my.cnf fileOpen the my.cnf file and write the sql_mode="TRADITIONAL". The syntax is as followssql_mode="TRADITIONAL".After that start your server once again.

Is Engineering Losing Its Worth Over Time?

Madhuparna
Updated on 30-Jul-2019 22:30:24

328 Views

Yes, engineering has indeed lost its value over the years. Given that there are several engineering colleges in India and umpteen engineers are being produced each year from these colleges. However, the question is, if India needs so many engineers and if they are all good to be employed why they have trouble in getting jobs. These questions have automatically created negativity against engineering education in India.Bangalore city alone has over 130 engineering colleges, but the employable engineering graduates are only 22% of engineering jobs (according to studies by MHRD a few years back).Decreasing employer satisfaction with fresh engineering graduates. ... Read More

Remove Special Characters from a Database Field in MySQL

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

21K+ Views

You can remove special characters from a database field using REPLACE() function. The special characters are double quotes (“ “), Number sign (#), dollar sign($), percent (%) etc.The syntax is as follows to remove special characters from a database field.UPDATE yourTableName SET yourColumnName=REPLACE(yourColumnName, ’yourSpecialCharacters’, ’’);To understand the above syntax, let us create a table. The query to create a table is as follows:mysql> create table RemoveSpecialCharacterDemo    -> (    -> Id int NOT NULL AUTO_INCREMENT,    -> Name varchar(20),    -> PRIMARY Key(Id)    -> ); Query OK, 0 rows affected (0.59 sec)Insert some records in the table using ... Read More

Format Integer Values with Java Text DecimalFormat

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

148 Views

Here, we are using the DecimalFormat class in Java to format integer value, which is the java.text.DecimalFormat package.Let us take the following format: DecimalFormat("0.######E0") and use the format() method for this purpose −new DecimalFormat("0.#####E0").format(5089) new DecimalFormat("0.#####E0").format(608)Since, we have used DecimalFormat class in Java, therefore importing the following package in a must −import java.text.DecimalFormat;The following is an example −Example Live Demoimport java.text.DecimalFormat; public class Demo { public static void main(String[] argv) throws Exception { System.out.println(new DecimalFormat("0.#####E0").format(387979)); System.out.println(new DecimalFormat("0.#####E0").format(29797)); System.out.println(new DecimalFormat("0.#####E0").format(49788)); ... Read More

SimpleDateFormat HH:mm:ss a in Java

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

4K+ Views

The following format displays time from −hh:mm:ssThe following format displays time with AM/ PM marker −hh:mm:ss aHere, we are using the SimpleDateFormat class to display date and time. Let us set it for the format we want i.e time and AM/PM Marker −Format f = new SimpleDateFormat("hh:mm:ss a"); String strResult = f.format(new Date()); System.out.println("Time = "+strResult);The following is an example −Example Live Demoimport java.text.Format; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Calendar; public class Demo { public static void main(String[] args) throws Exception { // displaying current date and time ... Read More

Select Distinct Values from Two Columns in MySQL

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

5K+ Views

To select distinct values in two columns, you can use least() and greatest() function from MySQL.Let us create a table with two columns −mysql> create table SelectDistinctTwoColumns    −> (    −> StudentId int,    −> EmployeeId int    −> ); Query OK, 0 rows affected (0.60 sec)Now you can insert records in the table. The query to insert records is as follows −mysql> insert into SelectDistinctTwoColumns values(100, 101); Query OK, 1 row affected (0.39 sec) mysql> insert into SelectDistinctTwoColumns values(102, 103); Query OK, 1 row affected (0.13 sec) mysql> insert into SelectDistinctTwoColumns values(104, 105); Query OK, 1 ... Read More

Make iPhone Vibrate Using Swift

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

2K+ Views

To make an iPhone vibrate using swift we’ll use two different methods. First create a new project and add Four different buttons to the main View controller.Now import the AudioToolbox framework in your view controller class.For the first button add an action and write the following code as shown below:@IBAction func actionButtonOne(_ sender: Any) {    AudioServicesPlayAlertSound(SystemSoundID(kSystemSoundID_Vibrate)) }This will generate a long vibrating feedback on your device. Now to create more vibration effects on devices with iOS 10 or more we’ll add methods for all four different buttons.@IBAction func actionButtonTwo(_ sender: Any) {    let generator = UIImpactFeedbackGenerator(style: .heavy)   ... Read More

Basic Responsibilities You Have for Your Country

Ridhi Arora
Updated on 30-Jul-2019 22:30:24

2K+ Views

'India is my country and all Indians are my brothers and sisters.' This is the oath we used to take every day when we were in school. This pledge and many more books and texts remind us of our moral and legal responsibilities. Our nation is our motherland. It never asks anything in return from us as it is our motherland and a mother is selfless in giving.Even if the nation does not expect anything from us, we hold an obligation ourselves.The first and foremost responsibility we have towards our country is to respect not only the land where we ... Read More

Best iOS Apps for Education

Samrat T
Updated on 30-Jul-2019 22:30:24

182 Views

Apps have become an integral part of our daily lives. We depend on our iPhones more than our computers. There are many education apps that can improve your language, memory, and many skills in different categories. Let us look at such apps.DuolingoElevateLumosityTEDPeakCourseraMath 42UdemyCreative CloudCodecademy

Convert Datetime to Seconds in PHP Equivalent to MySQL TIME_TO_SEC

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

1K+ Views

The function TIME_TO_SEC() can be used in MySQL. If you want to convert datetime to seconds use the strtotime() from PHP. The MySQL syntax is as follows:SELECT TIME_TO_SEC(ABS(timediff(‘yourDateTimeValue’, now())));Now you can convert PHP datetime to seconds with the help of strtotime().First, you need to install XAMPP server to run your PHP program.After installing XAMPP successfully in C drive, here is the location wherein you need to include the PHP file. The snapshot is as follows:Note: Here, I have changed port of Apache to 8086 because default port was held by another program. This is done to begin running PHP program.Therefore, ... Read More

Advertisements