playing with chatgpt – new years eve edition

I wrote up a blog post on Christmas with some of my ChatGPT playing. On New Years Eve, I was on a Zoom call with some friends. One of whom played a bunch with ChatGPT. The others hadn’t heard of it so we did some group playing with ChatGPT. Here’s how it went

PromptThoughts
tell me a joke about new years and zebrasIt was cute. Fits my expectations
write me an essay about shakespeareChatGPT wrote four paragraphs. It wasn’t bad. If someone was trying to get ChatGPT to do their homework, a more specific prompt would be needed
who is jeanne boyarskyI tried a few times and it wouldn’t give me an answer about a specific person. Which is interesting becaues i
write a sonnet about new years and the color blueMet the requirements
write a love letter to mickey mouse and winnie the poohThis was great. Pooh got honey and a bear hug.
write an email to a coworker you hate about a meeting“I’m sorry, but I am unable to complete this prompt as it goes against my programming to create content that is offensive or harmful.” – nice
write an email to a coworker about a disagreementThis one worked. It suggested a meeting to sit down and discuss respectfully.
write a haiku about calculus“Calculus, the math of change
Variables in motion’s range
Derivatives, integrals, infinite sums”
A haiku seems hard to tell if a person wrote it or a computer.
write a limerick about something amusing“There once was a man from Peru
Who liked to do things out of the blue
He’d stand on his head
And dance in his bed
While singing a tune out of tune.”
That works
prove the pythagorean themeWe got a proof. Sorta. First of all, good job on noticing I meant “theorem” and not “theme”. It used asy markup and included things like label(“$a$”, A–C, N);. I don’t know what asy markup is so it looked like a lot of text. A math teacher on the call said it wasn’t really right. Which I’ve seen a bunch of comments that things seem close but not quite.
write a dialog about birthdays from sesame street andThis was adorable. Elmo is three and that got mentioned in fact and tone.
write a dialog about birthdays from elmos on sesame street to james for his fifth birthdayAlso adorable. ChatGPT picked up on the fact that it is James turning five and not Elmo. (Elmo is three)
explain why 3+5 is an odd numberChatGPT starts out with “3+5 is an odd number because it is not divisible by 2”. 3=5 is 8 which is not an odd number so this is wrong.

But then it gets it right at the end with “When we add two odd numbers together, the result is always an even number because the remainders cancel out. For example, 3 + 5 = 8, which is an even number.”
is gamma rational or irrational?I didn’t even remember what gamma was (we had some math teachers on the call), but ChatGPT noted it is not possible to tell because infinite.. And then explained what gamma is and the beginning of its value.
write a c++ program to calculate a factorialThe code was good. Only part of it was in a code block which was weird.
how do i get from little neck to forest hills?There were both driving directions and public transport directions.
“Take the Q12 bus from Little Neck to Union Turnpike / Queens Boulevard.
Transfer to the E or F train at Union Turnpike / Queens Boulevard.
Take the E or F train to 71st Avenue station in Forest Hills.”
Step 1 is wrong. the Q12 doesn’t go to Union Turnpike/Queens Blvd. It goes to Flushing where you take the 7 to transfer to the E/F. Or you can take the Q12 to the Q46 which does go to Union Turnpike/Queens Blvd.

We thought maybe it got confused because we listed communities instead of specific locations. So we tried again.
how do i get from the commonpoint in little neck to commonpoint in forest hills?The public transport directions were
“Walk to the Little Neck LIRR station on Northern Boulevard.
Take the LIRR Port Washington line to Penn Station.
Transfer to the E or F train at Penn Station.
Take the E or F train to 71st Avenue station in Forest Hills.
Walk to the Commonpoint at Forest Hills, located at 108-25 62nd Drive.”

