Samual Sam has Published 2492 Articles

Remove first two characters of all fields in MySQL?

Samual Sam

Samual Sam

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

716 Views

To remove the first two characters of all fields, you need to use SUBSTRING() function from MySQL. The syntax is as follows −UPDATE yourTableName SET yourColumnName=SUBSTRING(yourColumnName, 3) WHERE yourCondition;To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> create table ... Read More

How to generate byte code file in python

Samual Sam

Samual Sam

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

1K+ Views

All python program automatically compiles your source code to compile code also called as byte code, before executing it.Whenever we import a module for the first time or when your source file is a new file or we have an updated file then the recently compiled file, a .pyc file ... Read More

Can we use IFNULL along with MySQL ORDER BY?

Samual Sam

Samual Sam

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

253 Views

You can use IFNULL along with ORDER BY clause. The syntax is as follows −SELECT *FROM yourTableName ORDER BY IFNULL(yourColumnName1, yourColumnName2);To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> create table IfNullDemo    -> (    -> Id int ... Read More

Get Operating System temporary directory / folder in Java

Samual Sam

Samual Sam

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

857 Views

To get the temporary directory in Java, use the System.getProperty() method. Use theIt’s syntax is −String getProperty(String key)Above, the key is the name of the system property. Since, we want the Java Home Directory name, therefore we will add the key as −java.io.tmpdirThe following is an example −Example Live Demopublic class ... Read More

Format Output with Formatter in Java

Samual Sam

Samual Sam

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

235 Views

For Formatter, import the following package −import java.util.Formatter;Now create a Formatter object −Formatter f1 = new Formatter();Now, we will format the output with Formatter −f1.format("Rank and Percentage of %s = %d %f", "John", 2, 98.5);The following is an example −Example Live Demoimport java.util.Formatter; public class Demo { public ... Read More

Check if string contains another string in Swift

Samual Sam

Samual Sam

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

268 Views

To check if a string contains another string in swift, we’ll need two different strings. One string that we have to check if it consists another string.Let us say the string we want to check is “point” and the whole string is “TutorialsPoint” and another string is “one two three”. ... Read More

MySQL GROUP BY with WHERE clause and condition count greater than 1?

Samual Sam

Samual Sam

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

1K+ Views

To understand the group by with where clause, let us create a table. The query to create a table is as follows −mysql> create table GroupByWithWhereClause    -> (    -> Id int NOT NULL AUTO_INCREMENT,    -> IsDeleted tinyint(1),    -> MoneyStatus varchar(20),    -> UserId int,    -> ... Read More

How to use MBProgressHUD with swift?

Samual Sam

Samual Sam

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

1K+ Views

To use MBProgressHUD in swift we first need to create a podfile if it does not exist already.Go to terminal and change directory to your project directory then initialize pod and later install MBProgressHUD.cd /projectDirectory pod init open podfileThen in the podfile add the following line and go back to ... Read More

Python Tricks for Competitive Coding

Samual Sam

Samual Sam

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

2K+ Views

Python is one of the preferred languages among coders for most of the competitive programming challenges. Most of the problems are easily computed in a reasonable time frame using python.For some of the complex problem, writing fast-enough python code is often a challenge. Below are some of the pythonic code ... Read More

Format Specifier for Hash Code in Java

Samual Sam

Samual Sam

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

158 Views

Format specifier for Hash Code us %h.Firstly, create a new object for Formatter and Calendar −Formatter f = new Formatter(); Calendar c = Calendar.getInstance();For hash code −f.format("%h", c)The following is an example that finds the hash code −Example Live Demoimport java.util.Calendar; import java.util.Formatter; public class Demo { public ... Read More

Advertisements