Tuesday, May 25, 2021

Recent Questions - Stack Overflow

Recent Questions - Stack Overflow


Use of the '<' operator in SAS

Posted: 25 May 2021 07:49 AM PDT

I have to convert some SAS code. In other programming languages I am used to < being used in comparisons e.g. in pseudo-code: If x < y then z

In SAS, what is the < operator achieving here:

intck(month,startdate,enddate)-(day(enddate)<day(startdate))

I have been able to understand the functions using the reference documentation but I can't see anything relating to how '<' is being used here.

Can someone explain the differences between "git merge -s ours" vs "git merge -X ours"?

Posted: 25 May 2021 07:49 AM PDT

I meant to run "git merge -X ours branch_A", but accidently ran "git merge -s ours branch_A" and found out only the logs were merged but not the content. So I wonder what are the differences between those two options? What is the use case of "-s ours"?

Student Taking More than One Class In Moodle

Posted: 25 May 2021 07:49 AM PDT

I have tried to do some research but all the answers dont quite address my simple problem. In my Moodle Course database I do a SQL Query to see what student completed a class within a 24 hour period. This works well, except if a student completes TWO courses in a 24 hour period it only lists the first course course they took.
Is there a way I can have the report show ALL the courses a student took in a given period of time?

    SELECT            c.shortname AS 'Course Name',            u.lastname AS 'Last Name',           u.firstname AS 'First Name',            u.email,            uid.data AS birthday,         DATE_FORMAT(FROM_UNIXTIME(p.timecompleted),'%m/%d/%Y %T') AS 'Completed Date'        FROM            prefix_course_completions AS p           JOIN prefix_course AS c ON p.course = c.id           JOIN prefix_user AS u ON p.userid = u.id           JOIN prefix_user_info_data AS uid ON uid.userid = u.id           JOIN prefix_user_info_field AS uif ON uid.fieldid = uif.id        WHERE             c.enablecompletion = 1           and uif.shortname = 'birthday'            and from_unixtime(p.timecompleted) >            date_sub(now(), interval 1 day)        GROUP BY u.username      ORDER BY c.shortname  

Connect Power BI Desktop to CRM Dynamics Sandbox data

Posted: 25 May 2021 07:49 AM PDT

I have a sandbox environment in CRM Dynamics with Organization login and Password. Which connector should I be using it from Power BI Desktop to connect to the CRM Dynamics App and get its data.

Kindly advise on this.

PL/SQL UTL_HTTP.REQUEST - Curly Braces/Semicolon

Posted: 25 May 2021 07:49 AM PDT

I'm trying to call a URL using the UTL_HTTP package in Oracle Autonomous Database and getting an ORA-06512:

ORA-06502: PL/SQL: numeric or value error: character to number conversion error  ORA-06512: at "SYS.UTL_HTTP", line 1810  ORA-06512: at "SYS.UTL_HTTP", line 144  ORA-06512: at "SYS.UTL_HTTP", line 1745  ORA-06512: at line 1  06502. 00000 -  "PL/SQL: numeric or value error%s"  *Cause:    An arithmetic, numeric, string, conversion, or constraint error             occurred. For example, this error occurs if an attempt is made to             assign the value NULL to a variable declared NOT NULL, or if an             attempt is made to assign an integer larger than 99 to a variable             declared NUMBER(2).  *Action:   Change the data, how it is manipulated, or how it is declared so             that values do not violate constraints.  

All network ACLS etc. are configured correctly.

The URL in question requires JSON directly in the URL which I understand is bad practice, however I don't have control over the API. If I remove the curly braces ( {} ) and semicolons ( : ), the request using UTL_HTTP works but the output is incorrect as the JSON becomes invalid.

I've tried encoding the URL, which gives the same error as above. An example of the URL format is: https://example.com/rest.php?entity=contact&action=get&json={"name": "Lorum Ipsum", "end_date": {"IS NULL": 1}, "return": "id,contact_id"}

How do I call this url using UTL_HTTP?

Fifty two week high and low

Posted: 25 May 2021 07:49 AM PDT

We have a records table with the following data. We need to fill fifty-two week(or 365 days)high and low amounts in ft_high and ft_low columns? How can we accomplish this in MySQL?

Fifty-two-week data including the same date.

id  user_id date    amount  ft_high ft_low  10  21  2020-10-11  1500    1800    950  11  22  2020-10-12  1950    2410    1738  12  21  2020-10-15  1150    1800    1500  ----------------------------------------  ----------------------------------------  99  21  2020-11-15  1950    1950    950  

Create a component that represent two table with OneToMany relation in one table

Posted: 25 May 2021 07:49 AM PDT

hi I am a beginar at ReactJs
I have an API that give me a result similar to this :

{"id":1,  "command":"gdf",  "product":[{ "id":1,               "name":"jhg"               "price":200},             { "id":2,               "name":"jhdg"               "price":300}            ....            ],  "total-price":***,  "date-commande:"******"    }  

and I want to represent it In a React component table similar to this image : enter image description here

I did a lot of research for table but I didn't find what I want so if someone can help me with the code to do this table in React or any kind of help I would be thankful :)

What is the best method for reading and storing TCP data as a client in LabWindows/CVI?

Posted: 25 May 2021 07:49 AM PDT

I am writing a TCP client DLL which is designed to read/write data with my UUT (which acts as the server). I am using the CVI TCP library. Per the examples of the library, I will use a synchronous callback function which will process messages that I receive as a client. This callback function will execute ClientTCPRead() when data is available as seen in below snippet. As you can see, when data is ready, the read function will store the data in the global g_recieveBuf array which is of type uint32_t.

enter image description here

Question 1:

when it comes to large messages that I receive and due to other TCP timing issues, I will often need multiple calls to read all the data. I believe the callback will handle this case. The case TCP_DATAREADY will continue executing until all the data is read. This, I believe is the utility provided by this library and what makes it such an easy process. My question is how do I properly concatenate data into my global array across multiple calls? I don't want to overwrite my array each time ClientTCPRead() is executed. For example if one large message is being sent by the server and multiple executions of the callback function take place to read all that data, I want it all captured properly in my array as one contiguous message. One of my colleagues suggested using a List construct (programmer's toolbox library). I don't quite understand what those are or what the advantage is of using them but any advice to solve above problem would be appreciated.

