Karthikeya Boyini has Published 2383 Articles

ftp_get() function in PHP

karthikeya Boyini

karthikeya Boyini

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

222 Views

The ftp_get() function is used to downloads file from the FTP server and save it into a local file.Syntaxftp_fget(con, local_file, server_file, mode, startpos);Parameterscon − The FTP connectionlocal_file − A file where the data is storedserver_file − The server file to downloadmode − The transfer modestartpos − The position to begin ... Read More

Get system start time from RuntimeMXBean in Java

karthikeya Boyini

karthikeya Boyini

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

192 Views

RuntimeMXBean in the management interface for the runtime system of the Java virtual machine.RuntimeMXBean runtimeMX = ManagementFactory.getRuntimeMXBean();To get the system start time, use the getStartTime() method −new Date(runtimeMX.getStartTime()The following is an example −Example Live Demoimport java.lang.management.ManagementFactory; import java.lang.management.RuntimeMXBean; import java.util.Date; public class Demo { public static void main(String ... Read More

ftp_mdtm() function in PHP

karthikeya Boyini

karthikeya Boyini

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

122 Views

The ftp_mdtm() function returns the last modified time of a specified file in PHP.Syntaxftp_mdtm(con,file);Parameterscon − The FTP connectionmyfile − The file to checkReturnThe ftp_mdtm() function returns the last modified time as a Unix timestamp.ExampleThe following is an example −

Compare two file paths in Java

karthikeya Boyini

karthikeya Boyini

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

722 Views

Two file paths can be compared lexicographically in Java using the method java.io.File.compareTo(). This method requires a single parameter i.e.the abstract path name that is to be compared. It returns 0 if the two file path names are equal.A program that demonstrates this is given as follows −Example Live Demoimport java.io.File; ... Read More

Sort items in a Java TreeSet

karthikeya Boyini

karthikeya Boyini

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

568 Views

First, create a TreeSet and add elements to it −TreeSet set = new TreeSet(); set.add("65"); set.add("45"); set.add("19"); set.add("27"); set.add("89"); set.add("57");Now, sort it in ascending order, which is the default −Iterator i = set.iterator(); while(i.hasNext()){ System.out.println(i.next()); }If you want to sort in descending order, then use the descendingIterator() ... Read More

Display hour with SimpleDateFormat(“H”) in Java

karthikeya Boyini

karthikeya Boyini

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

323 Views

To work with SimpleDateFormat class in Java, import the following package.import java.text.SimpleDateFormat;Now, set the format with SimpleDateFormat(“H”) to display hour in a day.Format f = new SimpleDateFormat("H");Now, get the hour −String strHour = f.format(new Date());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 ... Read More

ftp_nb_continue() function in PHP

karthikeya Boyini

karthikeya Boyini

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

26 Views

The ftp_nb_continue() function continues to receive or send a file to the FTP server. That means the download continues.Syntaxftp_nb_continue(con);Parameterscon − The FTP connection.ReturnThe ftp_nb_continue() function returns any of the following values −FTP_FAILED − send/receive failedFTP_FINISHED − send/receive completedFTP_MOREDATA − send/receive in progressExampleThe following is an example. Here., “new.txt” is a ... Read More

Get an Absolute Filename Path from a Relative Filename with Path in Java

karthikeya Boyini

karthikeya Boyini

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

236 Views

The method java.io.File.getAbsoluteFile() can be used to acquire the absolute filename path from a relative filename with path in Java. This method requires no parameters. It returns the file that is defined by the path name.A program that demonstrates this is given as follows −Example Live Demoimport java.io.File; public class Demo ... Read More

Display minutes with SimpleDateFormat('mm') in Java

karthikeya Boyini

karthikeya Boyini

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

1K+ Views

To work with SimpleDateFormat class in Java, import the following package.import java.text.SimpleDateFormat;Now, set the format with SimpleDateFormat(“mm”) to display minutes in two-digits.Format f = new SimpleDateFormat(‘”mm”);Now, get the minutes in a string.String strMinute = f.format(new Date());The following is an example −Example Live Demoimport java.text.Format; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Calendar; public ... Read More

Add an element to a Stack in Java

karthikeya Boyini

karthikeya Boyini

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

4K+ Views

An element can be added into the stack by using the java.util.Stack.push() method. This method pushes the required element to the top of the stack. The only parameter required for the Stack.push() method is the element that is to be pushed into the stack.A program that demonstrates this is given ... Read More

Advertisements