NASA APOD

Post

Posted
Rating:
#1 (In Topic #350)
Avatar
Guru
cogier is in the usergroup ‘Guru’
NASA APOD (Astronomy Picture Of the Day)

IMPORTANT: - If you want to try this program you will need to get a NASA API key. It's VERY easy and free and will be issued on line. The program will guide you.

NASA has some fantastic photos and videos which have been put online daily since 1995. This program creates an easy way to locate, access and store these images.

As usual please let me know how you get on and if there are any issues.

<IMG src="http://www.cogier.com/gambas/NASA1.png"> </IMG>

Attachment
Online now: Yes Back to the top

Post

Posted
Rating:
#2
Avatar
Regular
stevedee is in the usergroup ‘Regular’

cogier said

…As usual please let me know how you get on and if there are any issues…

Hi Cogier, I just had 10mins over breakfast to download and start looking at this project.

When I "Click here to get your key" it returns:-

Code

/home/steve/https://api.nasa.gov/#signUp

I couldn't quickly see why this was appending my home path to the URL.

I hope to find some time to look at this again next week (in 2020).

Happy New Year to one and all!
Online now: No Back to the top

Post

Posted
Rating:
#3
Avatar
Guru
cogier is in the usergroup ‘Guru’
Hi Steve,

Thanks for testing the program. I am at a loss as to why you are getting this problem as the code couldn't be much simpler.

<IMG src="http://www.cogier.com/gambas/NASAKey.png"> </IMG>

AND a Happy New Year to you all!
Online now: Yes Back to the top

Post

Posted
Rating:
#4
Avatar
Administrator
sholzy is in the usergroup ‘unknown’
I had no issues when clicking the "get your key" button.

One issue I did run into though is the cache. Because I run a small /Home partition, most everything goes to a large "storage" partition and I then create links in /Home to those. When I seen where the cache was building up, I deleted the /NASA_APOD folder. When clicking the cache button again, an explosion occurred and my monitor melted into a pile of goo.  :lol:

A nice fix would be to check for that  /NASA_APOD folder and recreate again if needed. Another nice fix would be to give the user an option to change the location where that folder calls home since downloading HD images could chew up a lot of disk space quickly.

Something I felt was odd, is using a single click to view the image full screen. A double click would be much better and not prone to erroneous clicks inside the image viewing area.

Other than those two things, I think your app is great and I plan on using it to build up my wallpaper collection.  :D

sholzy
Gambas One Site Director

To report bugs in the Gambas IDE:
Official Gambas Bug Tracker
Online now: No Back to the top

Post

Posted
Rating:
#5
Avatar
Regular
stevedee is in the usergroup ‘Regular’

cogier said

… I am at a loss as to why you are getting this problem as the code couldn't be much simpler…

I've just worked out that my problem is with the URLLabel, a control I'd never looked at or even noticed before.

I think there is a Linux command/dependancy that is missing from PeppermintOS, so when this control is clicked, I just get my home path appended to the web link.

I managed to hack the code by using the MouseDown event on a regular Label control:-

Code (gambas)

  1. Public Sub getKeyLabel_MouseDown()
  2.  
  3.   FMain.OpenFilePatched("https: //api.nasa.gov/#signUp")
  4.  
   {note: the gap bewteen ":" & "//" is just to stop the forum from creating HTML code}

…and adding this Subroutine:-

Code (gambas)

  1. Public Sub OpenFilePatched(path As String)
  2.  
  3.   Shell "xdg-open " & path
  4.  

As my Linux distribution has the command "xdg-open" it now works fine.


Many thanks to my son Matt for his valuable help with this issue.
Online now: No Back to the top

Post

Posted
Rating:
#6
Avatar
Guru
cogier is in the usergroup ‘Guru’
Sholzy

One issue I did run into though is the cache. Because I run a small /Home partition, most everything goes to a large "storage" partition and I then create links in /Home to those. When I seen where the cache was building up, I deleted the /NASA_APOD folder. When clicking the cache button again, an explosion occurred and my monitor melted into a pile of goo. :lol:

OK sorry about that. :o  I have removed the explosives and the monitor melting fluid and the program will now not crash if you delete the folder.

A nice fix would be to check for that /NASA_APOD folder and recreate again if needed.

Fixed in this version.

Another nice fix would be to give the user an option to change the location where that folder calls home since downloading HD images could chew up a lot of disk space quickly.

This looks like quite a bit of work and I have not found a way to access other Partitions/Drives from within Gambas. (Not fixed)

Something I felt was odd, is using a single click to view the image full screen. A double click would be much better and not prone to erroneous clicks inside the image viewing area.

