It is currently September 22nd, 2021, 6:21 pm

⭐ Weather.com - Parsing the V3 JSON - NEW!

Our most popular Tips and Tricks from the Rainmeter Team and others
User avatar
jsmorley
Developer
Posts: 22291
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: ⭐ Weather.com - Parsing the V3 JSON - NEW!

Post by jsmorley »

You are right! I'll change that the next time I modify the @Include files. Thanks!
User avatar
Yincognito
Rainmeter Sage
Posts: 4052
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: ⭐ Weather.com - Parsing the V3 JSON - NEW!

Post by Yincognito »

nek wrote: January 30th, 2021, 7:29 pm I found something, tiny things about regular expressions in the
WeatherComJSON_August 4, 2020.rmskin > WeatherComJSONMeasures.inc | Updated July 31, 2020

There is a code RegExp=(?siU)^(.*)$ for WebParser measure, but RegExp=(?s)^(.*)$ is fewer steps and faster to parse.
You'll find a lot of such things in any skin that uses regex though, not just here. While you're absolutely right that it takes more steps (I'm also careful in that regard, never using something if it's not functionally required), my feeling is that the (?siU) flags are used just as a way to "set and forget" in most skins, where this form is preferred "just in case", even though some of the individual flags are not always needed.

Just curious, why didn't you suggested ^([\s\S]*)$ instead? In your table it's the most efficient, and this is supported by various analyses by regex experts online, who point out that specifying the pattern as close as possible yields the best results in terms of speed. Some even suggest avoiding the . (dot, every character) pattern as often and whenever possible, and "narrow down" the pattern to make it faster.
nek
Posts: 44
Joined: November 3rd, 2019, 12:00 am

Re: ⭐ Weather.com - Parsing the V3 JSON - NEW!

Post by nek »

Yincognito wrote: January 30th, 2021, 9:03 pm Just curious, why didn't you suggested ^([\s\S]*)$ instead?
Because...
(?s)^.*$ is cool :thumbup: , and ^([\s\S]*)$ is not.
There are not any technical reasons at all.
I am not expert of the regular expressions, and I don't remember whitch \s \S is match with whitespace character.
I just feel that (?s)^.*$ is more easier to understand for people. That's it.
Last edited by nek on March 23rd, 2021, 6:45 pm, edited 1 time in total.
User avatar
Yincognito
Rainmeter Sage
Posts: 4052
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: ⭐ Weather.com - Parsing the V3 JSON - NEW!

Post by Yincognito »

nek wrote: January 30th, 2021, 10:09 pm Because...
(?s)^.*$ is cool :thumbup: , and ^([\s\S]*)$ is not.
There are not any technical reasons at all.
I am not expert of the regular expressions, and I don't remember whitch \s \S is match with whitespace character.
I just feel that (?s)^.*$ is easy to understand for everyone. That it.
Ah, ok, no problem - I'm not an expert either. I guess I was just confused as to why a technical reason was appropriate for a certain choice, while it wasn't for the other, that's all. :confused:

P.S. Remembering what \s and \S stand for is easy: in regex, lower-case are affirmations, while upper-case are negations (e.g. \d = digit, \D = not digit; \s = whitespace. \S = not whitespace; \w = word, \W= not word; etc).
Rucha
Posts: 3
Joined: August 7th, 2021, 1:53 pm

Re: ⭐ Weather.com - Parsing the V3 JSON - NEW!

Post by Rucha »

Any idea how to change unit of Pressure value form mb to mm Hg?
User avatar
Yincognito
Rainmeter Sage
Posts: 4052
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: ⭐ Weather.com - Parsing the V3 JSON - NEW!

Post by Yincognito »

Rucha wrote: August 17th, 2021, 7:13 am Any idea how to change unit of Pressure value form mb to mm Hg?
Only mb (millibar) and in (inch) are available as units for atmospheric pressure on weather.com, as far as I know, but you can use a Calc measure to convert the already existing pressure measure value to mmHg:

Code: Select all

[PressuremmHg]
Measure=Calc
Formula=(Pressuremb*750.062)
DynamicVariables=1
Obviously, you'll change Pressuremb to whatever the name of your mb returning pressure measure is, and use this new "PressuremmHg" measure instead of the old one in the MeasureName options of the corresponding meters.
User avatar
sl23
Posts: 810
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: ⭐ Weather.com - Parsing the V3 JSON - NEW!

Post by sl23 »

I just wondered if it would be ok to edit this, to suit my Rounded suite, for sharing?
If not I'd still like to add it to that suite, but will not share it. All credits will remain.

Thanks
User avatar
jsmorley
Developer
Posts: 22291
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: ⭐ Weather.com - Parsing the V3 JSON - NEW!

Post by jsmorley »

sl23 wrote: September 13th, 2021, 4:56 pm I just wondered if it would be ok to edit this, to suit my Rounded suite, for sharing?
If not I'd still like to add it to that suite, but will not share it. All credits will remain.

Thanks
Use this code any way at all that you want to!
User avatar
sl23
Posts: 810
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: ⭐ Weather.com - Parsing the V3 JSON - NEW!

Post by sl23 »

:thumbup: :D