Author: Java2blog
04 DecemberGet Driver Versions in PowerShell
Using win32_PnpSignedDriver class of the WMI object To get driver versions in PowerShell, use win32_PnpSignedDriver class of the WMI object. Get-WmiObject Win32_PnPSignedDriver| select Devicename, Driverversion, Description After running the command, your PowerShell should give you an output something like this: Note how the columns are arranged as Device Name, Device Version, and Description. If you […]
04 DecemberRemove Empty Lines from File in PowerShell
We can do several file operations using the PowerShell console. For example, creating a file, removing a file, copying and moving a file, displaying file content, etc. While working with files, you may encounter a situation where you need to delete blank lines in a file. This tutorial will show you how to remove empty […]
04 DecemberFill Array with Random Numbers in JavaScript
Using Array.from() and Math.random() method To fill array with random numbers in JavaScript: Use Math.random() to get random numbers between 0 to 1. Use array.from() with length with desired length and mapping function as () => Math.random() * 20. This mapping function will be executed for every element in the array. Let’s say we want […]
04 DecemberExtract Numbers From String in PHP
Using filter_var() method We can use the filter_var() method which filters a variable based on supplied filter flag or ID. To extract numbers from the string variable, we can pass the FILTER_SANITIZE_NUMBER_INT id. Let’s see an example using this method.
04 DecemberConvert Pandas Dataframe Column to List
Use Series.values.tolist() Method To convert pandas dataframe column to list: Use pd.DataFrame() to read position_salaries as a pandas data frame. Use df["Position"] to get the column position from df Use position.values to get values of the position Use position_values.tolist() to get list of position_values as position_list import pandas as pd # Create a pandas data […]
04 DecemberCreate Array of Objects in PHP
An array can contain a sequence of elements of different data types. From strings to integers to floats to objects. In this post, we will discuss the different ways to how to create an array of objects in PHP. Using [] syntax We can use the short array syntax – [] – to create an […]
04 DecemberGet Parameters From URL String in PHP
Use parse_url() with parse_str() functions Use parse_url() with parse_str() to get parameters from URL String in PHP. The parse_url() function is used to return the components of a URL by parsing it and parse_str() is used to create an associate array of query parameters and their values.
02 DecemberPass Variable From PHP to JavaScript
Use echo method In order to pass variable from PHP to JavaScript, you will need to use the echo statement. This will print out the variable for you. For example, if you have a variable named $name, you would use the following code: Document This will output a piece of JavaScript code that looks like […]
02 DecemberRemove Quotes from String in PHP
1. Remove Quotes from String in Php 1.1 Using str_replace() Method Use the str_replace() function to remove quotes from String in PHP.