set MySqlParameter = -1 if null

Advertisements I am trying to use SQL queries, but I meet a problem with nullable objects : Here is my code where I define all MySql parameters : MySqlParameter[] listParams = new MySqlParameter[] { new MySqlParameter("id", this.ID), new MySqlParameter("idStock", this.idStock), new MySqlParameter("certificate", this.certificate), new MySqlParameter("idLO", this.launchingOrder.ID), new MySqlParameter("idToleOri", this.toleOri.ID), new MySqlParameter("idTolesOri", string.Join("+", this.idTolesOri)), new MySqlParameter("listInstructions",… Read More set MySqlParameter = -1 if null

Elasticsearch – how do i add `boost` to `constant_score` in bodybuilder?

Advertisements I have the following bodybuilder query :- bodybuilder() .orQuery(‘match_all’, {}) .orQuery(‘constant_score’, null , (qr) => { return qr.filter(‘range’, ‘stock_sum’, {gte: 1}) }) .build() Which basically generate the following (Query simulator HERE) { "query": { "bool": { "should": [ { "match_all": {} }, { "constant_score": { "filter": { "range": { "stock_sum": { "gte": 1 }… Read More Elasticsearch – how do i add `boost` to `constant_score` in bodybuilder?

ROW_NUMBER() OVER (PARTITION BY) gives same row numbers

Advertisements I use SAP HANA database for a project. I tried this SQL query to get values with a row number. But it gives 1 as all rows. SELECT ROW_NUMBER() OVER (PARTITION BY "ItemCode") AS "ID", "ItemCode", "CommitedQty", "JobId", "WarehouseID" FROM (SELECT "ItemCode", SUM("CommitedQty") AS "CommitedQty","JobId", "WarehouseID" FROM "Stock" WHERE "BaseEntry" = 10352 GROUP BY… Read More ROW_NUMBER() OVER (PARTITION BY) gives same row numbers

how to execute cleanup function in useEffect() only when component unmounts

Advertisements I want to clear filters only when the component unmounts. So I wrote cleanup function only in useEffect(). But as I checked it with console.log(), 1 was printed after the component mounted too. What’s wrong in this way? useEffect(() => { return () => { clearFilters(); console.log(1); }; }, []); Stack Snippet: const {… Read More how to execute cleanup function in useEffect() only when component unmounts

Background image css not scaling down properly

Advertisements I’m trying to put an image as a background of my project insde the body component, but when I reduce the screen width the image doesn’t overflow correctly. This is what I have now: the css is: body { background-image: url("https://phoenix-engineering.be/wp-content/uploads/2019/07/shutterstock_1113165392.png"); background-size: cover; overflow: hidden; background-position: unset; background-repeat: no-repeat; text-align: center; font-family: "Roboto", sans-serif;… Read More Background image css not scaling down properly

I want to web scraping from website their product price and name using python and only using beautifulsoup,requests and json modules

Advertisements i tried web scraping like this. I want to get price and name from product in the website. and I dont know how to extract specific script include ""product details jason inline script.""<script type="application/ld+json>" so extract all jason inline script data using beautfulsoup and I Assign it to script. and i tried to many… Read More I want to web scraping from website their product price and name using python and only using beautifulsoup,requests and json modules

What causes the "Argument expression expected" error in this Angular 13 app?

Advertisements I am working on an e-commerce app who’s front-end is made in Angular 13. The below code is intended to sum the prices of the items in the cart: import { Component, OnInit } from ‘@angular/core’; @Component({ selector: ‘.app-top-cart’, templateUrl: ‘./top-cart.component.html’, styleUrls: [‘./top-cart.component.css’] }) export class TopCartComponent implements OnInit { cartItems: any = [… Read More What causes the "Argument expression expected" error in this Angular 13 app?

Uncaught (in promise) FirebaseError: No document to update

Advertisements I made a firestore database that looks like this. I’m trying to make "stocks : 999" value change, so that it can be 998, 997, etc… So I followed given instructions on firebase documentation (https://firebase.google.com/docs/firestore/manage-data/add-data#web-version-9_8), but I bump into an error when trying to make it work. const [stock, SetStock] = useState([]); const toUpdate… Read More Uncaught (in promise) FirebaseError: No document to update

What is this ES6 syntax/style of function declaration called?

Advertisements I tried looking at MDN on arrow functions, that links to an article ES6 In Depth: Arrow functions and the ECMAScript grammar. I didn’t find an example of this style of function body. See takeStockForBowl in example code below. Question, what would this style of function definition be called? Maybe it’s a repurposing of… Read More What is this ES6 syntax/style of function declaration called?