The Old Way of Technical Search
The modus operandi I use for most of my software-development-related research is to:
Search using Google (yes, I prefer the results to Bing).
Search with keywords and typically target the site that will give me the best results using Google site keyword such as:
2.1 Find the man page for PowerShell's Invoke-RestMethod cmdlet:
Invoke-RestMethod site:microsoft.com
. Note above thesite:
refers to microsoft.com.2.2 How to use PowerShell's Where-Object to select a value in an array of arrays:
filter array of string arrays PowerShell Where-Object site:stackoverflow.com
. Note above thesite:
refers to stackoverflow.com.Read through and click on the results. For Stack Overflow (I have loved Stack Overflow for the last fifteen years), this is tedious because a lot of results need to be culled to find an answer to your question.
ChatGPT: the New Way of Technical Search
As an experiment, I asked ChatGPT to help me with a piece of code (yes, I could have written this code without searching) but it is complex code. Here are the instructions I gave ChatGPT:
- I want to have a PowerShell array of type
[PSCustomObject[]]
and each element of the array is type[PSCustomObject[]]
. I want to select all values where index 4 equals 'monkey'. - I want to have a PowerShell array of type
[PSCustomObject[]]
and each element of the array is type[string[]]
. I want to select all values where index 4 equals 'monkey'. [string[]] $a = 'x', 'y', 'z'; [string[]] $b = 'e', 'f', 'g'; [string[]] $c = 'q', 'r', 's'; [PSCustomObject[]] $a, $b, $c
. Select all values where array index 1 equals 'f'.enum SegmentIndexes { Region Subregion State }
. Select index[SegmentIndexes]::Region
equals 'f'.- Use the array from the previous example. I am not interested in an array of enumerations.
- Use the array before that.
- Rewrite the code with no comments and please put the type in front of the declared variables
- I did not ask you return $filterArray so the last line is not needed
- Do not use a ; when populating the hashtable
- You are incorrect. The ; are still used in the hashtable
Here is the code ChatGPT generated which is correct:
Apology
Over the past few years, one of the best people I've worked with is Stephen Durant of Stack Overflow. He is a customer liaison to corporate users of Stack Overflow. I do not normally praise someone for doing their job, but Stephen is really elite at his work. So, Stephen, I apologize because ChatGPT has filled many more of my needs related to technical search.
No comments :
Post a Comment