• NameError name requests is not defined
    15 April

    NameError: Name requests Is Not Defined

    Python has a name error when you try to use a variable or function that is not defined currently. It means that Python has no idea where to locate the requests module or library you are trying to use in your code when you receive the nameError: name 'requests' is not defined error. There are […]

  • Python hex to String
    15 April

    Convert Hex to String in Python

    1. Introduction The representation of data in Hexadecimal is commonly used in computer programming. It is used to represent binary data in a human-readable form, as understanding the machine language (i.e., Binary) is difficult for humans. Hexadecimal notation is used in networking protocols, e.g., IPv6 and cryptography, and widely used in graphics, e.g. to represent […]

  • PowerShell get ad user account expiration date
    15 April

    PowerShell Get Ad User Account Expiration Date

    Using Get-AdUser Cmdlet with Select-object cmtlet Use the Get-AdUser with Select-object to get the ad user account expiration date in PowerShell. Get-ADUser -Identity "JohnDoe" -Properties AccountExpirationDate | Select-Object AccountExpirationDate AccountExpirationDate --------------------- 7/1/2022 12:00:00 AM Here, the PowerShell cmdlet Get-ADUser was used to retrieve the information about the users of the Active Directory as it is […]

  • Powershell convert word to PDF
    14 April

    PowerShell Convert Word to PDF

    Using Microsoft Word COM Object To convert the given Microsoft Word document to PDF: Create a COM object using the New-Object cmdlet. Use the Open() method to open the MS Word file. Use the SaveAs() method to save the PDF file. Use the Close() method to close the Word document. Use the Quit() method to […]

  • PowerShell check if file contains string
    14 April

    PowerShell Check If File Contains String

    Using Select-String Cmdlet Use the Select-String cmdlet to check if the specified file contains the given string in PowerShell. $path = "E:\Test\file1.txt" $string = "customers" $result = Select-String $path -Pattern $string if ($result -ne $null) { Write-Host "The specified text file contains the string '$string'." } else { Write-Host "The specified text file does not […]

  • Batch get script directory
    14 April

    Batch Get Script Directory

    To use any of the following ways, you must know how to create and run the batch files and PowerShell script files. For this article, we have prepared the following PowerShell script and saved it in the testPS.ps1 file to run batch file: Write-Host "Running the Batch Script Now..." & E:\Test\test.bat Remember, you may have […]

  • Bash echo to stderr
    14 April

    Bash Echo to stderr

    Using >&2 Operator Use the >&2 operator to redirect the echo output to stderr in bash. echo "This is an Error message." >&2 This is an Error message. As shown above, an error message is an output to the stderr stream using the echo command with the >&2 operator. Here, stderr stands for standard error. […]

  • NameError: name xrange is not defined in Python
    14 April

    NameError: Name xrange Is Not Defined in Python

    This NameError: Name 'xrange' Is Not Defined in Python is one of the errors which can occur while using Python. Our objective is to identify the underlying cause of the error and then provide ways to resolve it. Using xrange() Method to Reproduce NameError Use the xrange() method to reproduce NameError in Python 3.x. for […]

  • Call Python script from bash with arguments
    14 April

    Call Python Script from Bash with Arguments

    Python is a high-level language famous for its simplicity, flexibility, and readability. At the same time, Bash is a Unix shell and command language used primarily on Unix and Linux systems. Data analysis, machine learning, web development, and scientific computing tasks are widely performed using python language. On the contrary, the bash is used for […]

Subscribe to our newletter

Get quality tutorials to your inbox. Subscribe now.