![]() |
#346 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,452
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Yes, it is possible. The compiled templates functions are kept in a few places such as in the db layer, in the template processor, and in action chains. It could be that one of these isn't being notified when the functions change.
|
![]() |
![]() |
![]() |
#347 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,039
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Quick question: I'm having issues with the placement of a fi:
Code:
program: vl = current_virtual_library_name(); if 'OVERDRIVE' inlist approximate_formats() && vl!='Loans' then 'overdrive.png' elif 'PAPERBOOK' inlist approximate_formats() && vl!='Physical Books' then 'book.png' elif '^(|Read|Unread|Currently Reading|On Device|Cleanup)$' in vl then if $#manualtype then 'helpbook.png' elif $#fanficcat then icons_fanfic() else 'view.png' fi fi Code:
program: vl = current_virtual_library_name(); if 'OVERDRIVE' inlist approximate_formats() && vl!='Loans' then 'overdrive.png' elif 'PAPERBOOK' inlist approximate_formats() && vl!='Physical Books' then 'book.png' elif '^(|Read|Unread|Currently Reading|On Device|Cleanup)$' in vl then if $#manualtype then 'helpbook.png' elif $#fanficcat then icons_fanfic() fi else 'view.png' fi If I want view.png to appear on any book that doesn't match the other checks on any VL, where should I put it? ![]() Last edited by ownedbycats; 02-17-2022 at 11:49 AM. |
![]() |
![]() |
![]() |
#348 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,452
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Last edited by chaley; 02-17-2022 at 12:46 PM. |
|
![]() |
![]() |
![]() |
#349 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,039
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Thanks.
![]() When using Action Chains to populate an enumerated column, should it be treated the same as other columns? I'm not sure what would happen if you tried to add a value that didn't exist in the permissible values list. |
![]() |
![]() |
![]() |
#350 | ||
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,452
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Quote:
|
||
![]() |
![]() |
![]() |
#351 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,039
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Basically, just inputting values the same as you would with a regular text column.
|
![]() |
![]() |
![]() |
#352 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,452
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Then yes. These columns are internally equivalent to "Text, column shown in the Tag browser" where a book can hold a single value. As I said above, assignment of a value that is not in the list of permitted values is ignored. It is up to you to ensure the value you assign is permitted.
|
![]() |
![]() |
![]() |
#353 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,039
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Quick question:
Code:
program: if $something then 'Yes' fi Code:
program: if $something then 'Yes' else 'No' fi |
![]() |
![]() |
![]() |
#354 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,452
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Returning 'No' is perhaps a microsecond per book slower when the template is processed, which is once per book when sorting. 'No' vs the empty string should make no difference at all.
|
![]() |
![]() |
![]() |
#355 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,039
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Question:
I have two timedate columns with a difference of less than an hour.* If I put the raw input into a days_between, depending on what order I either get 0.0 or -0.0. Is the negative intended or a bug? There's something called a signed zero but I don't quite understand what it means. I tried multiplying to see what would happen but still got -0.0. * 2022-03-19 02:03:12+00:00 and 2022-03-19 03:00:00+00:00 exactly. Last edited by ownedbycats; 03-19-2022 at 05:17 PM. |
![]() |
![]() |
![]() |
#356 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,452
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
If you don't like it, use round(), floor(), or ceiling(). Or convert the dates to timestamps, do the arithmetic, divide the result by 86,400 to get the fractional days, then format it with whatever precision you want. |
|
![]() |
![]() |
![]() |
#357 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,452
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Code:
program: format_number((-0.001), '.1f') You can see it without the formatter as the intermediary using the python command line interpreter. Code:
>>> '%.1f'%(0.01) '0.0' >>> '%.1f'%(-0.01) '-0.0' >>> '%.1f'%(-0.01/10) '-0.0' >>> '%.3f'%(-0.01/10) '-0.001' |
|
![]() |
![]() |
![]() |
#358 | |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,039
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
I found this: https://en.wikipedia.org/wiki/IEEE_754
Quote:
![]() |
|
![]() |
![]() |
![]() |
#359 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,452
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
The above discussion leaves out the complexity of floating point numbers that usually have three separate components: a sign, a "value", and an "exponent". Because (usually) the sign is separate from the number is it similar to sign-and-magnitude representation. See https://floating-point-gui.de/formats/fp/ for more explanation. |
|
![]() |
![]() |
![]() |
#360 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,039
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Question: What would be the best way to take an integer (say, from days_between) and then turn that into "x years, x months, x days"?
I started trying to make a template using fractional_part and I think multiply but it didn't come out right. ![]() |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Library Management: various questions not worth their own thread | ownedbycats | Library Management | 225 | 08-04-2025 06:31 PM |
[Metadata Source Plugin] Questions regarding parse select, docs and ref templates | Boilerplate4U | Development | 13 | 07-07-2020 02:35 AM |
Questions on Kobo [Interfered with another thread topic] | spdavies | Kobo Reader | 8 | 10-12-2014 11:37 AM |
[OLD Thread] Some questions before buying the fire. | darthreader13 | Kindle Fire | 7 | 05-10-2013 09:19 PM |
Thread management questions | meme | Feedback | 6 | 01-31-2011 05:07 PM |