Question – How to remove extra spaces from a string using JavaScript? A space (” “) character is used to separate two words. Some times we get the extra spaces in a string, which may case issues with your application. JavaScript trim() function is used for removing leading (before) and trailing (after) spaces from a string. This tutorial will help you to remove extra spaces from a string using JavaScript function. Remove Spaces with JavaScript trim() Function For the example, assign a string with spaces to a variable. Then use JavaScript trim() function to remove leading and trailing spaces from…
Author: Rahul
phpMyAdmin is a popular tool used to manage MySQL databases through a web interface. However, allowing root login through phpMyAdmin can pose a security risk because it gives complete control over the database. Disabling root login in phpMyAdmin is a simple yet effective way to protect your system from unauthorized access. In this guide, we will walk you through easy steps to disable root login, making your phpMyAdmin setup more secure without affecting its functionality for other users. Disable root Login in phpMyAdmin First of all, find the phpMyAdmin directory location as per your installation. Generally, it is installed under…
The ASPState database is used by Microsoft’s ASP.NET Session State Service to store session data. By default, session state service stores its data in an in-memory cache. If you want to persist session data across multiple web servers in a web farm or you want to recover session data in case of application crashes or restarts, you should consider storing your session state in an ASPState database in SQL Server. Prerequisites A version of SQL Server (2008 or later). The ASP.NET Session State Service should be installed on your server. This service comes with ASP.NET and is installed automatically when…
We can use an internal field separator (IFS) variable to parse an array. Let’s use an example script, where first we define a string with colon-separated. Then we will use IFS to separate values based on a delimiter.
1 2 3 4 5 6 7 8 9 | #!/usr/bin/env bash STR="orange:grapes:banana:apple" #String with names IFS=';' read -ra NAMES <<< "$STR" #Convert string to array #Print all names from array for i in "${NAMES[@]}"; do echo $i done |
Let’s execute this script and check for results. ./myscript.sh Output: orange grapes banana apple
Command SNAME=$(basename “$(test -L “$0” && readlink “$0” || echo “$0″)”) While running a bash script using Linux terminal the script name can also passed as argument at $0. but if we are using full path of script to execute, it will show full path as results when print value of $0. So use above command will exactly provide only script name. It also handle if you are running any bash script using symbolic link. Example: Create a script named test.sh and add following content in script. #!/bin/bash SNAME=$(basename “$(test -L “$0” && readlink “$0” || echo “$0″)”) echo “Your…
MX records in DNS are used to route emails to correct mail servers and properly send to correct destination server. If you are using Google apps account for hosting email accounts on Google servers for your domains, then you need to add following MX records in your domains DNS configuration. Google Apps MX Records: @ IN MX 1 ASPMX.L.GOOGLE.COM @ IN MX 5 ALT1.ASPMX.L.GOOGLE.COM @ IN MX 5 ALT2.ASPMX.L.GOOGLE.COM @ IN MX 10 ALT3.ASPMX.L.GOOGLE.COM @ IN MX 10 ALT4.ASPMX.L.GOOGLE.COM
Generally Ubuntu users used Synaptic Package Manager for GUI and apt package manager for command line for installing packages. But not all latest application’s provides pre compiled packages for system, In that case you need to compile it using source code for installing application on your system. This article will help you for installing packages using source archive on Ubuntu systems. Prerequisites Before working with the compilation of source package, First we need to prepare our system with requirements for compilation. $ sudo apt-get install apt-file autoconf build-essential checkinstall Extract Source Package Firstly download the source archive on your system…
Command: md5sum myfile.php > myfile.php.md5 Above command will generate md5 checksum of file myfile.php and store in file myfile.php.md5. myfile.php.md5 can be used to verify integrity of file anytime. Generate MD5: If we want to generate md5sum of a file named index.php. Use the following command to do it and store generated md5 value of file in index.php.md5 file. # md5sum index.php > index.php.md5 Verify MD5: Now in future we can use index.php.md5 to verify integrity of file using following command. This command will show output as OK or FAILD. # md5sum -c index.php.md5
Linux, much like any other operating system, relies on processes for its operations. Occasionally, these processes may become unresponsive or consume excessive system resources, necessitating their termination. The following article presents a detailed guide on how to kill a process by its name in Linux, a crucial skill for Linux users and administrators alike. What is a Process? Before we dive in, it’s crucial to understand what a process is. A process, in the simplest terms, is an instance of a program in execution. Each process has a unique identifier called a Process ID (PID), which the operating system uses…
We can easily get values passed in url query string using JavaScript or jQuery. Here is an simple examples of getting query string values with JavaScript. To do this create a function like getParamValuesByName and add one of example codes given below. In the below examples function getParamValuesByName() will parse the query string values and returned matching values based on there named passed as parameter. Example 1: <script type=”text/javascript”> function getParamValuesByName (querystring) { var qstring = window.location.href.slice(window.location.href.indexOf(‘?’) + 1).split(‘&’); for (var i = 0; i < qstring.length; i++) { var urlparam = qstring[i].split('='); if (urlparam[0] == querystring) { return urlparam[1];…