execl is one of the families of exec calls that act as a front end to the execve. The following screenshot refers to man execl: The arguments for these seven exec functions are difficult to remember. The letters in the function names help somewhat. The letter p means that the function takes a filename argument […]
Archives for April 2022
lsinitramfs: Listing the contents of the initrd file system.
initrd and initramfs The kernel binary executable is typically called vmlinuz9 and is usually found in the /boot/ directory. It may also be a symlink to a filename with version information (for example, vmlinuz-5.4.0-21-generic). You will typically find a companion file called initrd or initramfs (sometimes with the *.img extension). These files may also be […]
ValueError: Masked arrays must be 1-D
Scatter plot is a basic plot of dots. You can draw it by calling plt.scatter(x,y). The following example shows a scatter plot of random dots: import numpy as np import matplotlib.pyplot as plt # Set the random seed for NumPy function to keep the results reproducible np.random.seed(42) # Generate a 2 by 100 NumPy Array […]
Example of using getnstimeofday in Linux kernel
getnstimeofday is a front-end for __get_realtime_clock_ts but also works if no high-resolution clocks are available in the system. In this case, getnstimeofday as defined in kernel/time.c (instead of kernel/time/timekeeping.c) is used to provide a timespec that fulfills only low-resolution requirements. The linux kernel provides a number of interfaces to manage time. getnstimeofday is one of […]
keytool error java.io.FileNotFoundException: (Access is denied)
keytool manages and manipulates a keystore, a repository for public and private keys and public key certificates. keytool defines various commands for generating keys, importing data into the keystore, and exporting and displaying keystore data. Keys and certificates are stored in a keystore using a case-insensitive name or alias. keytool uses this alias to refer […]
How to view file size/details from ls command in Unix
The ls command at its most basic form displays the files and directories located in your current directory: $ ls Desktop Downloads my_script Public test_file Documents Music Pictures Templates Videos $ I always find it difficult to digest the filesize from the ‘ls -al’ command. For instance, after ls -al, the output gives me filesize […]
PHP Function strchr() – Alias of strstr()
The strchr() function is used to find the first appearance of a string inside another string. It is the pseudonym of the strstr() function. This function was introduced in PHP3. Syntax: strchr(string $haystack, string $needle, bool $before_needle = false): string|false For instance: $record = “Fred,Flintstone,35,Wilma”; $rest = strchr($record, “,”); // $rest is “,Flintstone,35,Wilma” The variations […]
PHP function strcasecmp() – Binary safe case-insensitive string comparison
The strcasecmp() function is used to compare two case-sensitive strings. This is a case-insensitive version of the strcmp(). This function was introduced in PHP3. The function returns a number less than 0 if one is less than two, 0 if the two strings are equal, and a number greater than 0 if one is greater […]
PHP Function str_word_count() – Return information about words used in a string
The str_word_count() function is used to count the number of words in a string. This function was introduced in PHP4. The value of format dictates the returned value: value returned value 0 (default) The number of words found in string 1 An array of all words found in string 2 An associative array, with keys […]
PHP Function str_split() – Convert a string to an array
The str_split() function is used to split a string into an array. This function was introduced in PHP5. The function splits the string into an array of characters, each containing length characters; if the length is not specified, it defaults to 1. Syntax: str_split(string $string, int $length = 1): array Parameters Parameter Description string The […]