Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Programming Articles - Page 1433 of 3366
1K+ Views
The ListFiles() method returns an array holding the objects (abstract paths) of all the files (and directories) in the path represented by the current (File) object.The File Filter interface is filter for the path names you can pass this as a parameter to the listFiles() method. This method filters the file names passed on the passed filter.To get the directories in a folder implement a FileFilter which accepts only directories and pass it as a parameter to the listFiles() method.Following is a screen shot of the contents of the ExampleDirectoryExampleimport java.io.File; import java.io.FileFilter; import java.io.IOException; public class MyExample{ public ... Read More
514 Views
To multiply matrices elements if matrices are stored in a list, we can make use of Reduce function. For example, if we have four matrices named as M1, M2, M3, and M4 stored in a list object called List then the multiplication each element in all the four matrices can be done by using the command Reduce("*",List).Example1 Live DemoM1
109 Views
We can split the screen to assign the plots manually in the plot area. The split.screen function can be used for this purpose. For example, if we want to create 4 plots in the plot window then we can use split.screen(c(2, 2)). Now to create the plot in first screen the command will be screen(1) then plot will be created. If we again create the plot then the original plot in screen(1) will be replaced with the new one. To create the plot in 3rd screen that is screen(3), we first need to use the command screen(3) and then create ... Read More
6K+ Views
To increase the X-axis length of histogram in base R, we can use the axis function. The most important thing to remember while using the axis function is mentioning the appropriate sequence based on the values in the vector or in the column of the data frame if a data frame is used.Example Live Demox
3K+ Views
The ListFiles() method returns an array holding the objects (abstract paths) of all the files (and directories) in the path represented by the current (File) object.The File Filter interface is filter for the path names you can pass this as a parameter to the listFiles() method. This method filters the file names passed on the passed filter.To get the files in a folder implement a FileFilter which accepts only files and pass it as a parameter to the listFiles() method.Following is a screen shot of the contents of the ExampleDirectoryExampleimport java.io.File; import java.io.FileFilter; import java.io.IOException; public class Demo{ public ... Read More
9K+ Views
The listFiles() method of the File class returns an array holding the objects (abstract paths) of all the files (and directories) in the path represented by the current (File) object.To read the contents of all the files in a folder into a single file −Create a file object by passing the required file path as a parameter.Read the contents of each file using Scanner or any other reader.Append the read contents into a StringBuffer.Write the StringBuffer contents into the required output file.Exampleimport java.io.DataOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.util.Scanner; public class Test { public static void main(String ... Read More
3K+ Views
To create a combination of pairs, we can use the combn function. This function will be helpful to use the vector length and the value 2 that represents a pair to create the combinations. Although, this is enough but we can transpose the output to get a better−looking output.Example1 Live Demox1
4K+ Views
The List() method of the File class returns a String array containing the names of all the files and directories in the path represented by the current (File) object.In order to search for a file you need to compare the name of each file in the directory to the name of the required file using the equals() method.ExampleLive Demoimport java.io.File; import java.util.Arrays; import java.util.Scanner; public class Example { public static void main(String[] argv) throws Exception { System.out.println("Enter the directory path: "); Scanner sc = new Scanner(System.in); String pathStr = sc.next(); ... Read More
543 Views
The checking for duplicates in a data.table object can be easily done with the help of delta ($) operator that is used to access the columns and the duplicated function. For example, if a data.table object DT contains a column x then to check the duplicates in x, we can use the command duplicated(DT$x).Example1Loading data.table object and creating an object −library(data.table) set.seed(141) x
4K+ Views
To multiply only one column with a number, we can simply use the multiplication operator * but need to replace the original column with the new values. For example, if we have a data frame called df that contains three columns x1, x2, and x3, and we want to multiply the second column x2 with 2 then it can be done as df$x2