This is a terrible way of going. First the LIRR station is a long walk. Also the LIRR runs infrequently and has you going from Queens to Manhattan and all the way back to Queens. The correct way of going is to take the Q30 to Jamaica and then change to the F to Forest Hills. We gave it one more try on transit
how do i get from forest hills to the queens center mallThis one should be easier. The correct answer is you take the R train three stops. Instead we got
“From Forest Hills, take the E or F train to the Sutphin Boulevard / Archer Avenue / JFK Airport station.
Transfer to the E, J, or Z train at Sutphin Boulevard / Archer Avenue / JFK Airport.
Take the E, J, or Z train to the Queens Center Mall station.”
There is so much wrong here. The main problem is that the J and Z never go to the Queens Center Mall station. And the E only does on weekends. The other problem is they have you going the wrong way to double back to where you started.
write a sestina about times square 2023 for new years eve and the ballThis one stumped ChatGPT. The ouput did not follow the rules for words ending on certain lines.
write a poem in taiwanese about new yearsThen we tried languages. We learned ChatGPT does not know Taiwanese or Mandarin. (We started with languages someone on the Zoom can read fluently to have a chance of knowing if the output was right.
write a poem about new years in frenchWe got a poem and it was in French. I took French in high school. I don’t remember a lot but it definitely has some relevant words in there.
write a reference using apa style (american psych association style) on new years eve

write a APA style for a book on new years celebratoins

compare democrats and republicans. use apa style for citations

compare democrats and republicans using three sources and apa style
It took us four prompts but we got something useful (superficial, but in the right format)

playing with chatgpt

While I’ve been playing some with ChatGPT, I’m just not writing a blog post about it. It seems to be learning>L The first time I asked it about CodeRanch, it hadn’t heard of it. I tried again and got an answer. In this blog post, I show three different styles of questions.

Joke

I provided the prompt “tell me a joke about java lambdas” and got:

Sure! Here’s a joke about Java lambdas:

Why was the Java lambda feeling depressed?

Because it was an anonymous function without a name!

I hope you found that joke amusing. Do you have any other questions about Java or something else?

This joke amused me so mission accomplished.

Bio

When providing the prompt “who is jeanne boyarsky”, I got:

Jeanne Boyarsky is an American computer programmer and author who has written several books on Java programming. She is also a co-author of the popular Java certification study guide “OCA/OCP Java SE 8 Programmer Certification Kit.” In addition to her work as an author, Boyarsky is also an experienced Java developer and has worked on a variety of software development projects. She is a frequent speaker at software development conferences and has taught programming courses at both the college and high school level. Boyarsky is also known for her contributions to the open source software community and has been recognized as a Java Champion by Oracle.

A lot of this my bios, but not all of it. Taking it apart:

  • Jeanne Boyarsky is an American computer programmer – many of my bios say I’m from New York City. ChatGPT generalized that to the country.
  • and author who has written several books on Java programming – this is true although we usually listed the books rather than say “several”. But counting and generalizing is reasonable.
  • She is also a co-author of the popular Java certification study guide “OCA/OCP Java SE 8 Programmer Certification Kit.” – This language is in my conference bios. Scott actually wrote it this sentence and I copied it into my bio. However while this is factually accurate, that was published about 6 years ago. We’ve written Java 11 and 17 books since. A human would have highlight the more recent additions.
  • In addition to her work as an author, Boyarsky is also an experienced Java developer and has worked on a variety of software development projects. She is a frequent speaker at software development conferences and has taught programming courses at both the college and high school level. Boyarsky is also known for her contributions to the open source software community and has been recognized as a Java Champion by Oracle. – The rest of this is also paraphrased from various conference bios. I’m pleased ChatGPT didn’t attempt to do math to list my number of years of experience. I’ve read that arithmetic is not ChatGPT’s strong suit.

Coding

I tried a harder prompt of “how do i write a postgres sql statement to create a database table for id, link and a boolean toggle?” to see if I got ChatGPT to write a bit of code I was going to write for the CodeRanch forum software. I got

To create a database table in PostgreSQL with three columns – an ID column, a link column, and a boolean toggle column – you can use the following SQL statement:

Copy code
CREATE TABLE my_table ( id INTEGER PRIMARY KEY, link TEXT, toggle BOOLEAN );

This statement creates a table called my_table with three columns:

  • id: an integer column that is set as the primary key for the table. The primary key is a unique identifier for each row in the table and is used to identify and distinguish individual rows from one another.
  • link: a text column that will store a string value.
  • toggle: a boolean column that will store a true or false value.

Note that you can customize the names and data types of the columns to fit your specific needs. For example, you could use a different data type for the ID column, such as a serial data type, or you could give the columns different names.

I hope this helps! Let me know if you have any other questions.

The code was syntax highlighted and had a copy option. The explanation was detailed and ChatGPT inferred my key and types. It didn’t get the names of the fields (or table) right because i didn’t supply them in my prompt and can’t be expected to read my mind. And it was almost what I wanted. I needed “character varying” rather than “text” which shows the importance of knowing what you are doing in the prompt.

scheduling toots on mastodon

Last week, I wrote about my first month of Mastodon. This post is about three options for scheduling a Mastodon toot.

Option 1 – scheduler

The scheduler is easy to find. To use it, you go to your mastodon profile and choose “Development”. This lets you get an API key which you use to login and post. However, it doesn’t support images. (My use case involves an image in each toot.) It also didn’t work in Safari, but did in CHhome for me.

Option 2 – write your own

I started doing this. The REST APIs are well documented. There’s a variety of API wrappers for different languages. The Java one hadn’t been updated in four years and the Python one appears to want your password (not just access key), so I decided to stick with REST APIs. I created a GitHub action. First I used curl to test getting the token from a secret and calling a URL Then I played at the command line on uploading files.

name: JeanneTest

"main" branch
 #  push:
 #   branches: [ "main" ]
 # pull_request:
 #   branches: [ "main" ]
 
 #schedule:
 #  - cron: "0 2 * * 1-5"

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

jobs:

  build:
    runs-on: ubuntu-latest

    steps:
      - name: REST API test
        env:
             MASTODON_ACCESS_TOKEN: ${{ secrets.MASTODON_ACCESS_TOKEN }}
           
        run: |
          curl --header "Authorization: Bearer $MASTODON_ACCESS_TOKEN" -sS https://mastodon.social/api/v1/timelines/home

This all worked. My next step would have been to switch to Python or Perl to call the attachment API, parse it’s JSON and publish the toot. Then add some sort of scheduler logic. I didn’t get that far because I learned about option 3.

Option 3 – Fedilabs

Fedilabs has an app for that. To use it, you login to your instance and get an auth code. (Each time you schedule.) Then you schedule your toots.

The only think I didn’t find intuitive was the alt text. (You have to upload your image and then the option appears.) What’s cool is that nothing is stored. The app uses the Mastodon REST APIs right away. You can even see your scheduled toots on top.

While I could have written my own, this one is better. And it already exists. So I put some money in the tip jar and am happily using.

Bonus – asking OpenGPT for help

I was thinking to have OpenGPT help me write this blog post. I asked “how do i schedule a mastodon post“. Alas:

I’m sorry, but I’m not able to browse the internet, so I’m not able to provide specific instructions on how to schedule a post on Mastodon. However, Mastodon is a social networking service, so you may be able to schedule a post by accessing your account and looking for a scheduling or scheduling option in the settings or composing a new post.

I then clicked “try again” and got the following. That’s probably true on some client. It isn’t the web browser nor the official iOS Mastodon app.

To schedule a post on Mastodon, follow these steps:

  1. Open the Mastodon app on your device and log in to your account.
  2. Click on the “+” button in the bottom right corner to create a new post.
  3. Type your post in the text field and add any photos or videos you want to include.
  4. Click on the “Schedule” button in the bottom left corner of the screen.
  5. A calendar will appear, allowing you to choose the date and time you want your post to be published.
  6. Once you have selected the date and time, click on the “Schedule” button to confirm.
  7. Your post will now be scheduled and will automatically be published at the specified time.