Home » 2022 » June

How to Install and Use Netstat on Linux (CentOS/RHEL, Debian/Ubuntu, OpenSuse & Arch Linux)

How to Install and Use Netstat on Linux

This article provides a tutorial on how to install and use Netstat, a command-line network tool, on Linux. Netstat is a command-line utility that can be used to view network connections, routing tables, and a variety of other network-related information on Linux systems. While Netstat is typically used to troubleshoot network issues, it can also be used for tasks such as monitoring server traffic or checking which ports are open on a system. Why Use Netstat? Netstat is a network monitoring tool that can be … Read more

Home » 2022 » June

Converting String to Boolean in JavaScript, With Examples

This tutorial will show you how to convert a string value to boolean in JavaScript, with working code examples for several situations. Why Are You Converting Strings to Booleans? Really, you should not be storing boolean data in a string, but there are several scenarios where it can arise: Boolean values arising from user input Values taken from HTML form elements, which can only contain string values Data taken from poorly formatted third party sources, like APIs or CSV files Once you have data containing … Read more

Home » 2022 » June

Using the JavaScript toUpperCase() String Method [Examples]

This article shows how the toUpperCase() method is used in JavaScript to make all letters in a string UPPER CASE. The toUpperCase() method is included in the string object and is fully supported in all browsers. In the JavaScript programming language, strings can either be a primitive or an object – primitives are the most basic kinds of variables – they have no methods, and simply represent the raw data for the given characters. String objects, however, have additional methods for manipulating and measuring the string – the toUpperCase() is one of these helpful methods. String variables in … Read more

Home » 2022 » June

Linux Tip: Using visudo to Avoid Costly Mistakes

Linux Tip: Use visudo to Edit the sudoers File to Avoid Costly Mistakes This article will show you how to use visudo to edit the sudoers file to grant root access to users – and protect against making mistakes that could lock you out of your Linux system forever. What is the sudoers File? The sudoers file defines which users have access to the sudo command on Linux systems. The file is located at: /etc/sudoers …and it looks like this: # # This file MUST be edited with the ‘visudo’ command as root. # # … Read more

Home » 2022 » June

How to Create and Use JavaScript Classes [Examples]

This tutorial will explain JavaScript classes and how they relate to objects. Syntax and code examples are provided. But first, a quick refresher on JavaScript objects. JavaScript Objects In JavaScript, objects are a container for a set of properties and methods. A car, for example, could be modelled as an object. It could have properties describing the manufacturer, year it was made, and the colour. Methods are functions which are part of the object, which when called, interact with the object in some way. A car might have a honk method which triggers an alert, … Read more

Home » 2022 » June

How to Check if a Variable is a String in JavaScript

This quick tip will show you how to check if a variable is a string in the JavaScript Programming Language. What is a String? A string is a type of variable. A variable type determines what values a variable can contain and what can be done with the variable. Strings are a series of characters – letters or numbers or symbols. They can be joined, split, and iterated over. Strings are used to store words, sentences, and other non-numeric data like encoded images or serialized data which is going … Read more

Home » 2022 » June

JavaScript Functions Tutorial, With Examples

Functions are reusable bits of code which are encapsulated so that you can easily call them by name when you need them. Here’s how they work in JavaScript, with examples. What are Functions? When programming, you will need to perform the same set of actions multiple times on different data. For example, you may need to perform a calculation on all of the rows in a table, or update the values in a list of objects. It is not wise, or practical, to re-write the same … Read more

Home » 2022 » June

Current Time in Another Location/Timezone [JavaScript]

This article will demonstrate how to get the current time in another location/timezone in Javascript, with just one line of code. The Simplest Pure-JavaScript Way The below function converts a given date to a different timezone, and contains just 1 line of code. function timezoneConvert(date, tzString) { return new Date((typeof date === “string” ? new Date(date) : date).toLocaleString(“en-US”, {timeZone: tzString})); } This function expects: A date, as either a Date object or string A string containing the name of the timezone to convert to This … Read more

Exit mobile version