Get the Full Path of a File in Linux

Kunal Verma
Updated on 02-Sep-2023 15:16:41

43K+ Views

Abstract Every file and folder in Linux has a path that directs the user to it. This path is required for programs and scripts to locate and access files. There are various ways to locate the path to a file or folder if you need to. We can get a full file path with different commands on a Linux machine. In other words, if its arguments were supplied, this command would return the pathnames of the files that would be run in the current context. In this tutorial, we'll show you how to obtain a file's complete path in Linux. ... Read More

Find 2nd Largest Number in an Array in Java

Samual Sam
Updated on 02-Sep-2023 15:09:09

84K+ Views

To find the second largest element of the given array, first of all, sort the array.Sorting an arrayCompare the first two elements of the arrayIf the first element is greater than the second swap them.Then, compare 2nd and 3rd elements if the second element is greater than the 3rd swap them.Repeat this till the end of the array.After sorting an array print the second element from the end of the array.ExampleLive Demopublic class ThirdLargestNumberInAnArray {    public static void main(String args[]){       int temp, size;       int array[] = {10, 20, 25, 63, 96, 57};       size = array.length;       for(int i = 0; i

Convert StringBuilder to String in Java

Maruthi Krishna
Updated on 02-Sep-2023 15:06:14

60K+ Views

The toString() method of the StringBuilder class reruns String value of the current object. To convert a StringBuilder to String value simple invoke the toString() method on it.Instantiate the StringBuilder class.Append data to it using the append() method.Convert the StringBuilder to string using the toString() method.ExampleIn the following Java program we are converting an array of Strings to a single String using the toString() method of the StringBuilder. Live Demopublic class StringToStringBuilder {    public static void main(String args[]) {       String strs[] = {"Arshad", "Althamas", "Johar", "Javed", "Raju", "Krishna" };       StringBuilder sb = new StringBuilder(); ... Read More

C# int.TryParse Method

karthikeya Boyini
Updated on 02-Sep-2023 14:17:10

76K+ Views

Convert a string representation of number to an integer, using the int.TryParse() method in C#. If the string cannot be converted, then the int.TryParse() method returns false i.e. a Boolean value.Let’s say you have a string representation of a number.string myStr = "12";Now to convert it to an integer, use the int.TryParse(). It will get converted and will return True.int.TryParse(myStr, out a);Example Live Demousing System.IO; using System; class Program {    static void Main() {       bool res;       int a;       string myStr = "12";       res = int.TryParse(myStr, out a);   ... Read More

Float and Double in C

karthikeya Boyini
Updated on 02-Sep-2023 14:14:10

56K+ Views

FloatFloat is a datatype which is used to represent the floating point numbers. It is a 32-bit IEEE 754 single precision floating point number (1-bit for the sign, 8-bit for exponent, 23*-bit for the value. It has 6 decimal digits of precision.Here is the syntax of float in C language, float variable_name;Here is an example of float in C language, Example Live Demo#include #include int main() {    float x = 10.327;    int y = 28;    printf("The float value : %f", x);    printf("The sum of float and int variable : %f", (x+y));    return 0; }OutputThe float value ... Read More

Adjust Width and Height of an iFrame to Fit Content in HTML

AmitDiwan
Updated on 02-Sep-2023 14:07:36

103K+ Views

We can adjust the width and height of an iframe by using CSS to set the dimensions. This can be done by setting the width and height properties to a specific value or to a percentage of the parent container. Additionally, we can use JavaScript to dynamically adjust the dimensions based on the content within the iframe. The term iframe is short for Inline frame. Here are the possible approaches − Using JavaScript You can use JavaScript to adjust the width and height of an iframe to fit its content. This can be done by getting the element of the ... Read More

Create Multi-line Text Input Text Area in HTML

Samual Sam
Updated on 02-Sep-2023 13:59:12

53K+ Views

To create a multi-line text input, use the HTML tag. You can set the size of a text area using the cols and rows attributes. It is used within a form, to allow users to input text over multiple rows.Here are the attributes of tag −AttributeValueDescriptionautofocusautofocusSpecifies that on page load the text area should automatically get focus.ColsnumberSpecifies the width of the textarea based on the number of visible character widths.DisableddisabledSpecifies the width of the textarea based on the number of visible character widths.formform_idSpecifies one or more forms.maxlengthnumberSpecifies the maximum number of characters in textarea.NametextAssigns a name to the ... Read More

C Program for FCFS Scheduling

Sunidhi Bansal
Updated on 02-Sep-2023 13:57:50

55K+ Views

We are given with the n number of processes i.e. P1, P2, P3, ..., Pn and their corresponding burst times. The task is to find the average waiting time and average turnaround time using FCFS CPU Scheduling algorithm.What is Waiting Time and Turnaround Time?Turnaround Time is the time interval between the submission of a process and its completion.Turnaround Time = completion of a process – submission of a processWaiting Time is the difference between turnaround time and burst timeWaiting Time = turnaround time – burst timeWhat is FCFS Scheduling?First Come, First Served (FCFS) also known as First In, First Out ... Read More

Sort Names in Alphabetical Order Using Structures in C

Bhanu Priya
Updated on 02-Sep-2023 13:54:56

5K+ Views

Structure is a collection of different datatype variables, grouped together under a single name.Features of structureThe features of structure in the C programming language are as follows −It is possible to copy the contents of all the structure elements of different datatypes to another structure variable of its type by using an assignment operator.For handling the complex datatypes, it is better to create structure within another structure, which is called nested structures.It is possible to pass an entire structure, individual elements of structure and an address of structure to a function.It is possible to create structure pointers.Declaration and initialization of ... Read More

Pass Arrays to Methods in Java

Samual Sam
Updated on 02-Sep-2023 13:52:53

65K+ Views

You can pass arrays to a method just like normal variables. When we pass an array to a method as an argument, actually the address of the array in the memory is passed (reference). Therefore, any changes to this array in the method will affect the array.Suppose we have two methods min() and max() which accepts an array and these methods calculates the minimum and maximum values of the given array respectively:Example Live Demoimport java.util.Scanner; public class ArraysToMethod {    public int max(int [] array) {       int max = 0;       for(int i=0; imax) { ... Read More

Advertisements