@description Regular expression ^ Beginning of string $ End of string
@description about (?siU) s modifier: single line. Dot . matches newline characters i modifier: insensitive. Case insensitive match (ignores case of [a-zA-Z]) U modifier: Ungreedy. The match becomes lazy by default. Now a ? following a quantifier makes it greedy
.* and (?U).*? are greedy, .*? and (?U).* are ungreedy (lazy).
IfMatch option behaves different from if ... elseif ... elseif ... elseif ... end,
It is something like if ... end. if ... end. if ... end. if ... end. ...
For instance, if the string value is 15, it matches 1 and IfMatchAction2 will be performed, then it matches 5 and IfMatchAction6 will be performed. Finally it will match 15.
[MeasureSetCounter]
Measure=String
Group=Counters
String=[MeasureIcon]
DynamicVariables=1
Disabled=1
UpdateDivider=-1
IfMatchMode=1
IfMatch=^
IfMatchAction=[!SetOption MeasureCounter Formula "Counter % 28"]
IfMatch2=^(?:19|20|21|22)$
IfMatchAction2=[!SetOption MeasureCounter Formula "Counter % 90"]
IfMatch3=^26$
IfMatchAction3=[!SetOption MeasureCounter Formula "Counter % 46"]
IfMatch4=^44$
IfMatchAction4=[!SetOption MeasureCounter Formula "Counter % 1"]
IfMatch=^ always return true, even if the string value is blank (empty string). IfMatchAction will be performed first, then evaluate the IfMatch2=, IfMatch3=, IfMatch4= on the [MeasureSetCounter] measure updating.
@description Regular expression ^ Beginning of string $ End of string (?:...) non-capturing group. (?:AB|CD|EF) AB or CD or EF
nek wrote:
Purpose of this chapter
◾ Learn what UpdateDivider and DefaultUpdateDivider are. (Refer to the description below)
◾ Learn what steps are taken during the Update cycle of a skin in Rainmeter. (⭐ How a skin is updated)
◾ Minimize the number of measures/meters those are updating in the skin update cycle, to reduce a Rainmeter.exe 's workload.
core_measure_ud.png
Left side: Normal Rainmeter skin. Right side: Optimized Rainmeter Date and Time skin. Set DefaultUpdateDivider=-1 on the [Rainmeter] and set UpdateDivider=1 on the Core Measure.
skin_type_core_measure.png
For Tiny Weather Animated skin, Core Measure are WebParser measure (weather data) and Calc:Counter measure (animation).
Rainmeter Documentation wrote:
UpdateDivider (default: 1) - Measure and Meter option
Frequency at which the measure/meter is updated. The Update option in the [Rainmeter] section of the skin is multiplied by the specified value to determine how often the measure/meter is updated.
Example: If Update=1000 (in the [Rainmeter] section) and UpdateDivider=30, the measure/meter is updated every 30 seconds.
If UpdateDivider=-1 or any negative number, then the measure/meter is only updated once when the skin is loaded or refreshed.
DefaultUpdateDivider (default: 1) - [Rainmeter] section option
This option is designed to set a default UpdateDivider for all measures and meters in the skin. It can be overridden by setting UpdateDivider on individual measures or meters.
(1) Set DefaultUpdateDivider=-1 option on the [Rainmeter]
Update=60 option is set for the Animation (16 fps) of the weather icon.
Using DefaultUpdateDivider=-1 option on the [Rainmeter] section is recommended.
The WebParser accesses and parses the remote resource every 15 minutes.
Q. What is Connection header for?
A. The Connection general header controls whether the network connection stays open after the current transaction finishes. If the value sent is keep-alive, the connection is persistent and not closed, allowing for subsequent requests to the same server to be done. (MDN Web Docs)
Q. Why should it be set Connection: close header? (WebParser: parser mode)
A. Setting header Connection: close on a WebParser measure is nice to HTTP/1.1 server and client.
If Connection: close header is NOT set on the WebParser measure, Connection: keep-alive mode is adopted by default.
The network connection (TCP) will be kept 60 - 100 seconds from the last transaction. Connection: keep-alive mode is designed for a web browser.
nek wrote:
Off Topic
All measure and meter have some tasks during updating itself. (⭐ How a skin is updated)
We can see how often the measures/meters are updating for debugging purpose.
Adding the following code and save then refresh the skin, open About Rainmeter window > Log tab
Changed: from v3-wx-forecast-daily-15day to v3-wx-forecast-daily-3day
Removed: v3alertsHeadlines and v3-wx-forecast-hourly-12hour
Response data: json file size: from 17 KB to 6 KB
The weather.com services have millions of api requests per second, I guess. We need to keep skins to be gentle to the servers.
When getting a whole string of a remote content, there is no need to capture with (), since the WebParser has already had the whole string data. (About Rainmeter > Skins > TinyWeather > WEATHER.COMSuperParent : String value).
You might use RegExp=\A[\s\S]*\z or RegExp=(?s)^.*$.
@description (?s) modifier: single line. Dot . matches newline characters ^ Beginning of string $ End of string \A Very beginning of string \z Very end of string \s Whitespace characters [\r\n\t\f\v ] \S Non-whitespace characters [^\r\n\t\f\v ]
Note that this is one of the examples of optimizing Rainmeter skin code. TinyWeather\Language\Language.ini file is not modified. You might apply units=s (m/s for wind speed) related things if you would like to.
Edited: 2023-12-23
Recommend checking out a new api key.
I won't touch the suggestions above (by the way, I'm one of the first, if not one of the few who, ever since I created my suite, only updated the weather once an hour as it's not changing every minute, and not using nominatim at all since it's no big deal to look for your geocode online on wiki), but just so folks know, that measurement units map linked above is not exactly accurate in practice, things are more consistent over the continent in that regard...