Using ChatGPT to generated graphics program

The entire series at https://tthtlc.github.io/ is my first attempt at using ChatGPT to generate Javascript to render line graphics in webpages.

Sometimes it has been very productive and useful. Sometimes it requires so much effort in describing the details to ChatGPT that it is much more efficient to just modify the program myself.

Overall, I will say ChatGPT sometimes can reach 90% of the production grade output, but many times, especially for complex scenario, it is only 20% of the original codes are written by ChatGPT. And sometimes, a theoretically possible program (which MatLab can easily do it) seemed never possible. Specifically I am referring to "truncated dodecahedron". I managed to do it – after much manual intervention, but still only managed to do it for one single face of the truncated dodecahedron, but not all the faces.

This is another attempt of doing the AI generated javascript except I am using Jekyll "so-simple" theme (which is no so simple, because it is so rich with features and alternatives). One feature added not done before is capturing the animation as GIF, in addition to capturing it as PNG/JPG from the older implementation.

https://hackgptdeveloper.github.io/ai/2024/11/23/double-ngon-explore.html

Lissajous Pattern

https://tthtlc.github.io/lissajous_explore.html

And if you add a rotating circle pattern while travelling on the above Lissajous Figure, you get the following:

https://tthtlc.github.io/lissajous2_explore.html

Changing different values:

Next changes:

Proof of XXX in Blockchain technologies

The classic blog on the uselessness of Blockchain technology is this:

https://www.schneier.com/blog/archives/2022/06/on-the-dangers-of-cryptocurrencies-and-the-uselessness-of-blockchain.html

But given that there are 221k repo on github (https://github.com/search?q=blockchain&type=repositories) related to opensourced blockchain software, I think there must lots of demand arising from Blockchain technologies.

The following link is from ChatGPT, so verify it if it is true:

https://chatgpt.com/share/6712848f-9148-8013-8808-8273804db9d5

The following is the lecture notes from Cornell University:

https://www.cs.cornell.edu/courses/cs5412/2022fa/slides/Enrichment%20for%20blockchain%20material.pdf

Sinusoidal parametric equation

https://tthtlc.github.io/parametric_curve2_explore.html

x(t) = { return aaaa * Math.pow(Math.sin(-bbbb * t), 2) * Math.pow(2, Math.cos(Math.cos(4.28 * 2.3 * t))); }

y(t) = { return aaaa * Math.sin(Math.sin(-bbbb * t)) * Math.pow(Math.cos(4.28 * 2.3 * t), 2); }

where -cccc < t < +cccc

The result is this:

And this:

And this:

And this:

Non-blocking system calls in Linux

Not well known to many here are some non-blocking system calls:

  1. poll and select: Used for monitoring multiple file descriptors to see if I/O operations can be performed without blocking. They return immediately and indicate which file descriptors are ready.
  2. epoll (Linux-specific): Similar to poll and select, it monitors multiple file descriptors but is more efficient for a large number of descriptors. It can be configured in a non-blocking way.
  3. fcntl: Used to set a file descriptor to non-blocking mode by changing its properties with the O_NONBLOCK flag. After this, operations on the file descriptor, such as read or write, will be non-blocking.
  4. ioctl: Can configure various device files to operate in non-blocking mode, depending on the device’s support for non-blocking operations.
  5. read and write on non-blocking sockets or files: When a socket or file descriptor is set to non-blocking mode (using fcntl), read and write calls will not block. If the operation cannot be completed immediately, they return an error code (typically EAGAIN or EWOULDBLOCK).
  6. accept on non-blocking sockets: When listening on a non-blocking socket, accept will return immediately if no incoming connections are present, returning EAGAIN or EWOULDBLOCK.
  7. connect on non-blocking sockets: For non-blocking sockets, connect will return immediately with an error if the connection cannot be established instantly, and the operation will complete in the background.
  8. send and recv on non-blocking sockets: When called on non-blocking sockets, these will return immediately if the data cannot be sent or received, indicating the status with an error code like EAGAIN.
  9. Asynchronous I/O (AIO) system calls: Calls like aio_read, aio_write, etc., initiate I/O operations that return immediately, with the actual completion of the operations occurring asynchronously.