Why does trunc() return 0?

Unit test fails even though values are equal I was stuck in the above problem. While trying to solve that, I wrote the following listing. I expect it to keep two digits after the decimal point. #include "simulation.hpp" #include <cstdio> typedef double real; double truncate_(double f) { return std::trunc(f * 100.0); } int main() {… Read More Why does trunc() return 0?

Extract number after dot google sheets

I have this Google sheets example. with a column of digits Input 37.39850912456523, 176.84092312542114 37.39850912456523, 17.84092312542115 37.39850912456523, 1.84092312542116 37.39850912456523, 176.84092312542117 3.39850912456523, 176.84092312542118 07.39850912456523, 176.84092312542119 3.39850912456523, 176.84092312542120 3.39850912456523, 6.84092312542121 I attempted this formula to get the progress table. =ArrayFormula(REGEXEXTRACT(A2:A9, "\d{1,3}\.(\d*), \d{1,3}\.(.{5})")) And when trying to get the 5 digits after the dot on the first capture… Read More Extract number after dot google sheets

Go, pgx: SELECT query returns only one row

Golang, pgx: I am trying to get all rows from t_example (currently 20 items), however for some reason only one returns (the first one). I tried to debug and rows.Next() returns false after the first iteration. Could you please help me with advice? I’m a newbie, but I’ve tried to find similar cases here in… Read More Go, pgx: SELECT query returns only one row

How to pass expected and actual value in paramererized test in JUnit 5

I am trying to implement Parameterized test in which I have a set of input and expected values which I want to test using assertEquals method of JUnit. I’m using JUnit version 5.x for this I am passing the input value to my custom method defined in other package (that I’m testing) and I am… Read More How to pass expected and actual value in paramererized test in JUnit 5

How to force git's pager to wrap long lines?

On most machines where I use git, long lines in the output of commands like git diff and git show are wrapped. On one machine, though, long lines are truncated, and I have to use the left and right arrow keys to scroll the screen horizontally. I don’t like this behavior at all, and I… Read More How to force git's pager to wrap long lines?

Select and Convert bytes object from a list

I have tried everything in my mind but wasn’t successfull. Can anybody help me to select bytes object from a list bellow? [(‘uid=xxxxxx,o=center’, {‘userCertificate;binary’: [b’0\x82\x07q0\x82\x05Y\xa0\x03\x02\x01\x02\x02\x10`\ …..’]})] This is the result from a openldap search and I want to select the userCertificate part of the entry and convert it to a base64 text. When I manually… Read More Select and Convert bytes object from a list

Get groups with duplicated values in PySpark

For example, if we have the following dataframe: df = spark.createDataFrame([[‘a’, 1], [‘a’, 1], [‘b’, 1], [‘b’, 2], [‘c’, 2], [‘c’, 2], [‘c’, 2]], [‘col1’, ‘col2’]) +—-+—-+ |col1|col2| +—-+—-+ | a| 1| | a| 1| | b| 1| | b| 2| | c| 2| | c| 2| | c| 2| +—-+—-+ I want to mark… Read More Get groups with duplicated values in PySpark

React Router Dom – React Router changing url but not page

I’m trying to make a simple routing system with react, but when i click on a link to navigate to another page it just changes the URL but not showing the content, then when i press F5 it shows anything fine. Here’s my code, i can’t understand what i’m doing wrong, i tried also to… Read More React Router Dom – React Router changing url but not page

"401 Error Code" using google script app fetch post

Hi everyone recently i have been trying to do a fetch post in app script, from an api called salesbinder(inventory system), i have managed to fetch and pulls all inventory data down, however i have been struggling to post and add document to it and received an error code -> "Truncated server response: {"message":"Unauthorized","url":"\/api\/2.0\/documents.json","code":401}" since… Read More "401 Error Code" using google script app fetch post