Hi Lou,
re parsing that string with lat & long:
The url is ...JSON and there is a json package for Squeak. That will give you objects out of that string, I assume a Dictionary.
myDictionary := JSON fromString: 'what that URL returns'
latitude := myDictionary at: 'latitude'
Just a wild guess but I use the Json package and that's more or less what you need to do. No Squeak around to check.
Cheers,
Herbert
Am 30.01.2018 um 22:02 schrieb Louis LaBrunda:
Hi Ron,
On Tue, 30 Jan 2018 15:04:24 -0500, Ron Teitelbaum ron@usmedrec.com wrote:
Hi Lou, Very cool.
Thank you.
Just for fun, you can get user lat and long from the resulting dictionary by using the following: (WebClient httpGet: 'http://freegeoip.net/json/', (WebClient httpGet: ' https://api.ipify.org') content) content :)
Very interesting. Is there code to parse the lat and long from the string? I don't think I will incorporate it into the morph but I wouldn't mind supplying it in a comment for a user to use.
As is often the case, I have already made some changes to the code. I figured out a way to have the clock face picture be a local file or a URL to a file on the web. So something like this would work:
c := ClockImageMorph clockFace: 'http://www.labrunda.info/public/WorldWarII/MikeLaBrunda/Photos/MikeLaBrunda-...'.
I think I will wait a day or two before uploading a new version.
Lou
All the best,
Ron
On Tue, Jan 30, 2018 at 2:40 PM, Louis LaBrunda Lou@keystone-software.com wrote:
Hi,
I have created and uploaded my ClockAndCalendarMorphs project on SqueakSource. It depends upon another of my projects, KscAstroDataApp. KscAstroDataApp is used to calculate sunrise and sunset times displayed on the clock and calendar. Latitude and longitude are required for the sunrise and sunset calculations. If you don't supply them, no attempt will be made to do the calculations. In that case the KscAstroDataApp package should not be needed. Anyway it is probably best to download it too.
I'm new to SqueakSource and I'm not sure I defined the dependency correctly. If not, I will fix it. Please let me know if you have any problems. The code below will get you started testing/playing with the clock morph. The latitude & longitude are for my location.
The #initialize method of ClockImageMorph has a lot of comments about the options of the clock.
Have fun.
Lou
| c |
" c := ClockImageMorph clockFace: 'path2picture.jpg'." c := ClockImageMorph new. " c setTestMode." c desiredExtent: 1200@800. c setIncludeCalendar. c latitude: 40.66296 longitude: -74.535398. " c beTwentyFourHourClock." c setUseArabicNumerals. " c setUseRomanNumerals." c setAddCirclesAndTicks. " c setUseFancyHourHand. c setUseFancyMinuteHand. c setUseFancySecondHand." " c beFullScreen." c setShowDateTimeInfo. c numberColor: Color blue; circleColor: Color blue; tickColor: Color blue. c hourHandColor: Color blue; minuteHandColor: Color blue; secondHandColor: Color blue. c calendarTextColor: Color blue. c open. -- Louis LaBrunda Keystone Software Corp. SkypeMe callto://PhotonDemon