I like the single click but you are right to bring this up so I have added an option in the attached version.


Steve
I think there is a Linux command/dependency that is missing from PeppermintOS

I can't fix that one, it's just too much I can't cope any more!…. :arrow:

Code (gambas)

  1. Public Sub getKeyLabel_MouseDown()
  2.  
  3.   FMain.OpenFilePatched("https: //api.nasa.gov/#signUp")
  4.  
{note: the gap between ":" & "//" is just to stop the forum from creating HTML code}

Use the 'Do not automatically parse URLs' check box and all will be OK

Code (gambas)

  1. Public Sub getKeyLabel_MouseDown()
  2.  
  3.   FMain.OpenFilePatched("https://api.nasa.gov/#signUp")
  4.  

As my Linux distribution has the command "xdg-open" it now works fine.

I use the Gambas Desktop.Open() command, saves having to shell commands.

Well done Matt and thank you all for the input! :D

Attachment
Online now: Yes Back to the top

Post

Posted
Rating:
#7
Avatar
Regular
stevedee is in the usergroup ‘Regular’

stevedee said

…I hope to find some time to look at this again next week (in 2020)…

Great program cogier! I "lost" a big chunk of my morning just clicking from one image to another.

My only additional problems/comments:-

I think you should be able to load the program and view the Help before you get the api screen (this relates to my previous problem).

When I copy/paste the api key, the text changes to: <meta http-equiv="content-type" content="text/html; charset=utf-8"><code class="signup-key">eR5Pdmbrc6f8PcuyEyRzrxUoxnz66eKDgIVjeyjC</code>
…maybe I was doing something wrong, but it wasn't obvious.

When I clicked on image/video 22v (2019 Dec) the program crashed. So I think you need to add more error handlers, especially for DisplayPicture, and probably a few others including CreateFolder, GetData, videos & so on.

I got some clipped text:-

Image

(Click to enlarge)


In Detailed Help you have a typo "…bottom o0f the form…"

Note: All testing done in the IDE using the 1st zipped file.

I hope this helps.
Online now: No Back to the top

Post

Posted
Rating:
#8
Avatar
Guru
cogier is in the usergroup ‘Guru’
Hi Steve,

Thanks for pointing out these issues. I have loaded up Xubuntu on my laptop and all these issues are showing up. I'm on it :geek:

You missed another error, it's in your photo. Both the buttons have a shortcut key of "C". Opps! :o
Online now: Yes Back to the top

Post

Posted
Rating:
#9
Avatar
Guru
cogier is in the usergroup ‘Guru’
I think you should be able to load the program and view the Help before you get the api screen (this relates to my previous problem).

I had thought about that and decided against it, I have now added a 'Help' button to the 'api' Form that takes you straight to the correct 'Help' tab.

 
When I copy/paste the api key, the text changes to: <meta http-equiv="content-type" content="text/html; charset=utf-8"><code class="signup-key">eR5Pdmbrc6f8PcuyEyRzrxUoxnz66eKDgIVjeyjC</code>
…maybe I was doing something wrong, but it wasn't obvious.

I have just tried this on an Xubuntu installation and I got the same problem. Fixed. Changed Clipboard.Paste() to Clipboard.Paste("text/plain").

When I clicked on image/video 22v (2019 Dec) the program crashed.

Sloppy programming on my part. I was relying in the video being on YouTube and this one wasn't! I am using the correct data now.

I got some clipped text:-

Fixed. Added 'Picture' to the buttons and changed the shortcut keys.

In Detailed Help you have a typo "…bottom o0f the form…"

Fixed.

Update attached

Thanks again for this.

Attachment
Online now: Yes Back to the top

Post

Posted
Rating:
#10
Avatar
Administrator
sholzy is in the usergroup ‘unknown’
They say a picture is worth a thousand words…
Here's three-thousand words…  :lol:
Image

(Click to enlarge)


Image

(Click to enlarge)


Image

(Click to enlarge)


Let's see if you can find the fourth problem common with all three images. Here's a hint… It's not what's written. Here's another hint… They say size matters.  ;)

The screen shots are full screen, not cut off.

sholzy
Gambas One Site Director

To report bugs in the Gambas IDE:
Official Gambas Bug Tracker
Online now: No Back to the top

Post

Posted
Rating:
#11
Avatar
Guru
cogier is in the usergroup ‘Guru’
Thanks Sholzy.

I have redone the help pages and this problem should now be sorted. I am looking into moving the cache…

Attachment
Online now: Yes Back to the top
1 guest and 0 members have just viewed this.