How to count lines of code in IntelliJ IDEA?
There are several ways we can count lines of code in IntelliJ IDEA. One of the most common methods is to use the Statistic plugin.In this article, I will show you how to count lines of code using the Statistic plugin.First, we need to install it from Intellij IDEA: Open IntelliJ IDEA editor; Select File > Settings, Open Settings Popup Window; Select Plugins, then type “Statistic” to search plugins; Click on the Statistic install button; Click on the Apply button and close the...
Include Files in Bash
Just like other programming languages that allow you to include files, Bash scripting also enables you to include (or source) another shell script within your script. This practice is a powerful way to modularize your code and reuse functions, variables, and configurations. It helps keep your scripts organized, readable, and maintainable. For instance, to include a script named filename.sh in your current script, you can use the following syntax, assuming that filename.sh is in the same...
Case Statement in Bash
Are you looking to streamline your Bash scripts and make them more efficient? Look no further than the powerful switch (case) statement! In this blog post, we’ll dive deep into how to use this versatile control structure in Bash scripting. What is a Switch (Case) Statement?The switch statement, known as the “case” statement in Bash, allows you to compare a given value against multiple patterns and execute different code blocks based on which pattern matches. It’s an excellent alternative to...
Until Loop in Bash
An until loop in Bash is similar to a while loop, but it works in the opposite way. It repeatedly executes a block of commands until a specified condition becomes true. In other words, the loop continues as long as the condition is false and stops when the condition becomes true. Basic SyntaxThe basic syntax of an until loop in Bash is:1234until [ CONDITION ]do # Commands to be executeddone CONDITION is an expression that is checked before each iteration of the loop. If the condition is...
While Loop in Bash
A while loop in Bash is another control structure that repeatedly executes a block of commands as long as a specified condition is true. It’s particularly useful when you don’t know in advance how many times you need to loop, as the loop will continue until the condition is no longer met. Basic SyntaxThe basic syntax of a while loop in Bash is:1234while [ CONDITION ]do # Commands to be executeddone CONDITION is a test or expression that is checked before each iteration of the loop. If...
For Loop in Bash
A for loop in Bash is a control structure that allows you to repeat a set of commands for each item in a list, over a range, or based on other criteria. It’s commonly used for tasks like iterating over files in a directory, processing elements in an array, or executing a block of code multiple times. Basic SyntaxThe basic syntax of a for loop in Bash is as follows:1234for VARIABLE in LISTdo # Commands to be executeddone VARIABLE is a placeholder that takes the value of each item in LIST...
Conditional Statements in Bash
In this article, we’ll explore the various types of conditional statements in Bash and how to use them effectively. If StatementThe most basic conditional statement is the if statement. It allows you to execute code blocks based on whether a condition is true or false.Basic Syntax:123if [ condition ]; then # commands if condition is truefiExample:1234567#!/bin/bashage=25if [ $age -ge 18 ]; then echo "You are an adult."fi If-Else StatementThe if-else statement allows you to...
Quotes and Basic Escape Characters in Bash
In Bash, quotes are used to handle special characters, manage spaces, and control how strings are interpreted. There are three primary types of quotes in Bash: Single Quotes (')Single quotes are used to preserve the literal value of each character within the quotes. No variable substitution or command substitution occurs within single quotes.Example:1echo 'This is a string with a $variable and a `command`'Output:1This is a string with a $variable and a `command`In this example,...
Comments in Bash
Comments in Bash scripts are used to annotate and explain the code. They help make the script more understandable and maintainable. In Bash, there are several ways to include comments: Single-Line CommentsSingle-line comments in Bash begin with a # character. Everything on the line after the # is considered a comment and is ignored by the Bash interpreter.1234#!/bin/bash# This is a single-line commentecho "Hello, World!" # This is also a comment Note: The top line of the script,...
Variables in Bash
In Bash scripting, variables are used to store data that can be used later in the script. Here’s a quick overview of how to work with variables in Bash: Defining VariablesVariables in Bash are defined by assigning a value to a name, with no spaces around the = sign:1variable_name=valueFor example:12name="Johnson"age=28 Note that there should be no spaces between the variable name and the equals sign, which might differ from what you’re used to in other programming languages....
Your First Bash Script
Bash, which stands for Bourne Again SHell, is a widely used command-line interpreter and scripting language that was originally developed by Brian Fox for the GNU Project as a free replacement for the Bourne shell (sh). Bash combines the features of the Bourne shell with many enhancements and new features, making it a powerful and flexible tool for users and system administrators. Before you start your first script, you need to understand the shebang(#!) character. What does #! Mean?The #!...
Introduction to Bash
Bash, short for “Bourne Again Shell,” is a command-line interface for Unix and Linux systems and is the default shell for most Linux distributions. What is a Shell?Before diving into Bash, it’s important to understand what a shell is. The term “shell” originally means “outer layer,” representing the interface between the user and the kernel. It provides a command-line environment where users interact with the operating system.In essence, a shell has several meanings: Program: The shell is a...
HTML Editors
Recommended HTML EditorsFor editing HTML, using a professional HTML editor can be very helpful. Here are a few commonly recommended editors: VS Code: https://code.visualstudio.com/ Sublime Text: http://www.sublimetext.com/ You can download the software from their official websites and follow the installation instructions. Next, we’ll demonstrate how to use VS Code to create an HTML file. Visual Studio CodeVisual Studio Code (VS Code) is a code editor developed by Microsoft. It is...
HTML Instant Tutorial
HTML is the foundation of web development. This tutorial provides a comprehensive introduction to HTML, serving both as an entry-level guide for beginners and a reference manual for looking up syntax. Table of Content Introduction to HTML Introduction to HTML URL HTML Element Attributes Understanding Text Encoding and Character Representation in HTML HTML Semantic Tags HTML Text HTML List HTML Image HTML \ Tag HTML \ Tag The \ and \ Tags HTML Multimedia HTML iframe HTML Table HTML Form HTML...
HTML Elements
This chapter introduces some recently adopted standard tags. <dialog>Basic UsageThe <dialog> tag represents a dialog box that can be closed. 123<dialog> Hello world</dialog> The above code shows a simple dialog box. By default, the dialog is hidden and does not display on the webpage. To make the dialog visible, you must add the open attribute. 123<dialog open> Hello world</dialog> The above code will display a box on the webpage with the content “Hello...
HTML Form
A form is a way for users to input information and interact with a webpage. In most cases, the information submitted by users is sent to the server. For example, a website’s search bar is a type of form. A form consists of one or more elements, such as text fields, buttons, radio buttons, or checkboxes. These elements are known as controls. <form>IntroductionThe <form> tag is used to define a form, which acts as a container for all the form elements. 123<form> <!--...
HTML Table
A Table displays data in rows and columns. <table>, <caption>The <table> tag is a block-level container that must enclose all the table content. 123<table> ... ...</table> The <caption>, which is always the first child element of <table>, provides the table’s title. This element is optional. 123<table> <caption>Example Table</caption></table> <thead>, <tbody>, and <tfoot>The <thead>, <tbody>,...
HTML iframe
The <iframe> tag is used to embed other web pages within the current webpage. Basic UsageThe <iframe> tag creates a specified area to display another web page. It acts as a container element. If the browser does not support <iframe>, it will show the nested content. 12345<iframe src="https://www.example.com" width="100%" height="500" frameborder="0" allowfullscreen sandbox> <p><a...
HTML Multimedia
Webpages can include not only images but also videos and audio. <video>The <video> tag is a block-level element used for embedding video. If the browser supports the video format, it displays a player; otherwise, it shows the content inside the <video> tag. Here’s an example code snippet: 123<video src="example.mp4" controls> <p>Your browser does not support HTML5 video. Please download the <a href="example.mp4">video...
The <script> and <noscript> Tags
The <script> tag is used to embed scripts, typically JavaScript, into a web page. The <noscript> tag specifies content to be displayed when a browser doesn’t support scripting or has it disabled. Using <script>The <script> tag is primarily used to load JavaScript code: 123<script>console.log('hello world');</script> This code will execute immediately when embedded in a webpage. Loading External Scripts: You can also use <script> to load...