We would like to build a community for Small Basic programmers of any age who like to code. Everyone from total beginner to guru is welcome. Click here to register and share your programming journey!


Thread Rating:
  • 2 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Small Basic Only Extension
#11
Hi JR,

you can find the LDBasic Extension here:

   

The functions are:     
Reply
#12
litdev,

I got it. The first time I looked I didn't see it.

Here is first program for flickr

LDBasic.FixFlickr()
file=Flickr.GetPictureOfMoment()
image=LDBasic.LoadImage(file)
GraphicsWindow.DrawImage(image,0,0)

This works, but I am wondering if it is possible to have the LDbasic.FixFlickr() command hidden. Like the extension just does it each time it is loaded. And maybe do the same with LDBasic.loadimage(). Or maybe there is a way to get the image loaded and be able to use the standard imagelist.loadimage() command.

JR

LitDev,

Here is a problem list for level 1.2 that I found on the Wiki. It does mention the tls issue. I think it was posted by Nonki.

https://social.technet.microsoft.com/wik...-host.aspx

Here is another one that I posted about 1.2 issues. Never got fixed though.

https://social.msdn.microsoft.com/Forums...smallbasic

Here is one that I got to work just using the regular imagelist.loadimage command which I thought didn't work.


size=LDBasic.DownloadFile("c:\temp\soccer.jpg","https://cdn.wallpapersafari.com/3/7/SFe72B.jpg")
TextWindow.WriteLine(size)
image=ImageList.loadimage("c:\temp\soccer.jpg")
GraphicsWindow.DrawresizedImage(image,0,0,500,400)

JR
[-] The following 1 user Likes jrmrhrb00's post:
  • litdev
Reply
#13
To work as you want the command needs to be compiled by the SB compiler.  At present only the code entered by the user in the IDE is compiled.  I can't see any way to change this using the default SB IDE and compiler.

Thanks for links, I will look at those sometime Big Grin

I had a look and I think it is just the Network and Flikr - am I missing anything?
[-] The following 1 user Likes litdev's post:
  • z-s
Reply
#14
litdev,

Did you look at the last program snippet with the soccer ball? If imagelist.loadimage() in all instances then we don't need the ldbasic.loadimage(). Also, I didn't have to use LDBasic.SetSSL to get the 2 code snippets running.

Here is just small basic program downloading a file using only regular small basic commands.

FileName=Network.DownloadFile("https://cdn.wallpapersafari.com/3/7/SFe72B.jpg")
'size=LDBasic.DownloadFile("c:\temp\soccer.jpg","https://cdn.wallpapersafari.com/3/7/SFe72B.jpg")
'TextWindow.WriteLine(size)
'image=ImageList.loadimage("c:\temp\soccer.jpg")
image=ImageList.LoadImage(FileName)
GraphicsWindow.DrawresizedImage(image,0,0,500,400)

So, the issue is due to the compiler not being able to run the commands unless they are in the ide. Darn! It's a good try. So, now we need to figure out what commands in LDBasic that are really needed. I know FixFlicker is one, but I am not real sure about needing the others. I was really surprised that the network.downloadfile worked. Your right in that so far it's Flickr and Network that doesn't work as expected, but I am not sure on what all parts of network that don't work.

So, I think what we could do is have the extension with only commands that are needed. Then if they want to use Flickr they have to put the command in front of their program and the same for what doesn't work in the network and whatever else we find.

JR
Reply
#15
I'm afraid the issue depends on the network SSL security, most have it, for example try this "https://litdev.uk/forum/parrot.png"
[-] The following 1 user Likes litdev's post:
  • z-s
Reply
#16
LitDev,

Tried your example with the normal network.downloadfile without ldbasic.setSSL and your right it didn't load. This stuff can get confusing! I am going to see if I can find something else that doesn't work.

JR
Reply
#17
LitDev,

Any idea of why this doesn't work with imagelist.loadimage, but it does work with ldbasic.loadimage?

LDBasic.FixFlickr()
pic=Flickr.GetRandomPicture("Mountain")
'pic=Flickr.getpictureofmoment()
'image=LDBasic.LoadImage(pic)
image=imagelist.LoadImage(pic)
GraphicsWindow.DrawresizedImage(image,0,0,GraphicsWindow.width,graphicswindow.height)

Even if I put in ldbasic.setssl() it doesn't work. So, it should have the right SSL, but still doesn't work. What could be the difference in those 2 commands?
Reply
#18
Hi,
Thanks for the test.  I'm not really sure, but this is why we added ldbasic.loadimage and now ldbasic.loadimage (these download the file to temp then load it to imagelist) - possibly something Flickr add?
There was a discussion on this in the Flickr thread of Extensions forum.
[-] The following 1 user Likes litdev's post:
  • z-s
Reply
#19
LitDev,

I don't get it either. I looked at ILSpy for the 2 commands. I can get lost in that, but to me the commands look about the same. Could you look at that and see if you can find a reason? I certainly don't see it.

I'm trying to figure out what are the best set of commands to use, meaning that they always work. Would it be safe to say "Only use the LDBasic commands as they have the best chance of always working?

JR

I looked for extensions forum Flickr thread and couldn't find it. Could you send me a link? Thanks!

Also, shouldn't this be 1.2 or 1.3 level?

WebRequest.DefaultWebProxy.Credentials = CredentialCache.DefaultCredentials;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
----------------------------------------------------------------------------------------------------------------------------------------------"Here"----------------------------------
The reason I am asking is if I in ILSpy if I hover the cursor over ServicePointManager.SecurityProtocol it opens a window that says that the value being set is an invalid value.

Is there a way to send a picture in this forum?
Reply
#20
Hi,

There are a few points here.

1] LDBasic should behave exactly the same as LitDev extension methods
2] The Flickr thread is here, note post 4 among others (Flickr downloads appear to behave differently)
3] I did look at Tls12, Tls13 etc, but you may be right w.r.t. Flickr (I will look at this again)

As far as I know the LDBasic commands are a minimum set, but the Tls variants are worth me checking again because I didn't understand why Flickr could download a file, but not directly into ImageList.  If you look at SmallBasicLibrary.dll with ILSpy you will see that ImageList.LoadImage does download to a temp file, so more effort required on my part. Smile
[-] The following 1 user Likes litdev's post:
  • z-s
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)