@description Regular expression ^ Beginning of the string $ End of the 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
(?U).+ and .+? are ungreedy (lazy), .+ and (?U).+? are greedy.
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 the string $ End of the 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 the Rainmeter.exe 's workload.
core_measure_ud.png
Left side: Normal Rainmeter skin. Right side: Optimized Rainmeter skin. Set DefaultUpdateDivider=-1 on the [Rainmeter] and set UpdateDivider=1 on the Core Measures.
For TinyWeather 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 smooth Animation (16 fps) of the weather icon.
Using DefaultUpdateDivider=-1 option on the [Rainmeter] section is recommended.
nek wrote:
Off Topic
All measure and meter have some tasks during updating itself. (⭐ How a skin is updated)
You can see how often the measures/meters are updating in one second 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 remote contents, 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 the string $ End of the string \A Very beginning of the string \z Very end of the 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 like.
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...