Sunday, February 19, 2023

Rapid Program Generation for Artists

 First, everyone was worried about the painters and visual artists. Then, it was the copywriters who got the sympathy. No one as of yet has complained that ChatGPT can draft functioning code in a few seconds. The new Ngram program could have taken a week or more to get every functioning properly. My first effort provided the architecture for the ngram datatype from the ground up. 

So, for someone like me who knows how to program, but doesn't program every day for a job, it's turned me into a superman of programming output. 

What can ChatGPT do?

ChatGPT can generate simple, short programs, functions, and more in breakneck speed. If you want to generate one small program, it can do the entire thing for you. However, the architecture of ChatGPT will stop generating tokens after a certain point which means that long programs will be cut off, in my experience. I have the paid service and it still does that. So, you need to know something about code architecture if you're going to code this way.

How do I test the program?

Load up ChatGPT. Enter the following text:

in html, create a textbox with the following data: "Hello World". Add a button that says, "Button". When the user hits the button, change the text to "Goodbye World". If the text says Goodbye World then change it to Hello World.

Load up Notepad. Paste the code into Notepad. Choose "Save as...". Where it says "File type" choose "All files". Then save it as "textbox.html". The code produced is provided below: 

    <!DOCTYPE html>

<html>

  <head>

    <title>Textbox and Button Example</title>

  </head>

  <body>

    <input type="text" id="myTextBox" value="Hello World">

    <button onclick="changeText()">Button</button>


    <script>

      function changeText() {

        var textBox = document.getElementById("myTextBox");

        if (textBox.value === "Hello World") {

          textBox.value = "Goodbye World";

        } else {

          textBox.value = "Hello World";

        }

      }

    </script>

  </body>

</html>

Be sure to save the file as "All Files" type. Otherwise, your browser won't recognize it as a webpage. The OS will think it's a text file and use Notepad to open it. You need the browser to open the file to test it.

My browser is displaying the code—not running it, what happened?

You saved the file as a textile so the browser interprets it as raw text and not a script to run. You must resave the file as an HTML (don't bother trying to rename it).

No comments:

Post a Comment