Question 2:

The data coming from the server is in binary format. It's a proprietary message structure with a known header size. The header also contains a field that tells me the total byte count (header and body) of the sever message. Is there any advantage to knowing this in terms of properly reading the data? I'm thinking that it doesn't matter because I am using the in-built callback function which will always read data if it's available. So why do I care how many bytes are coming if the callback function ensures it will all be read and stored in my global array (or other construct such as list if I use that method).

Thank you in advance.

Data of radio button not being saved in Postgres DB even after a success message

Posted: 25 May 2021 07:49 AM PDT

Hi so I have these radio buttons where I want to save their data as json in my Postgres db . It is not being sent I get a message.success back that says I did but when i check my db nothing happens. I don't exactly know where I am wrong so if u can help please do share. PS: Im using Ant Design vue that's where the a- come from . I do click on a button and it opens a modal where I have the radio buttons :

 <template #modalite="{ record }">      <span>        <a-button          @click="showModalite(record)"          class="btn btn-sm btn-light mr-2"        >          <i class="fe fe-edit mr-2" />          Modalité         </a-button>              </span>    </template>  

and here is my buttons code :

 <a-modal    v-model:visible="visible"    :width="500"    @ok="ChangeModalite(modelInfo)"  >   <div class="row">       <a-radio-group name="radioGroup" v-model:value="traitement">      <div class="col-md-6">Négociation directe</div>      <div class="col-md-3">        <a-radio value="Négociation directe"  v-model:checked="modalite.negociation" />      </div>      <div class="col-md-6">Appel à concurrence</div>      <div class="col-md-3">        <a-radio value="Appel à concurrence" v-model:checked="modalite.concurrence"/>      </div>       </a-radio-group>    </div>         </a-modal>  

The script :

setup() {  const visible = ref(false)   const traitement = ref('Négociation directe');  const modalite = ref({    negociation:false,    concurrence:false,  })   const showModalite = (record) => {    modelInfo.value = record    modalite.value = { ...modalite.value, ...record.modalite }    visible.value = true  }    const ChangeModalite = (record) => {    console.log(record.id+": "+traitement.value)      axios.patch('/prop/' + record.id,{      modalite:modalite.value,    })    .then(()=>{      record.modalite=modalite.value        Object.assign(          dataSource.value.filter((item) => record.id === item.id),          record,        )              message.success(`successfully updated !!`)      visible.value = false    })    .catch((e)=>{      message.warning("smthg wrong ")    })  }    return {    dataSource,    modelInfo,    showModalite,    ChangeModalite,    modalite,    traitement,       }    },           }  

So what happens now is i get the 'succefully updated ' msg without being really updated.where did i miss something?

Use actionButton() to play video inside modal dialog of a shiny dashboard

Posted: 25 May 2021 07:48 AM PDT

I have the shiny dashboard below which includes an actionButton(). When this is pressed a modal dialog appears with another actionButton(). When I press it I want the video that can be downloaded from here and is saved inside a subdirectory named www to be played inside the modal.

