Anyone want to help me with more code stuff?
2Okay, this is a little different. It’s about my weather page, which is on the same domain as my weblog, so it got migrated as well.
The software is old, but it works.
The problem. I have/had a page (it’s still there, but I took the link off) for extended weather. It was run by a Hamweather script I got back in the early 00s.
If you go to that page, you’ll see there is no information.
This is how it looked a couple off weeks ago (taken from the wayback machine).
On the front page, the WeatherForYou 7-day forecast uses that code.
So, I don’t know if the gummint changed where this information is drawn from or if the actual hw3 code was changed. Hamweather.com now goes to aerisweather.com.
This is the information I want on my website. I did find this and muddled around, but I’m lost at JSON (I followed their instructions and just sat here and stared at it) or api or any of that.
If no one answers, my feelings won’t be hurt. I know this is a pretty big ask.
I love that the blog is working again.
The webhost looked at it and said it was nothing that happened during the migration. (I was thinking maybe a permissions setting, but they said “no”.)
Thanks.
- 5 comments, 17 replies
- Comment
I found another weather site and am going to try working with the code to see if I can get the nws data to work.
https://www.visualcrossing.com/
Up up down down left right left right B A.
@zhicks1987 that is fun too!!
@zhicks1987 Don’t forget START.
@zhicks1987 I don’t even know what this is. I thought it was dance steps.
@lisaviolet @zhicks1987
https://chat.openai.com/share/1086f6a3-b871-49f6-87a5-81b307402926
@awk @zhicks1987 Wow. Just wow.
I would help you if I could, but it has been far too long since I have done anything remotely close (late 90’s) . I fear I have forgotten most all of what I knew
Do you use ChatGPT (or Bard, Claude, etc)? You can ask it to write the code for you as a starting point. Try this to render the Weather.gov JSON:
https://chat.openai.com/share/76a1c786-897b-4500-beab-a8129875f52a
Copy the last answer to a .php file, it worked fine as written for me (had to set the user agent to Meh/1.0 because apparently weather.gov requires a user agent, even a made up one).
Another one for the visualcrossing API, needed some bug fixes:
https://chat.openai.com/share/d0733456-d4cb-4b32-91e3-d587030182c5
wrong link on that last one, should be:
https://chat.openai.com/share/c798e883-b20b-4009-a92f-7cdfb37e1906
@awk Do I use what? I use Notepad. That other stuff is above my paygrade, the software I am running is perl, from the last century.
I never upgraded or learned anything new because everything was running and I was happy with that.
And now…here I am, begging for help.
Copying to a php file means I just copy it to text and rename to php?
I’m great with written instructions when I can follow them step by step, but when I just have to muddle through it takes me a lot longer.
It honestly took me years to realize that no matter how hard I tried to make it happen, the computer I was using didn’t have the capability of rendering a HD video.
I don’t give up easily.
Thank you again.
I just went to the links.
What kind of magic was that? Who were you talking to? I’m slack-jawed right now. (I do have an API key from visualcrossing).
Now I’m really looking forward to starting on this.
@lisaviolet
ChatGPT is an AI chatbot. It’s pretty good with code. You can ask it programming questions, ask it to explain error messages, etc. Almost anything really, not just programming. bard.google.com and claude.ai are others.
Once the magic wears off you will find that they make mistakes (yet they answer everything with unwavering confidence). For instance the bugs I had to fix in the chats above. But it might be helpful to get a starting point.
I use them all the time, for instance I had a need to track hard drive diagnostics in a server cluster (dozens of drives) and connect the live data to a Google spreadsheet. I used ChatGPT to do about 80% of the work in maybe 30% of the time it would take me to do it manually.
@lisaviolet Just click the “Copy code” button upper right and paste it into an empty file. I did this and ran both examples on PHP 7.2 and they worked without changes (well, I had to sign up for an API key for the second one).
@lisaviolet It’s funny you mention “step by step”, since that’s a common “prompt engineering” trick for these chatbots. I.e. you ask a logic or math question and it might give you the wrong answer. But if you add “let’s think step by step” to a question it increases the probability of a correct answer.
@awk What a great time to be alive.
Seriously. As I said elsewhere, I grew up on three channels, rabbit ears, and AM radio. FM was starting to be a thing when I entered ninth grade (Edwards AFB - go Scorpions!).
Thank you for taking the time to do this and explain it to me. I’m a sponge for this type of thing.
And my husband has a hard time moving photos from his camera to his pc.
@lisaviolet Yep they are pretty wild. I also do contract work training them, and I spend a lot of time thinking about how to get them to work, and how to break them (like, get around the safety guardrails, get them to hallucinate, and so on).
Here’s another one I forgot to mention: pi.ai
It’s designed to suck you into a conversation and might drive you crazy. Turn on voice output for even more annoyance. (Don’t ask it programming questions though.)
@awk Okay, the code you provided worked (http://weather.lisaviolet.com/forecast.php), but it’s not what I’m trying to get to.
Weather.gov has what I’d like.
https://forecast.weather.gov/MapClick.php?lat=32.8048&lon=-116.9357
I know they’ve got an API, but I may as well be reading some foreign language. It makes zero sense to me.
https://weather-gov.github.io/api/general-faqs
I did see this in my error file (there are a bunch of them).
@awk I’m trying…
So, I used that chatai for weather.gov.
I’m filling in the blanks. What is " ‘User-Agent’: ‘Your-App-Name’,"?
https://chat.openai.com/c/26235d43-cfed-4d97-9910-e12a55efb484
I copied it and changed the lat, long, added my api from visualcrossing, but when I go to that webpage, it takes me back to the weather index page.
I didn’t do anything with the user-agent.
@awk Okay, I re-read your previous post, I made up a user-agent.
They’ve got a 7-day forecast that you want on your site. Cool stuff! If their data source has changed or they updated their code, that could be the cause.
@jokeshippopotam That’s what I’d like to find out.