In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > IT Information >
Share
Shulou(Shulou.com)11/24 Report--
Original title: "Google lost ground!" ChatGPT is accurate and fast, so there is no need to search bug at all. "
ChatGPT landed the first sword, first cut the developer!
The last wave of image-generated models made artists anxious and began to protest against the infringement of their copyright by models such as Stable Diffusion, while the text revolution brought about by ChatGPT created a sense of crisis in all industries.
Especially the programmer group, is shivering, personally lost their jobs, the future can only be reduced to a "code review specialist."
But is ChatGPT's ability to change the code really as strong as imagined?
Maybe it's that strong!
With ChatGPT, there is no need to find a valuable answer from a sea of documents, just a question, you can directly return the right answer, and there are many examples, from relying on library version updates to MacOS technical support.
ChatGPT comes out, one can support two, the boss calls to save money.
Understanding the version update "version matching" of programming languages is definitely the most annoying problem for programmers. It takes a lot of effort to debug and modify every time you encounter problems such as tensorflow incompatibility, mutual exclusion of various dependent library versions, language version features, and so on.
Most people don't pay attention to what changes are made every time the version is updated, but ChatGPT wrote them down.
For example, if your boss gives you a need to move all your websites from the very outdated version 7.4 of PHP to the latest PHP 8, this may be a headache.
PHP is the network programming language that WordPress and many other network management tools rely on, which involves a large number of plug-ins, some of which are not compatible with PHP 8. If you want the upgraded website to run successfully, you must find and fix the code.
The general solution process is to search for the problem on PHP.net, and then look up some relevant comments on StackExchange to determine how to modify it. The whole process is very confusing and time-consuming.
Now you can type the details of the question directly into ChatGPT, and you can quickly get a solution, and some demonstration code will be included in the answer.
Q: when I was using PHP, the extract function returned a fatal error without passing in an array. The code worked fine in PHP 7.4, but there was an error in PHP 8. Is there any change in the extract of PHP 8?
I'm having trouble with the PHP extract function giving a fatal error when not passed an array. In PHP 7.4, I did not get the error, but I seem to in PHP 8. Did extract change for PHP 8?
ChatGPT replied: in PHP8, the behavior of the extract () function becomes more strict. In previous versions of PHP, the extract () function only returned false; if no array was passed in, but in PHP 8, if no array was passed in, a fatal error was thrown. This modification is designed to improve the robustness of the function and to prevent potential errors caused by accidental input.
You can check whether the variable passed to the function is an array by using the is_array () function, and then call extract ()
You can also use the array_key_exists () function to check whether the passed-in variable is an array.
Or use. Operator deconstructs an array into multiple variables.
It turns out that according to ChatGPT's answer, you can fix bug in a few minutes, in large part because you know where to find the answer, and ChatGPT also shows how the behavior of functions changes in different versions of PHP.
Q: which PHP functions may go wrong when migrating code from PHP 7.4 to PHP 8?
What PHP functions are likely to break when moving from PHP 7.4 to PHP 8?
ChatGPT replied: when migrating from PHP 7.4 to PHP 8, there are some functions and features that may not work or behave differently. Here are some of the major changes that could cause problems:
As mentioned in the previous answer, if no array is passed in, the extract () function throws a fatal error.
Foreach, array_keys () and current () have been deleted in PHP 8.0.
The create_function () function has been deleted in PHP 8.0, and anonymous function is recommended.
The list () construct, when used with foreach, now returns keys and values as separate variables rather than as a single array
The _ _ autoload () function has been removed in PHP 8.0
The $php_errormsg variable has been deleted in PHP 8.0
Some deprecated (deprecations) functions have been deleted, including create_function (), each (), _ _ autoload () and (), and $php_errormsg
These are just some examples of changes that can cause problems when migrating from PHP 7.4 to PHP 8, and it's a good idea to thoroughly test your code and applications before upgrading to make sure everything works as expected.
In this answer, ChatGPT also said "as mentioned in the previous answer", which is both surprising and frightening.
In the code being modified, the original developer (who has been out of work for a long time) often used create_function. I didn't know the function had been deprecated at the time, but according to the list of changes provided by ChatGPT, all I had to do was search the code to find what needed to be updated and rewritten.
Then, continue to ask ChatGPT to show how to replace the function.
Q: what is a good way to rewrite code using create_function in PHP? Give me an example of using create_function.
What's a good way to rewrite code using create_function in PHP? Can you give me an example using create_function, and then one using the currently proper mechanism?
Create_function is a deprecated function in PHP that is used to create anonymous functions. This function is no longer officially recommended and has been removed in PHP 8.0. You can now create anonymous functions (also known as closures) using the function keyword.
Here is an example:
Here is the equivalent code for using anonymous functions:
In addition, you can use the use keyword to pass variables to the closure:
This answer is quite clear, and the code can be rewritten quickly after reading the explanation.
MacOS technical support assumes that there are also some questions when studying optimized Storage on Mac (Optimize Storage). In order to narrow the scope of the research, you can directly ask ChatGPT.
Q: when using the MacOS feature Optimize Mac Storage, will Time Machine make an incomplete backup because some files are only represented as stubs on the local machine?
If you use the MacOS feature Optimize Mac Storage, will Time Machine make incomplete backups because some files are only represented as stubs on the local machine?
ChatGPT replied: the "optimize Mac Storage" feature in MacOS uses iCloud to unload rarely used files from Mac to the cloud, while keeping a "stub" file on the local machine to represent the original file. This saves space on the Mac hard drive.
When Time Machine is set up for backup, all files, including those that have been uninstalled using optimized Mac Storage, are backed up, replacing the original file with a stub file.
This also means that if you want to restore your Mac from a Time Machine backup and the optimize Mac Storage feature is enabled, then any uninstalled files will not be included in the restore and will need to be downloaded from iCloud again.
It is worth noting that if a large number of files are uninstalled, Time Machine backups may take up more space than not using optimized Mac storage because backup stub files take up less space.
In short, if you use the optimize Mac Storage feature, Time Machine will make an incomplete backup because it will only back up the stub files, not the original files that have been unloaded to the cloud.
ChatGPT's answer above is correct.
Summarizing ChatGPT does save the time it takes to develop and resolve bug.
In general, programmers need to constantly debug when they write code and do a lot of web searches to find clues from search results, including reading discussions and comments.
Of course, the whole search process can provide a lot of information, definitely more information than you get from the chatbot, and you can also see a lot of hidden techniques in the comments section.
But when you need to be in a hurry or meet a critical deadline, a large number of searches is definitely a stupid approach, and using ChatGPT to solve programming problems has proved to be very effective.
ChatGPT is like other models, you have to realize that AI's answer is not always right, you will probably get the wrong answer completely, but it is a very good tool.
But where exactly did ChatGPT get this information? Has anyone ever written an article specifically about extract or create_function? Is someone's knowledge used as the original material for the generation of answers?
As things stand, at least for Google authors, there was a chance for search engines to provide traffic to articles in return for sharing information, but chatbots like ChatGPT directly monopolized access to information, and of course users were more productive. Will anyone lose the sense of accomplishment of their job?
Q: when you answer a question, do you accept the knowledge contributed by others, and do you get the results of your work from the original human resources?
ChatGPT, when you answer a question, are you taking knowledge others have contributed and are you taking work and credit away from the original human sources?
ChatGPT's answer: as an artificial intelligence language model created by OpenAI, I have no personal opinions or ideas. But I can tell you that the messages used to generate responses are based on my data training, including huge amounts of text from the Internet.
This passage is written by many different people and sources, and I do not have the ability to attribute the information to me to specific individuals. My goal is to provide useful and accurate information to help users find the answers they are looking for.
It is important to remember that my answers are based on patterns in my trained data and may not always be completely accurate or up-to-date.
Reference:
Https://www.zdnet.com/article/im-using-chatgpt-instead-of-google-to-help-me-fix-code-faster-but-at-what-cost/
This article comes from the official account of Wechat: Xin Zhiyuan (ID:AI_era)
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.