library(shiny)  library(shinydashboard)    ui <- dashboardPage(    dashboardHeader(titleWidth = 0                    # Set height of dashboardHeader                    ),        dashboardSidebar(),    dashboardBody(      tags$div(style="display:inline-block",title="Using the range slider",actionButton("info","",icon = icon("info-circle"),style='padding:10px; font-size:80%')),          )  )    server <- function(input, output) {    observeEvent(input$info,{      showModal(modalDialog(        title = span(h3(strong("Distribution of cumulative reported cases (logarithmic scale)"), style = 'font-size:16px;color:#6cbabf;')),            tags$div(style="display:inline-block",title="Using the range slider",actionButton("play","",icon = icon("play"),style='padding:10px; font-size:80%')),          #tags$video(id="video2", type = "mov",src = "Screen Recording 2021-05-25 at 4.03.51 AM.mov", controls = "controls")              ))          })      }    shinyApp(ui, server)  

Not getting parameter type checked TypeScript

Posted: 25 May 2021 07:48 AM PDT

So im doing a Vuejs program with TypeScript, but my TypeScript isnt cheking the parameter value type in my function call.

App.vue

<template>    <div class="app">      <p> {{ name }} </p>      <button @click="changeName(2)">change name</button>    </div>  </template>    <script lang="ts">  import { defineComponent } from "vue";    export default defineComponent({    name: "App",    components: {},    data() {      return {        name: "Link",      };    },    methods: {      changeName(name: string) {        this.name = name;      },    },  });  </script>  

In my button i call changeName passing 2 as a value and i dont get any error eventhough i´ve declared that name should be a string.

Im expecting to get a warning or an error when passing different type values than declared.

New to sql could someone walk me through this query

Posted: 25 May 2021 07:48 AM PDT

Hi I'm in my first semester of CS and we started working with sql in microsoft sql server management studio. We got home work to write the following query: "Write an SQL query to print the name of employees having the highest salary in each department". My understanding is still not good enough to write this query. I found where the lecturer copied the homework as well as the answer but unfortunately I do not fully understand what is wrong. I would appreciate if someone could walk me through the logic behind this query:

https://www.techbeamers.com/sql-query-questions-answers-for-practice/

SELECT t.DEPARTMENT,t.FIRST_NAME,t.Salary   from(SELECT max(Salary) as TotalSalary,DEPARTMENT   from Worker  group by DEPARTMENT) as TempNew   Inner Join Worker t on TempNew.DEPARTMENT=t.DEPARTMENT and TempNew.TotalSalary=t.Salary;  

useEffect with empty array doesn't behave as componentDidMount()

Posted: 25 May 2021 07:49 AM PDT

I have the following problem. I need to set the state of the app component after the onSnapshot event. That's why I have put that in the componentDidMount() and it works fine it logs the set user, however when I put the same code in a useEffect with an empty dependency array it logs null. Any ideas?

Here are the two components:

Class

class App extends Component<{}, AppState> {      constructor(props: any) {          super(props);            this.state = {              currentUser: undefined,          };      }        unsubscribeFromAuth = () => {};        componentDidMount() {          this.unsubscribeFromAuth = auth.onAuthStateChanged(async (userAuth) => {              if (userAuth) {                  const userRef = await createUserProfileDoc(userAuth);                    userRef?.onSnapshot((snapShot) => {                      this.setState({                          currentUser: {                              id: snapShot.id,                              ...snapShot.data(),                          },                      });                        console.log(this.state);                  });              }          });      }        componentWillUnmount() {          this.unsubscribeFromAuth();      }        render() {          return (              <div>                  <Header currentUser={this.state.currentUser} />                  <Switch>                      <Route exact path="/" component={HomePage} />                      <Route path="/shop" component={ShopPage} />                      <Route path="/signin" component={SignInUpPage} />                  </Switch>              </div>          );      }  }  

Functional

function App() {      const [currentUser, setCurrentUser] = useState<User | null>(null);      useEffect(() => {          let unsubscribeFromAuth = () => {};          const afterMount = () => {              unsubscribeFromAuth = auth.onAuthStateChanged(async (userAuth) => {                  if (userAuth) {                      const userRef = await createUserProfileDoc(userAuth);                        userRef?.onSnapshot((snapShot) => {                          setCurrentUser({                              id: snapShot.id,                              ...snapShot.data(),                          });                            console.log(currentUser);                      });                  }              });          };          afterMount();          return () => {              unsubscribeFromAuth();          };      }, []);      return (          <div>              <Header currentUser={currentUser} />              <Switch>                  <Route exact path="/" component={HomePage} />                  <Route path="/shop" component={ShopPage} />                  <Route path="/signin" component={SignInUpPage} />              </Switch>          </div>      );  }    export default App;  

how to resize, and move vtk window inside QT?

Posted: 25 May 2021 07:49 AM PDT

I'm integrating vtk rendered shapes inside QT, the goal is to be able to insert vtk window to some resizable, and movable convas such that in can paint over it with QT, resize it, and move it around in the canvas, how to make such integration?

Edited: i have little experience with Qt apparently, i'm looking for the right resizable and movable viewer/window in QT that i can use as parent for vtk rendering.

Using dynamoDB global tables for migrating data across regions

Posted: 25 May 2021 07:49 AM PDT

I am trying to move data from one table in one region to another region. Could I use global tables to accomplish this? The idea is to have the global table create the copy in the other region and then delete the old table. Is there a better way to do this?

Issue with number tags via XSLT

Posted: 25 May 2021 07:49 AM PDT

Output date:

<products xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1">  <product>  <sku>SKU 11077</sku>  <imgs>  <image>https://testtest.com/_data/products/sku-11077sku-11077.jpg</image>  <image>https://testtest.com/_data/products/sku-11077sku-11077,1.jpg</image>  <image>https://testtest.com/_data/products/sku-11077sku-11077,2.jpg</image>  <image>https://testtest.com/_data/products/sku-11077sku-11077,3.jpg</image>  <image>https://testtest.com/_data/products/sku-11077sku-11077,4.jpg</image>  </imgs>  </product>  </products>  

I try convert using XSLT 1.0 to get result number tags <image1>:

<products xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1">  <product>  <sku>SKU 11077</sku>  <imgs>  <image1>https://testtest.com/_data/products/sku-11077sku-11077.jpg</image1>  <image2>https://testtest.com/_data/products/sku-11077sku-11077,1.jpg</image2>  <image3>https://testtest.com/_data/products/sku-11077sku-11077,2.jpg</image3>  <image4>https://testtest.com/_data/products/sku-11077sku-11077,3.jpg</image4>  <image5>https://testtest.com/_data/products/sku-11077sku-11077,4.jpg</image5>  </imgs>  </product>  </products>  

I try to do via code:

<?xml version="1.0" encoding="UTF-8"?>  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:g="http://base.google.com/ns/1.0">  <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>  <xsl:template match="products">  <xsl:element name="products">    <xsl:for-each select="product">      <xsl:element name="product">           <xsl:element name="sku">               <xsl:value-of select="sku"/>           </xsl:element>       <xsl:template match="imgs">      <xsl:copy>        <xsl:for-each select="image">          <xsl:element name="image{position()}">            <xsl:value-of select="."/>          </xsl:element>        </xsl:for-each>      </xsl:copy>    </xsl:template>                            </xsl:element>    </xsl:for-each>  </xsl:element>  </xsl:template>  </xsl:stylesheet>  

I get issue:

But after paste your code we get: Warning: XSLTProcessor::importStylesheet(): compilation error: file /home/fs/domains/public_html/pub/ line 18 element template in /home/fs/domains/public_html/vendor/firebear/importexport/Model/Output/Xslt.php on line 107

Can someone help me format this?

Mongo and Mongoose - .find() returns different values

Posted: 25 May 2021 07:49 AM PDT

Stumped here and it should be something extremely simple.

I have a MERN stack application that is not finding data from mongo as expected.

From the frontend I post and update the document. I log into the Mongo CLI and I can see the data that I have saved.

But with the Node application, Mongoose does not return the full document.

Here is my route to get the document -- I even try to test getting Everything.

router.get("/", async (req, res) => {    const user_email = req.query.user_email;    const course_id = req.query.course_id;    const test = await CourseProgressSchema.find({      _id: "60acfd1c969cac0bd3a213a8",    });    console.log(test);    try {      let course_progress;      if (user_email && course_id) {        course_progress = await CourseProgressSchema.findOne({          user_email,          course_id,        });        if (!course_progress) {          const newCourseProgress = new CourseProgressSchema({            user_email,            course_id,          });          course_progress = await newCourseProgress.save();        }      } else if (user_email && !course_id) {        course_progress = await CourseProgressSchema.find({ user_email });      } else if (course_id && !user_email)        course_progress = await CourseProgressSchema.find({ course_id });      else {        res.json({ error: "Not Found." });      }      console.log(course_progress);      res.json({ success: course_progress });    } catch (error) {      console.log(error);      res.json({        error: "Soemthing went wrong when getting current course progress.",      });    }  });  

course_progress is consoled/returned as:

[0] [  [0]   {  [0]     _id: 60acfd1c969cac0bd3a213a8,  [0]     user_email: 'nickisyourfan@icloud.com',  [0]     course_id: '60acfcfe969cac0bd3a213a7',  [0]     __v: 0  [0]   }  [0] ]    

But if I acccess the mongo cli and use db.courseprogressscchemas.find().pretty() It returns the updated document:

{      "_id" : ObjectId("60acfd1c969cac0bd3a213a8"),      "user_email" : "nickisyourfan@icloud.com",      "course_id" : "60acfcfe969cac0bd3a213a7",      "__v" : 0,      "course_progress" : {          "60acfca1969cac0bd3a213a5" : {            }      }  }    

Here is my Schema - nothing special:

const mongoose = require("mongoose");  const Schema = mongoose.Schema;    const CourseProgressSchema = new Schema({    user_email: {      type: String,      required: true,    },    course_progress: {      type: Object,      required: true,      default: {},    },    course_id: {      type: String,      required: true,    },  });    module.exports = CourseProgress = mongoose.model(    "CourseProgressSchema",    CourseProgressSchema  );  

Can anyone help me to figure out why mongoose is only returning part of the document rather than the whole thing?

Fabric js how to prevent object scaling outside the canvas boundaries?

Posted: 25 May 2021 07:49 AM PDT

Before this question gets classes as duplicate, let me explain the issue. I want to prevent objects getting scaled outside of the canvas boundaries, and I kind of got it working. But the issue I'm facing is that when you drag an object to the center and scale it all the way to one of the borders, it gets restricted to to be scaled to the opposite border.

I tried solutions from multiple answers on this matter, but none seems to be working.

I included a fiddle so you can see my problem. https://jsfiddle.net/nkzyaq4b/4/

It has something to do with the way I check if an object crossed a boundary, but I cant figure out how to get it right

let scalingProperties = {      'left': 0,      'top': 0,      'scaleX': 0,      'scaleY': 0,  }    export function scaling(e) {      let shape = e.target;      let maxWidth = shape.canvas.width;      let maxHeight = shape.canvas.height;        //left border      if(shape.left <= 0) {          shape.left = scalingProperties.left = 0;          shape.scaleX = scalingProperties.scaleX;      } else {          scalingProperties.left = shape.left;          scalingProperties.scaleX = shape.scaleX;      }        //right border      if((scalingProperties.scaleX * shape.width) + shape.left >= maxWidth) {          shape.scaleX = (maxWidth - scalingProperties.left) / shape.width;      } else {          scalingProperties.scaleX = shape.scaleX;      }        //top border      if(shape.top <= 0) {          shape.top = scalingProperties.top = 0;          shape.scaleY = scalingProperties.scaleY;      } else {          scalingProperties.top = shape.top;          scalingProperties.scaleY = shape.scaleY;      }        //bottom border      if((scalingProperties.scaleY * shape.height) + shape.top >= maxHeight) {          shape.scaleY = (maxHeight - scalingProperties.top) / shape.height;      } else {          scalingProperties.scaleY = shape.scaleY;      }  }  

How to store averages per hour in a new table?

Posted: 25 May 2021 07:49 AM PDT

I have the following table in mySQL, php:

table1:

Value1 Timestamp  312    2021-05-25 16:33:15  350    2021-05-25 16:33:25  411    2021-05-25 16:33:35  308    2021-05-25 16:33:45  etc  

This table stores values in real time, every 10 seconds.

I would like to take the hourly averages of the values in table1 and store them in another table:

table2:

Value2 Timestamp  325    2021-05-25 16:59:59  330    2021-05-25 17:59:59  289    2021-05-25 18:59:59  

I assume that I have to store the previous' hour average because the current hour's average is still changing. And that I have to store a value, once per hour.

How to get input from website to field.integer() in Python Odoo

Posted: 25 May 2021 07:49 AM PDT

I'm using field.Integer() and I think my question is very easy for an Odoo experts

How to get xml from website to field.integer() in Python ?

I tried this code below but when I change the value in the form, the compute result is not changing. I don't understand where is my mistake.

Regards,

model.py:

name = fields.Char()  biography = fields.Html()  nbr1 = fields.Integer()  result = fields.Integer(compute="_compute_total")            @api.onchange('nbr1')  def _compute_total(self):      for record in self:          record.result = 2*self.nbr1  

template.xml:

<h3 t-field="person.name"/>  <p>Last modified: <i t-field="person.write_date"/></p>  <div t-field="person.biography"/>  <p>      <label>nbr1</label> : <input type="number" t-attf-href="person.nbr1" name="nbr1"/>      <a t-attf-href="perso">      <t t-esc="person.nbr1"/></a>  </p>  <h3 t-field="person.nbr1"/>  <h3 t-field="person.result"/>  

Android studio does not sees my project (I can't run it)

Posted: 25 May 2021 07:49 AM PDT

I am new to Android studio, but I decided to write my first app using kivy and then with help of buildozer create .apk file out of it.

App works on my ubuntu when running python main.py.

enter image description here

After some struggle (following the video https://www.youtube.com/watch?v=yr7n0C2tspI&ab_channel=ShawCode) it worked and command buildozer -v android debug worked creating .apk file.

I uploaded it to google drive and then installed on my phone, but it did not start (black screen for a couple of seconds and then it exits).

I decided it would be a good idea to try to debug it using Android-studio and launched it but as I am new to it I am not quite sure how to use it.

I tried to open directory when the project is located, but it acts, as it could not run it.

enter image description here

Anyone has idea what I am doing wrong, or how to fix this situation?

[EDIT] I managed to run LogCat and extract logs (warnings and errors) from my app. Here they are:

2021-05-25 12:52:59.581 19114-19130/org.test.misia W/libEGL: [ANDROID_RECORDABLE] format: 1  2021-05-25 12:53:02.495 19114-19143/org.test.misia E/libEGL: validate_display:99 error 3008 (EGL_BAD_DISPLAY)  2021-05-25 12:53:02.499 19114-19143/org.test.misia W/libEGL: [ANDROID_RECORDABLE] format: 1  

Unfortunately they don't say much. Anyone able to translate them and see what causes it?

What's the difference using extension type (cdef) and set up pure python code?

Posted: 25 May 2021 07:49 AM PDT

Note that I'm new to the C language. According to Basic Tutorial of Cython, I believe there are two ways of using Cython: Building the extension of pure Python code, and using Ctype variable (cdef).

What I don't understand is the difference between them. Which one of them is the more efficient or proper way to using Cython?

CSS grid: minmax with a max value of auto fails to adjust to the height of children

Posted: 25 May 2021 07:48 AM PDT

Below is a snippet with a minimum repro case of what I thought, after reading the docs, should work, but doesn't. The snippet contains a grid with three rows: top, middle, and bottom. The height of the middle row of the grid is defined as minmax(50px, auto), which I took to mean "no smaller than 50px, but grow up to the max content height if necessary". The div placed in the middle row has a set height, which is greater than the 50px in the minmax. As you can see by running the snippet, the middle row will overlap with the bottom one. This is because the middle row fails to expand vertically to accommodate the larger height of its content.

html, body {    height: 100%;  }    .outer-grid {    height: 100%;    display: grid;    grid-template-rows: auto minmax(50px, auto) 1fr;  }    .top {    background-color: yellow;  }    .middle {    height: 100px;    background-color: rgba(0, 255, 0, 0.4);  }    .bottom {    height: 600px;    background-color: rgba(0, 0, 255, 0.4);  }
<div class="outer-grid">    <div class="top">top</div>    <div class="middle">middle</div>    <div class="bottom">bottom</div>  </div>

The overlap can be fixed by changing grid-template-rows: auto minmax(50px, auto) 1fr; to grid-template-rows: auto auto 1fr;, like so:

html, body {    height: 100%;  }    .outer-grid {    height: 100%;    display: grid;    grid-template-rows: auto auto 1fr;  }    .top {    background-color: yellow;  }    .middle {    height: 100px;    background-color: rgba(0, 255, 0, 0.4);  }    .bottom {    height: 600px;    background-color: rgba(0, 0, 255, 0.4);  }
<div class="outer-grid">    <div class="top">top</div>    <div class="middle">middle</div>    <div class="bottom">bottom</div>  </div>

but this, of course, will lose the minimum height of the row. Could you please help me understand why the minmax setting isn't working as I am expecting it to, and what is the correct way to both ensure the minimum height of the row and to make sure it will grow to fit the height of the children.

LPC18S37 pin configuration

Posted: 25 May 2021 07:49 AM PDT

I have LPC18S37(TFBGA100) on a custom board. I need some basic pin configuration help. In order to prevent back and forth between several files, I've extracted a piece of code from pin configurations of a working application (see below).

LPC18xx.h

/* BSP */  #include "LPC18xx.h"    #define LPC_SCU_BASE              0x40086000  #define LPC_GPIO_PORT             ((LPC_GPIO_PORT_Type      *) LPC_GPIO_PORT_BASE)    /** Port offset definition */  #define PORT_OFFSET     0x80  /** Pin offset definition */  #define PIN_OFFSET      0x04    /* Pin modes */  #define MD_PUP  (0x0<<3)  #define MD_BUK  (0x1<<3)  #define MD_PLN  (0x2<<3)  #define MD_PDN  (0x3<<3)  #define MD_EHS  (0x1<<5)  #define MD_EZI  (0x1<<6)  #define MD_ZI   (0x1<<7)  #define MD_EHD0 (0x1<<8)  #define MD_EHD1 (0x1<<8)  #define MD_PLN_FAST (MD_PLN | MD_EZI | MD_ZI | MD_EHS)  // 0xF0    /* Pin function */  #define FUNC0           0x0             /** Function 0  */  #define FUNC1           0x1             /** Function 1  */  #define FUNC2           0x2             /** Function 2  */  #define FUNC3           0x3             /** Function 3  */  #define FUNC4           0x4  #define FUNC5           0x5  #define FUNC6           0x6  #define FUNC7           0x7    #define LPC_SCU_PIN(po, pi)   (*(volatile int         *) (LPC_SCU_BASE + ((po) * 0x80) + ((pi) * 0x4))    )  #define LPC_SCU_CLK(c)        (*(volatile int         *) (LPC_SCU_BASE + 0xC00 + ((c) * 0x4))    )    /*********************************************************************//**   * @brief       Configure pin function   * @param[in]   port    Port number, should be: 0..15   * @param[in]   pin     Pin number, should be: 0..31   * @param[in]   mode    Pin mode, should be:   *                  - MD_PUP    :Pull-up enabled   *                  - MD_BUK    :Plain input   *                  - MD_PLN    :Repeater mode   *                  - MD_PDN    :Pull-down enabled   * @param[in]   func    Function mode, should be:   *                  - FUNC0     :Function 0   *                  - FUNC1     :Function 1   *                  - FUNC2     :Function 2   *                  - FUNC3     :Function 3   * @return      None   **********************************************************************/  void scu_pinmux(uint8_t port, uint8_t pin, uint8_t mode, uint8_t func)  {    uint32_t * scu_base=(uint32_t*)(LPC_SCU_BASE);    scu_base[(PORT_OFFSET*port+PIN_OFFSET*pin)/4]=mode+func;  } /* scu_pinmux */  void GPIO_SetDir(uint8_t portNum, uint32_t bitValue, uint8_t dir)  {    if (dir)    {      LPC_GPIO_PORT->DIR[portNum] |= bitValue;    } else      {        LPC_GPIO_PORT->DIR[portNum] &= ~bitValue;      }  }      #define D3_SCU_CONFIG   0xD, 14, MD_PLN, FUNC4    #define D3_SCU_PIN 14  #define D3_SCU_PORT 0xD  #define D3_GPIO_PORT    6  #define D3_GPIO_PIN     28  #define D3_GPIO_MASK    (1 << D3_GPIO_PIN)    /*     This is where we set pins in the application.  */  scu_pinmux(D3_SCU_CONFIG);  GPIO_SetDir(D3_GPIO_PORT, D3_GPIO_MASK, 1);  

In the datasheet for pin description says;

On the LPC185x/3x/2x/1x, digital pins are grouped into 16 ports, named P0 to P9 and PA to PF, with up to 20 pins used per port. Each digital pin can support up to eight different digital functions, including General-Purpose I/O (GPIO), selectable through the SCU registers. The pin name is not indicative of the GPIO port assigned to it.

This description is not what I am used to comparing to my previous device (LPC1769), there was no such register called SCU.

Particularly I am confused between SCU_PIN(or PORT) and GPIO_PIN(or PORT). While I can understand GPIO_PIN, SCU_PIN highly confuses me.

enter image description here

I need to setup GPIO3[5] (bga pin-out is F8) as an output for a LED. How should I setup those definitions accordingly then?

#define D3_SCU_CONFIG   0xD, 14, MD_PLN, FUNC4    #define D3_SCU_PIN 14  #define D3_SCU_PORT 0xD  #define D3_GPIO_PORT    6  #define D3_GPIO_PIN     28  #define D3_GPIO_MASK    (1 << D3_GPIO_PIN)  

So, I wonder where number 28 comes from as GPIO_PIN as shown above?! Any pointer regarding pin definition on this device highly appreciated.

JPA - How to update child object in OneToMany relationship?

Posted: 25 May 2021 07:49 AM PDT

I have a Customer class where each customer can have multiple Products. The class is as follow:

@Entity  @Table(name = "customer")  public class Customer {    @Id  @GeneratedValue(strategy = GenerationType.IDENTITY)  @Column(name = "id")  private Long id;  @Column(name = "firstName")  private String firstName;    @Column(name = "lastName")  private String lastName;    @OneToMany(targetEntity=Product.class, mappedBy = "customer", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY)  @PrimaryKeyJoinColumn  @JsonManagedReference  private List<Product> products = new ArrayList<>();    //getters and setters here    }  

and the Product class holds OneToOne relation with other Classes and it is as follows:

@Entity  @Table(name = "product")    public class Product {    @Id  @GeneratedValue(strategy = GenerationType.AUTO)  private Long id;    @ManyToOne(targetEntity=Customer.class, fetch = FetchType.LAZY)  @JoinColumn(name = "customer_id")  @JsonBackReference  private Customer customer;    @OneToOne(mappedBy = "product", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY)  @PrimaryKeyJoinColumn  @JsonManagedReference  private SomeType1 someType1;    @OneToOne(mappedBy = "product", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY)  @PrimaryKeyJoinColumn  @JsonManagedReference  private SomeType2 someType2;    @OneToOne(mappedBy = "product", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY)  @PrimaryKeyJoinColumn  @JsonManagedReference  private SomeType3 someType3;    @OneToOne(mappedBy = "product", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY)  @PrimaryKeyJoinColumn  @JsonManagedReference  private SomeType4 someType4;      //getters and setters here        }  

I am trying to achieve following functionality with this:

Given Customer ID and Product ID, update the values in SomeType1, SomeType2, SomeType3 classes. I am getting the updated SomeType1, SomeType2, SomeType3 objects from UI and I want to update the values in DB. I already have PUT method in place for this.

Here's the PUT method:

@PutMapping(value = "customer/{id}/product/{product_id}")  @ResponseBody  public ResponseEntity<Product> updateProduct(@PathVariable final String id,           @PathVariable final String product_id, @RequestBody final Product product) {      Optional<Customer> customerInDb = customerService.getCustomerById(id);      if (!customerInDb.isPresent()) {          throw new ResponseStatusException(HttpStatus.NOT_FOUND,                  MessageFormat.format("Customer with id {0} does not exist.", id));      } else {          product.setId(Long.valueOf(product_id));          product.setCustomer(customerInDb.get());          Product savedProduct = customerService.createProduct(product);          return ResponseEntity.ok(savedProduct);      }  }  

I am getting following error for this REST call:

javax.persistence.EntityExistsException: A different object with the same identifier value was already associated with the session : [com.myapp.arg.entities.SomeType2#12]  

What could be the reason for this?

createProduct method:

@Override  public Product createProduct(Product product) {      Product savedProduct = productRepository.save(product);      return savedProduct;  }  

JSON input to the PUT method:

{     "id":9,     "someType1":{        "id":9,        "avg":20,        "total":20     },     "someType2":{        "id":9,        "circum":45.0,        "strength":45.0,        "totalNav":0.0     },     "someType3":{        "id":9,        "tensile":87,        "pull":128,        "push":56,        "upward":28.0     },     "measuredBy":"SJ",     "addedDate":"2021-05-23",     "type":"Prime"  }  

AttributeError: 'Page1' object has no attribute 'attributes'

Posted: 25 May 2021 07:49 AM PDT

I want to put my window above and I used self.attributes("-topmost", True) for this with tkinter. But it raises

Attribute Error: 'Page1' object has no attribute 'attributes'`

I used self.lift() instead this but it doesn't work. Can somebody help me?

import tkinter as tk    x=input("Type something")    class Page(tk.Frame):      def __init__(self, *args, **kwargs):          tk.Frame.__init__(self, *args, **kwargs)      def show(self):          self.attributes("-topmost", True)            class Page1(Page):     def __init__(self, *args, **kwargs):         Page.__init__(self, *args, **kwargs)         label = tk.Label(self, text="This is page 1")         label.pack(side="top", fill="both", expand=True)    class Page2(Page):     def __init__(self, *args, **kwargs):         Page.__init__(self, *args, **kwargs)         label = tk.Label(self, text="This is page 2")         label.pack(side="top", fill="both", expand=True)    class Page3(Page):     def __init__(self, *args, **kwargs):         Page.__init__(self, *args, **kwargs)         label = tk.Label(self, text="This is page 3")         label.pack(side="top", fill="both", expand=True)    class MainView(tk.Frame):      def __init__(self, *args, **kwargs):          tk.Frame.__init__(self, *args, **kwargs)          p1 = Page1(self)          p2 = Page2(self)          p3 = Page3(self)         buttonframe = tk.Frame(self)      container = tk.Frame(self)      buttonframe.pack(side="top", fill="x", expand=False)      container.pack(side="top", fill="both", expand=True)        p1.place(in_=container, x=0, y=0, relwidth=1, relheight=1)      p2.place(in_=container, x=0, y=0, relwidth=1, relheight=1)      p3.place(in_=container, x=0, y=0, relwidth=1, relheight=1)        b1 = tk.Button(buttonframe, text="Page 1", command=p1.lift)      b2 = tk.Button(buttonframe, text="Page 2", command=p2.lift)      b3 = tk.Button(buttonframe, text="Page 3", command=p3.lift)         b1.pack(side="left")      b2.pack(side="left")      b3.pack(side="left")           p1.show()    if __name__ == "__main__":      root = tk.Tk()      main = MainView(root)      main.pack(side="top", fill="both", expand=True)      root.wm_geometry("400x400")      root.mainloop()  

Mybatis and Spring data with hibernate together

Posted: 25 May 2021 07:49 AM PDT

We have a project which is using Spring data with hibernate as ORM. Now we are introducing new feature for which we want to use Mybatis and eventually replace hibernate with Mybatis in all of the project but in the meanwhile can Mybatis and Hibernate live together for sometime until we make total switch. I am particularly concerned with Mybatis and Hibernate will share connection pool i.e. Hikari CP (default connection pooling that comes with spring boot, yes this project is Spring boot project!). I am not 100% sure that data source will be shared between both of them? So the question is how feasible is to have Mybatis and Hibernate together for some time ?

Reflect List Data Back Into UI [Flutter]

Posted: 25 May 2021 07:49 AM PDT

Let's say users have chosen their interests at frontend and the data is stored in backend, how to then reflect that list of interests (string) from backend back to the front end on another page where users want to update their interests (and this gets updated on the list again on backend)?

The general chronology is like 1.) User chooses interest on font end > 2.) print list, populate backend > 3.) user visits settings page to change interests > 4.)backend list data reflect back onto UI what user has chosen previously > 5.) user updates interests > 6.) list gets updated to backend again.

I'm stuck on step 4.), any guidance is appreciated, thanks!

User chosen interests

Attached is my truncated code for a particular theme of interests, all the themes have the same code just different list.

Let's say my data has a list of [ "🏡 Home-body", "🏃‍♀️ Running", "🧘🏻‍♀️ Yoga", "🎭 Theaters", "😸 Anime & Manga",]. What can be done so that the UI of the list reflected back to the interest page as bool isChosen? Following which users can select and unselect anytime?

final List<String> artsInterests = [    "📸 Photography",    "🎭 Theaters",    "🖼️ Exhibitions",    "📐 Architecture",    "🍳‍ Cooking",    "☕ Coffee",    "🖍️ Design",    "👗 Fashion",    "📚 Reading",    "💃🏽 Dance",    "🏺 Pottery",    "🎨 Drawing",    "💋 Beauty",    "📖 Journalling",  ];    var chosenInterests = chosenSportsInterests +      chosenEntertainmentInterests +      chosenCharacterInterests +      chosenArtsInterests +      chosenWellnessInterests +      chosenLanguageInterests;    class ArtsInterests extends StatelessWidget {    const ArtsInterests({      Key key,      @required this.artsInterests,    }) : super(key: key);      final List<String> artsInterests;      @override    Widget build(BuildContext context) {      return Column(children: [        Container(          margin: EdgeInsets.only(              left: MediaQuery.of(context).size.width * 0.045,              top: MediaQuery.of(context).size.height * 0.033),          child: Align(              alignment: Alignment.centerLeft,              child: Text(                '🎨 Arts',                style: TextStyle(fontWeight: FontWeight.bold, fontSize: 21),              )),        ),        Column(          children: [            Padding(              padding: EdgeInsets.only(                  left: MediaQuery.of(context).size.width * 0.03,                  top: MediaQuery.of(context).size.height * 0.012),              child: Container(                width: MediaQuery.of(context).size.width,                height: MediaQuery.of(context).size.height * 0.045,                child: ListView.builder(                    shrinkWrap: true,                    scrollDirection: Axis.horizontal,                    padding: const EdgeInsets.all(1),                    itemCount: 7,                    itemBuilder: (context, int index) {                      return Interests2(AvailableInterestChosen(                        artsInterests[index],                        isChosen: false,                      ));                    }),              ),            ),            Padding(              padding: EdgeInsets.only(                  left: MediaQuery.of(context).size.width * 0.03,                  top: MediaQuery.of(context).size.height * 0.003),              child: Container(                width: MediaQuery.of(context).size.width,                height: MediaQuery.of(context).size.height * 0.045,                child: ListView.builder(                    shrinkWrap: true,                    scrollDirection: Axis.horizontal,                    padding: const EdgeInsets.all(1),                    itemCount: artsInterests.length - 7,                    itemBuilder: (context, int index) {                      return Interests2(AvailableInterestChosen(                        artsInterests[7 + index],                        isChosen: false,                      ));                    }),              ),            ),          ],        ),      ]);    }  }    List<String> chosenArtsInterests = [];    class Interests2 extends StatefulWidget {    final AvailableInterestChosen viewInterest;      Interests2(this.viewInterest);      String id = 'Interests2';      @override    Interests2State createState() => Interests2State();  }    class Interests2State extends State<Interests2> {    @override    Widget build(BuildContext context) {      Container container = Container(          height: MediaQuery.of(context).size.height * 0.03,          padding: EdgeInsets.symmetric(              horizontal: MediaQuery.of(context).size.width * 0.027,              vertical: MediaQuery.of(context).size.height * 0.003),          // padding: EdgeInsets.fromLTRB(12, 6, 12, 6),          margin: EdgeInsets.fromLTRB(              MediaQuery.of(context).size.width * 0.012,              MediaQuery.of(context).size.height * 0.003,              MediaQuery.of(context).size.width * 0.012,              MediaQuery.of(context).size.height * 0.003),          decoration: BoxDecoration(            color: widget.viewInterest.isChosen && chosenInterests.length < 9                ? Color(0xff0B84FE)                : Colors.white.withOpacity(0.87),            boxShadow: [              BoxShadow(                color: Colors.grey.withOpacity(0.69),                spreadRadius: 1,                blurRadius: 3,                offset: Offset(0, 1), // changes position of shadow              ),            ],            borderRadius: BorderRadius.circular(9),          ),          child: Text(            '${widget.viewInterest.title}',            style: TextStyle(                fontSize: 15,                fontWeight: FontWeight.w600,                color: widget.viewInterest.isChosen && chosenInterests.length < 9                    ? Colors.white                    : Colors.black),          ));        if (widget.viewInterest.isChosen && chosenInterests.length < 9) {        chosenArtsInterests.add('${widget.viewInterest.title}');        var chosenInterests = chosenSportsInterests +            chosenEntertainmentInterests +            chosenCharacterInterests +            chosenArtsInterests +            chosenWellnessInterests +            chosenLanguageInterests;          print(chosenInterests);      } else {        chosenArtsInterests.remove('${widget.viewInterest.title}');        var chosenInterests = chosenSportsInterests +            chosenEntertainmentInterests +            chosenCharacterInterests +            chosenArtsInterests +            chosenWellnessInterests +            chosenLanguageInterests;          print(chosenInterests);      }      return GestureDetector(        onTap: () {          setState(() {            widget.viewInterest.isChosen = !widget.viewInterest.isChosen;          });        },        child: container,      );    }  }    class AvailableInterestChosen {    bool isChosen;    String title;      AvailableInterestChosen(this.title, {this.isChosen = false});  }    

WebDriverException: Message: unknown error: Chrome failed to start: crashed error using ChromeDriver Chrome through Selenium Python on Amazon Linux

Posted: 25 May 2021 07:49 AM PDT

Just to show that I have done my due diligince, I have already either tried the suggested answers or at least read them over and tried to understand, for the following questions:

Selenium: WebDriverException:Chrome failed to start: crashed as google-chrome is no longer running so ChromeDriver is assuming that Chrome has crashed

The process started from chrome location C:\..\Chrome\Application\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed

Selenium python library via docker, Chrome error failed to start: exited abnormally

Chrome crashes when using Selenium (No answer posted but I still looked it over)

How to fix "usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed" error in Linux? - For this one I substituted the '/usr/bin/google-chrome' with '/etc/alternatives/google-chrome', still didn't work.

The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed for Selenium

selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: crashed with ChromeDriver and Selenium in Python

python linux selenium: chrome not reachable

unknown error: Chrome failed to start: crashed(selenium ,headless mode)

python selenium: WebDriverException: Message: chrome not reachable

Selenium chrome failed to start

WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally with ChromeDriver Chrome and Selenium through Python on VPS

Getting "Chrome not reachable" error while executing test scripts in Selenium Grid With Chrome browser

Selenium webdriver error Chrome failed to start

org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: crashed (headless chrome)

Python : Selenium - Message: unknown error: Chrome failed to start: exited abnormally

I am getting a common error that I have seen here on Stack Overflow, when running Selenium with Python on my Amazon Linux server I get the following results:

Traceback (most recent call last):    File "test-selenium-chrome.py", line 15, in <module>      driver = webdriver.Chrome(options=options, executable_path='/usr/local/bin/chromedriver')  # Optional argument, if not specified will search path.i    File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__      desired_capabilities=desired_capabilities)    File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__      self.start_session(capabilities, browser_profile)    File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session      response = self.execute(Command.NEW_SESSION, parameters)    File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute      self.error_handler.check_response(response)    File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response      raise exception_class(message, screen, stacktrace)  selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: crashed    (chrome not reachable)    (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)  

Here is my code:

#!/usr/bin/python3  import time  from selenium import webdriver  from selenium.webdriver.chrome.options import Options  from pyvirtualdisplay import Display    options = Options()  options.binary_location = '/usr/bin/google-chrome'  options.add_argument('--disable-extensions')  options.add_argument('--headless')  options.add_argument('--no-sandbox')  options.add_argument('--disable-dev-shm-usage')  options.add_argument('--remote-debugging-port=9515')  options.add_argument('--disable-setuid-sandbox')    display = Display(visible=0, size=(800, 800))  display.start()    driver = webdriver.Chrome(options=options, executable_path='/usr/local/bin/chromedriver')  # Optional argument, if not specified will seearch path.i  driver.maximize_window()  driver.get('http://www.google.com/')  time.sleep(5)  # Let the user actually see something!  search_box = driver.find_element_by_name('q')  search_box.send_keys('ChromeDriver')  search_box.submit()  time.sleep(5)  # Let the user actually see something!  driver.quit()  

I am using Google Chrome version 79.0.3945.130, and the corresponding chromedriver version ChromeDriver 79.0.3945.36 as speicified in https://sites.google.com/a/chromium.org/chromedriver/downloads

Additional info, if I just run google-chrome from the command line, I get:

[ec2-user@ip-xxx-xx-xx-xxx bin]$ pwd  /usr/bin  [ec2-user@ip-xxx-xx-x-xxx bin]$ google-chrome  Segmentation fault  

Any help is greatly appreciated.

How to properly handle unexpected disconnection / autoreconnect with node-postgres?

Posted: 25 May 2021 07:49 AM PDT

After have updated from 5.1 to 6.2.4, I see sometimes (nearly once a day) the following error which crashes our production server :

Error: Connection terminated unexpectedly  2017-06-15T10:03:33.683+02:00 at Object.onceWrapper (events.js:293:19)  2017-06-15T10:03:33.683+02:00Connection terminated unexpectedly  2017-06-15T10:03:33.684+02:00 at Socket.<anonymous> (/home/bas/app_21386476-a451-424c-ad67-870442bbdbe7/node_modules/pg/lib/connection.js:138:10)  2017-06-15T10:03:33.684+02:00 at emitNone (events.js:86:13)  2017-06-15T10:03:33.684+02:00 at emitNone (events.js:91:20)  2017-06-15T10:03:33.684+02:00 at Connection.emit (events.js:188:7)  2017-06-15T10:03:33.684+02:00 at Socket.emit (events.js:188:7)  2017-06-15T10:03:33.685+02:00 at process._tickCallback (internal/process/next_tick.js:104:9)  2017-06-15T10:03:33.685+02:00undefined  2017-06-15T10:03:33.685+02:00 at _combinedTickCallback (internal/process/next_tick.js:80:11)  2017-06-15T10:03:33.685+02:00 at endReadableNT (_stream_readable.js:975:12)  

I've seen https://github.com/brianc/node-postgres/pull/1316

AFAI, the error was not emitted before this patch, as of now, we have an error emitted on the pool.

I'm a bit confused here about what we should do when this error is happening ? Does it mean that we have to reconnect the entire pool ? But how ? Or does it means that the client emitting the error is definitively dead, so we rather drop the operation initiated by the client, and tell the user that his query is dropped. But once again how since the client.query callback seems not called with this error (perhaps somehow related to https://github.com/brianc/node-postgres/issues/1322) ?

No comments:

Post a Comment