Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Blog Directory  >  Education Blogs  >  Study Guides Blogs  >  How To Learn Java Programming study-guides Blog  > 

How To Learn Java Programming Blog


java2blog.com
Java2blog provides a tutorial on Vore Java, Hibernate, Struts, Webservices, Angular Js, etc. It also covers important interview questions with answers on Every topic of Java.
2023-11-26 10:54
1. Overview Searching for strings in text files is a common task in bash, used in scenarios like log file analysis and configuration file searches. This article explores various methods to c… Read More
Get Proxy Settings In PowerShell
2023-08-20 10:24
Using netsh Command netsh winhttp show proxy Current WinHTTP proxy settings: Proxy Server(s) : 10.0.0.21:8080 Bypass List : (none) On Windows machines, the above command is usefu… Read More
2023-08-20 10:04
We can have multiple use cases for getting memory usage percentages. For example: Getting overall memory usage percentage Getting overall memory usage percentage history Getting memory usag… Read More
2023-08-20 09:07
Using ConvertFrom-Json Cmdlet We can use the ConvertFrom-Json cmdlet to traverse the JSON file with first and nested-level keys; Let’s explore them below. Traverse JSON File Containing… Read More
2023-08-20 08:56
Using Get-History Cmdlet Using Get-History to get the complete history of the executed commands in PowerShell. Get-History Id CommandLine -- ----------- 1 Get-History 2 ls 3 ping… Read More
2023-08-20 08:44
Using grep Command Use grep with the -q option to check if output contains String in Bash. #!/bin/bash output=$(ls -l) search_string=".csv" # String to search for in the output if echo "$ou… Read More
2023-08-15 19:04
Using Get-ADUser Cmdlet Use the Get-ADUser cmdlet to get the password expiration date for one specific user in an Active Directory. Get-ADUser -Identity Administrator –Properties "Sam… Read More
2023-04-16 13:40
One of the everyday tasks is converting an array to an ArrayList in PowerShell. It can be helpful when you need to work with dynamic data structures or manipulate data in memory. However, be… Read More
2023-04-16 10:35
Using read Command Use the read command with parameter expansion to split the string and get the last element in Bash. #!/bin/bash myString="Hello:World:How:are:you?" read lastElement The… Read More
2023-04-16 10:18
Using Test-Connection Cmdlet To check if URL is reachable in PowerShell: Convert url to System.url object and get host property using Select-Object cmdlet. Use Test-Connection cmd to check i… Read More
2023-04-16 06:43
Using Regular Expressions In PowerShell, various ways exist to create regular expressions to get numbers from a string. For this article, we will learn the [regex] type accelerator and the [… Read More
2023-04-16 06:30
Using System.Text.Encoding Class The System.Text.Encoding class converts the specified string to a byte array in PowerShell. This class can use a particular, default, or custom encoding form… Read More
2023-04-16 05:30
One of the common tasks in Bash is to manipulate text files. One such assignment is to finish each file’s line with a comma. Before we start adding commas to the end of each line of a… Read More
2023-04-16 05:22
Using printf Command Use the printf command with %.2f format to round off to 2 decimal places in Bash. rounded_number=$(printf "%.2f" 1.855678) echo $rounded_number 1.86 The explanation of… Read More
2023-04-16 05:00
Using Redirect Operator To log the output of a bash command to a file, use the redirect operator. There are two types of redirect Operator: > (Standard Output Redirect Operator): It red… Read More
2023-04-15 19:23
Using Parameter Expansion Use the parameter expansion with regex to remove the special characters from a string in Bash. #!/bin/bash string="Hello World! This is a test string." new_string=… Read More
2023-04-15 19:06
When working with shell scripts, it’s common to need to get the absolute path of a file or directory from its relative path. However, before we dive into how to get the absolute path f… Read More
2023-04-15 19:01
Using sed Command: Use the sed command to remove specific character or substring from String in Bash. #!/bin/bash org_string="hello world" new_string=$(echo "$org_string"| sed 's/o//g') ech… Read More
2023-04-15 15:29
Using tr Command Use the tr command with -d option to remove double quotes from String in Bash. #!/bin/bash org_string='Hello! This is a "quoted" string' new_string=$(echo "$org_string" | t… Read More
2023-04-15 07:08
Using Parameter Expansion We can use parameter expansion in different ways in various situations. For example, we can use it to replace the following: The first or all occurrences of the giv… Read More
2023-04-15 06:15
Python has a name error when you try to use a variable or function that is not defined currently. It means that Python has no idea where to locate the requests module or library you are tryi… Read More
2023-04-14 19:11
The representation of data in Hexadecimal is commonly used in computer programming. It is used to represent binary data in a human-readable form, as understanding the machine language (i.e… Read More
2023-04-14 16:46
Using Microsoft Word COM Object To convert the given Microsoft Word document to PDF: Create a COM object using the New-Object cmdlet. Use the Open() method to open the MS Word file. Use the… Read More
2023-04-14 14:13
Using Select-String Cmdlet Use the Select-String cmdlet to check if the specified file contains the given string in PowerShell. $path = "E:\Test\file1.txt" $string = "customers" $result = Se… Read More
2023-04-14 12:45
To use any of the following ways, you must know how to create and run the batch files and PowerShell script files. For this article, we have prepared the following PowerShell script and save… Read More
2023-04-14 12:36
Using >&2 Operator Use the >&2 operator to redirect the echo output to stderr in bash. echo "This is an Error message." >&2 This is an Error message. As shown above, an… Read More
2023-04-14 07:07
Python is a high-level language famous for its simplicity, flexibility, and readability. At the same time, Bash is a Unix shell and command language used primarily on Unix and Linux systems… Read More
2023-04-14 06:16
Before moving towards various solutions to convert the Epoch time to Datetime, it is essential to know the Epoch time. Epoch time, POSIX time or Unix time is the system for denoting a point… Read More
2023-04-14 05:51
TL;DR Use the ToString() method on System.Guid to convert a GUID to a string in PowerShell. $guid = [System.Guid]::NewGuid() $guidString = $guid.ToString() Write-Host $guid.GetType() - $gui… Read More
2023-04-09 19:05
Using [System.Guid] Class To generate a random string in PowerShell: Create a globally unique identifier using the NewGuid() method. Use the ToString() method to transform the GUID (created… Read More
2023-04-09 18:39
Using Mandatory Attribute Use the Mandatory attribute to make parameters mandatory in PowerShell. function DisplayName { param( [Parameter(Mandatory=$true)] [string]$Name… Read More
2023-04-09 18:09
Using Get-Date Command with AddDays() method Use the Get -Date command with AddDays() method to get yesterday’s date in PowerShell. Pass -1 to AddDays() to substract one day from curre… Read More
2023-04-06 19:42
Get Full Path of File in PowerShell To get full path of file in powershell: Go to folder where file is present. You can go to any parent folder as well. Use Get-ChildItem with -Recurse optio… Read More
2023-04-05 07:25
Split Path into Array in PowerShell Using Split() Method Use the Split() method to split the path into an array in PowerShell. $path = "C:\Users\John\Desktop\Samples\House_Prediction_Using_T… Read More
2023-04-05 06:57
Using printf Command Use the printf command to convert float to integer in bash. float_num=3.14 int_num=$(printf "%.0f" "$float_num") echo "$int_num" 3 First, the float_num variable is initi… Read More
2023-04-04 17:24
Using eval Command Use the eval command to run a string as a command in Bash eval "echo Hello, world!" Hello, world! In the above code, the eval command evaluates and executes the arguments… Read More
2023-03-29 10:39
Using Set-Location Cmdlet Use the Set-Location cmdlet to change directory in PowerShell. Set-Location -Path D:\ PS D:\> Above, we have used the Set-Location cmdlet to change the director… Read More
2023-03-29 10:18
An array is a collection of data elements stored together under a single variable name. Unlike other programming languages, the array in PowerShell contains the values of the same or differe… Read More
2023-03-29 09:54
Using BASH_SOURCE Array To get the current script’s directory in a Bash, use the BASH_SOURCE array with pwd command. DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&a&hell…Read More
2023-03-28 12:57
We can use different solutions to get the exit code of the last command in PowerShell, but before that, it is essential to know what does exit command means. The exit command terminates the… Read More
2023-03-27 18:21
Using $RANDOM Variable Use the $RANDOM variable with cut command to generate random string in Bash. random_string=$(printf '%s' $(echo "$RANDOM" | md5sum) | cut -c 1-10) echo $random_string… Read More
2023-03-19 11:02
Using Get-Content Cmdlet We can use multiple ways to split the specified text file into an array based on every new line. To practice those methods and commands, we will use the file.txt fil… Read More
2023-03-19 10:17
Print Object’s Properties in Powershell In PowerShell, an object is a data structure that contains properties and methods. An object is essentially an instance of a .NET class and can… Read More
2023-03-17 07:36
Outline You can use time.sleep() method to sleep for milliseconds in Python. If you want to delay python program by 500 ms, then you need to pass 0.5 as parameter to sleep method.import tim… Read More
2023-03-14 18:42
Find String in File in PowerShell Use the Select-String cmdlet to find string in file in PowerShell. Select-String cmdlet uses regular expression to find patterns in Strings or Files. Select… Read More
2023-03-12 19:18
Creating an Empty Array in Python Before moving towards various solutions for creating an empty array in Python, we must understand what an empty array means. It means a collection of items… Read More
Wait For Command To Finish In PowerShell
2023-03-12 19:03
Using Start-Process Cmdlet Use Start-Process with the -Wait parameter to wait for the command to finish. Start-Process explorer -Wait OUTPUT: In the above output, we can see that the comman… Read More
2023-03-12 18:38
Using Invoke-WebRequest Cmdlet Use the Invoke-WebRequest cmdlet to download the specified file from the specified URL to the local path in your machine. $URL = "https://github.com/PowerShell… Read More
2023-03-11 09:36
Using $# Variable Use the $# variable to check the number of arguments in the bash script. $# variables denotes number of arguments passed to Bash script. #!/bin/bash echo Script name: $0 ec… Read More
2023-03-08 10:37
Using the return Keyword PowerShell allows us to use the return keyword to return single or multiple values from a function. Let’s learn both of the scenarios. Use the return Keyword t… Read More
2023-03-08 09:43
Read File without NewLine in Python In Python, there are multiple ways to read a file without new lines, but before diving into those methods, let’s look at the .txt file we will use f… Read More
2023-03-08 09:29
Using Dynamic Casting Use dynamic casting to convert the given string to int in PowerShell. $string = "456" $number = [int]$string $number $number.GetType().Name 456 Int32 First, we created… Read More
2023-03-07 13:27
Use command Command Use command to check if the specified bash command exists. if command -v curl > /dev/null; then echo "curl command exists." else echo "curl command does not ex… Read More
2023-03-07 13:15
Using the sep Parameter Use the sep parameter to print without space in Python. print("How", "are", "you?", sep='') Howareyou? Python’s print() method displays a specified message or v… Read More
2023-03-07 12:47
TL;DR If you know extension of the file, you can use basename command and pass filename and extension as parameters to retrieve filename without extension in bash. This is useful when you h… Read More
2023-03-07 11:33
Using echo with grep Command To check if a Bash array contains a value, use the echo command and pipe it to grep command to search the value from the defined array. #!/bin/bash #declare an… Read More
2023-03-07 09:16
Comparing Strings in Batch File Batch files are a powerful tool for automating tasks in Windows systems. One common operation performed in batch files is string comparison. String comparison… Read More
2023-03-06 11:25
Using the not Keyword Use the not keyword to check if the given variable is empty in Python. name = None if not name: print('Variable is empty.') else: print('Variable is not empty.'… Read More
2023-02-28 13:25
Checking If Variable Is Empty in Bash There are multiple ways to check if a variable is empty or not. Before moving towards those methods, knowing when a variable is called empty is necessar… Read More
2023-02-28 08:05
Using for Loop To convert the entire list into one integer in Python: Create a list having integer-type elements. Declare and initialize a variable with 0; it will be used to hold the final… Read More
Print Blank Line In PowerShell
2023-02-20 07:48
Print Blank Line in PowerShell We have two string-type messages that we want to print on the PowerShell console, but in between, we also want to have a blank line to increase the readability… Read More
2023-02-20 07:24
Using List slicing Use list slicing to get first n elements of List in Python. Here’s an example: my_list = [10, 20, 30, 40, 50, 60] n = 4 first_n_elements = my_list[:n] print(first_n_… Read More
2023-02-18 19:21
Meaning of the echo $1 in Bash The echo $1 is a bash command; now, those new to Bash can think of it as a famous shell and scripting language in Unix-based operating systems. Using Bash, we… Read More
2023-02-18 19:18
Using tr Command Use the tr command to remove the new line from a string. The tr command is used for character translation or deletion. echo "Hello World" | tr -d '\n' HelloWorld In the abo… Read More
2023-02-16 09:31
Using for Loop with seq Command To loop from 1 to 10 in the Bash shell: Use the for keyword to start the for loop. Use i as a loop variable, which is accountable for taking values from 1 to… Read More
2023-02-16 09:24
What information do we collect? On this website, you are required to : enter your email address to get the latest updates from this blog directly into your email box for free enter your name… Read More
2023-02-14 14:20
Running from PowerShell Command-Line To run a PowerShell script(.ps1 file) from a PowerShell command line: Launch the PowerShell as an Administrator and wait for the PS> prompt to appear… Read More
2023-02-14 14:04
Windows Environmental Variables and Their Scope There are three different scopes for environment variables in Windows. Set the Session Environment Variable Set an Environment Variable for a… Read More
2023-02-01 18:41
Creating an Array of HashTables To create an array of hashtables in PowerShell: Create an array. Create two or more hash tables. Use += operator to add the hash tables (created in the second… Read More
2023-02-01 13:28
Using Add-Content Cmdlet Use the Add-Content cmdlet to write binary files in PowerShell. $binaryData = [Byte[]] (0x01, 0x02, 0x03, 0x04) Add-Content -Path ".\test.bin" -Value $binaryData -En… Read More
2023-02-01 13:10
Using Percent (%) in Different Contexts Typically the % character is for mod functionality. But in PowerShell, it’s an alias for ForEach-Objectand can be also used as Modulus Operator… Read More
2023-01-27 18:57
Using the Import-Csv Cmdlet To read a CSV file in PowerShell, use the Import-Csv cmdlet. $csvFile = "d:\data.csv" Import-Csv -Path $csvFile Country Age Salary Purchased ------- --- ------ … Read More
2023-01-27 18:23
Using the Get-Content Cmdlet We can use the Get-Content cmdlet to read the contents of a file into a string. Use the Get-Content Cmdlet to Read a Single File To read a single file into a str… Read More
2023-01-26 18:46
Using PSObject.Properties.Remove() Method To delete a property from an object in PowerShell, Use the New-Object cmdlet to create an object. Use the PSObject.Properties.Remove() method to rem… Read More
2023-01-26 18:15
Using the if-else Statement We can use the if-else statement to create a file as follows: Use the New-Item Cmdlet To create a file if it does not exist in PowerShell: Use the Test-Path cmdle… Read More
2023-01-26 18:03
Using Built-in Cmdlets and Methods We can use built-in cmdlets and methods to check if a directory exists. Use the Test-Path Cmdlet To check if a folder exists, use the Test-Path cmdlet. $pa… Read More
2022-12-31 19:01
Count Files in Folders in PowerShell We can use the Measure-Object cmdlet in different ways to meet our project requirements. However, before moving forward, it is essential to know how many… Read More
2022-12-31 17:58
Using the -match Parameter Use the -match parameter to check if an object has a property in PowerShell. $greetings = "Hi" $name = "Java2blog" $props = $([ordered]@{ greetings=$greetings… Read More

Share the post

How To Learn Java Programming

×

Subscribe to How To Learn Java Programming

Get updates delivered right to your inbox!

Thank you for your subscription

×