Re: [Semibug] LibreOffice is summing incorrectly

2024-05-18 Thread admin

Jonathan Drews wrote on 2024-05-18 17:44:


I got a big problem. If I sum the column of numbers in LibreOffice Iget
43.81000
0.0
95.53000
21.9
18.9
37.72000
174.89000
16.73000
0.0
18.56000
0.0

423.02067

or rounded to two places 423.02


I get $428.04




But if I add them up using dc then I get the correct answer:

$ dc
2 k
43.81 95.53 21.90 18.90 37.72 174.89 16.73 13.56 + + + + + + + p
423.04


You have "13.56" in the second list of numbers but not the first, and 
"18.56" in the first set (not the second set).



In `bc`, I get:

scale = 4
43.81000 + 95.53000 + 21.9 + 18.9 + 37.72000 + 174.89000 + 
16.73000 + 18.56000

428.04000


rb

___
Semibug mailing list
Semibug@lists.nycbug.org
https://lists.nycbug.org:8443/mailman/listinfo/semibug


Re: [Semibug] Need an example of libxo usage

2024-04-13 Thread admin

Mike Wayne wrote on 2024-04-12 15:55:


Not too helpful.

-f specifies the lastlogin FILE to use, not fields


Ugh, confidently wrong.



As mentioned, I'm trying to use --libxo text, not xml


That's my dumb mistake.



Looking to get lastlogin to print a single line:
wayne last login: Fri Apr 12 15:06:16 2024 from 192.168.63.146


I'm guessing I need the printf equivalent for libxo but it appears
not to be documented anywhere.

I think JSON should do it via `jq`.


printf "%s last login %s from %s\n" $(lastlogin --libxo json | jq -r 
'.user,.login-time,.from')



I don't have any BSD system to try this on, but something like that 
ought to work.



Example:

└─» $ printf "%s %s %s\n" $(echo -n '{"user": "Wayne", "from": 
"192.168.63.146", "login_time": "today"}' | jq -r '.user, .login_time, 
.from')

Wayne today 192.168.63.146


A couple things to watch for: JSON / jq won't like a key with a hyphen, 
such as login-time.  I'd assume / hope that libxo would do the 
transformation required for proper JSON.



Also, IFS might need tweaking as the date containing spaces will get 
parsed into separate printf string placeholders.


Or some `sed` transforms.


rb


___
Semibug mailing list
Semibug@lists.nycbug.org
https://lists.nycbug.org:8443/mailman/listinfo/semibug


Re: [Semibug] Need an example of libxo usage

2024-04-12 Thread admin

Ron / BCLUG wrote on 2024-04-12 13:28:


Let us know if that works?



By the way, the prompt I gave ChatGPT (which requires no login these days):

using freebsd, how to choose output fields for command lastlogin 
--libxo xml,pretty ?



___
Semibug mailing list
Semibug@lists.nycbug.org
https://lists.nycbug.org:8443/mailman/listinfo/semibug