cURL Context Options in PHP

Syed Javed
Updated on 13-Nov-2020 12:18:12

448 Views

IntroductionCURL context options are available when the CURL extension was compiled using the --with-curlwrappers configure option. Given below is list of CURL wrapper context optionsMethodDescriptionmethodHTTP method supported by the remote server. Defaults to GET.headerAdditional headers to be sent during requestuser_agentValue to send with User-Agent: header.contentAdditional data to be sent after the headers. This option is not used for GET or HEAD requests.proxyURI specifying address of proxy server.max_redirectsThe max number of redirects to follow. Defaults to 20.curl_verify_ssl_hostVerify the host. Defaults to FALSE. available for both http and ftp protocol wrappers.curl_verify_ssl_peerRequire verification of SSL certificate used. Defaults to FALSE. available for both ... Read More

Moving Stones Until Consecutive II in C++

Arnab Chakraborty
Updated on 13-Nov-2020 12:05:38

242 Views

Suppose we are considering an infinite number line, here the position of the i−th stone is given by array stones and stones[i] is indicating ith stone position. A stone is an endpoint stone if it has the smallest or largest position. Now in each turn, we pick up an endpoint stone and move it to an unoccupied position so that it is no longer an endpoint stone.If the stones are at say, stones = [1, 2, 5], we cannot move the endpoint stone at position 5, because moving it to any position (such as 0, or 3) will still keep ... Read More

Maximum Sum of Two Non-Overlapping Subarrays in C++

Arnab Chakraborty
Updated on 13-Nov-2020 11:45:44

248 Views

Suppose we have an array A of integers; we have to find the maximum sum of elements in two non−overlapping subarrays. The lengths of these subarrays are L and M.So more precisely we can say that, we have to find the largest V for whichV = (A[i] + A[i+1] + ... + A[i+L-1]) + (A[j] + A[j+1] + ... + A[j+M-1]) and either −0 = 0, decrease i by 1, decrease j by 1, do −rightL[i + 1] := max of temp and x where x is 0 if i + 2 >= n otherwise x = rightL[i + 2]temp ... Read More

Where PowerShell Modules Are Stored

Chirag Nagrekar
Updated on 11-Nov-2020 13:07:57

39K+ Views

PowerShell modules are stored in their module path. Module paths can be retrieved using an environmental variable $env:PSModulePath. To get a better view, we will split the variable path with a semicolon.$env:PSModulePath -split ';' C:\Users\Administrator\Documents\WindowsPowerShell\Modules C:\Program Files\WindowsPowerShell\Modules C:\Windows\system32\WindowsPowerShell\v1.0\ModulesYou can see the 3 paths above. Each path has Modules stored as per their scopes.Documents Path: Modules are stored in this path when you provide the scope – CurrentUser while installing the module.Program files path: Modules are stored in this path when AllUsers Scope is provided.System32 path: It is the default path for the module. Whenever Microsoft updates any PowerShell version or module, it ... Read More

Get Supported Parameters of a Cmdlet in PowerShell

Chirag Nagrekar
Updated on 11-Nov-2020 13:06:55

289 Views

To know which parameters are supported by cmdlets, Get-Command retrieves the properties of the command. For example, We need to find the Get-Process parameters so the Get-Command will retrieve the command information and Full List will provide you the properties.Get-Command Get-Process | flOnce you run the command, it shows the ParameterSets property and they are the parameters supported by cmdlets.PS C:\> (Get-Command Get-Process).ParameterSets |ft -AutoSize Name                    IsDefault Parameters ----                    --------- ---------- Name                         True {Name, ComputerName, Module, FileVersionInfo..} ... Read More

Use Split-Path Command in PowerShell

Chirag Nagrekar
Updated on 11-Nov-2020 13:03:52

3K+ Views

Split-Path is to retrieve the part of the specified path, such as a parent folder, a subfolder, or a file name. It can also tell if the path is relative or absolute.This command supports a few parameters which help to retrieve the part of the specified path. Consider we have below executable file path and we will see how the Split-Path command will retrieve the parent folder and subfolder as well as the root directory.'C:\Temp\PsExec.exe'Default Split-Path command will retrieve the parent folder name of the file.PS C:\> Split-Path 'C:\Temp\PsExec.exe' C:\TempHere the default parameter is -Parent, which retrieves the parent folder path. Above command ... Read More

Get DNS IP Settings Using PowerShell

Chirag Nagrekar
Updated on 11-Nov-2020 13:01:40

21K+ Views

Ipconfig /all command also retrieves the DNS settings for all the network interfaces. This command can be run on both cmd and PowerShell. For example, ExamplePS C:\Users\Administrator> ipconfig /all Windows IP Configuration    Host Name . . . . . . . . . . . . : Test1-Win2k16    Primary Dns Suffix  . . . . . . . : labdomain.local    Node Type . . . . . . . . . . . . : Hybrid    IP Routing Enabled. . . . . . . . : No    WINS Proxy Enabled. . . . . . . . ... Read More

Get IP Address Settings Using PowerShell

Chirag Nagrekar
Updated on 11-Nov-2020 12:53:38

4K+ Views

To get the IP address of the system we can use IPConfig command in cmd and the same command can be used in PowerShell. IPConfig command shows all the connected and disconnected adapters including IPv4 and IPv6. For example, ExamplePS C:\Users\Administrator> Ipconfig Windows IP Configuration Ethernet adapter Ethernet0:    Connection-specific DNS Suffix  . :    IPv4 Address. . . . . . . . . . . : 192.168.0.104    Subnet Mask . . . . . . . . . . . : 255.255.255.0    Default Gateway . . . . . . . . . : 192.168.0.1 Tunnel adapter isatap.{27E40122-664A-404D-A4C9-4E48C0363BC5}:   ... Read More

Difference Between Write-Output and Write-Host in PowerShell

Chirag Nagrekar
Updated on 11-Nov-2020 12:48:52

5K+ Views

Have we ever wondered, Write-Output and Write-Host both are used to print the strings or the output of the command then what is the difference between them?ExamplePS C:\> Write-Output "Test String" Test String PS C:\> Write-Host "Test String" Test StringThe output remains the same.The first major difference is storing the output using the Pipeline structure. Write-Output and Write-Host both support the pipeline structure for example, Example"Test String" | Write-Output Test String "Test String" | Write-Host Test StringThe output remains the same.The first major difference is storing the output using the Pipeline structure. Write-Output and Write-Host both support the pipeline ... Read More

Use ForEach-Object Parallel Cmdlet in PowerShell

Chirag Nagrekar
Updated on 11-Nov-2020 12:45:15

2K+ Views

Foreach-Object -Parallel command was introduced in PowerShell version 7, preview 3, and it is used for the parallel execution of the pipeline input and more details on this have been explained in this article.Please Note: Foreach-Object and Foreach commands are the same but we can’t write Foreach -Parallel command because there is no such command, we need to use the full command, Foreach-Object -Parallel.A simple example of running a parallel object.Example1..10 | ForEach-Object -Parallel{     $_ * 1000       Sleep 1 }Output1000 2000 3000 4000 5000 6000 7000 8000 9000 10000Let's compare the timings with and without -Parallel parameter.Parallel Execution$time1 = Measure-Command { ... Read More

Advertisements