Categories
Mastering Development

PyQt5 errors ocurring in subwindow are not propagated to the main window

I have a dialog window that’s called from the QMainWindow as: def addTransfer(self): try: res = Transfert(self.db, self.supplierid, parent=self) res.show() res.exec() except DataError as err: QMessageBox.warning(self, err.source, err,message, QMessageBox.OK) The dialog widget is like: class Transfer(QDialog): def __init__(self, supplierId, parent=None) super().__init__(parent) …………………… @pyqtSlot() def save(def): try: qry = QSqlQuery(self.db) ……………. ……………. if qry.lastError().type() != 0: […]

Categories
Mastering Development

Electron issue after updating electron and typescript

I have a small electron project which I’ve just updated (Electron, typescript etc)… This is the code that’s breaking: dialog.showOpenDialog({}, (files) => { if(files && files.length > 0) { fs.readFile(files[0], ‘utf8’, (err, res) => { if (!err) { editor.setModel(monaco.editor.createModel(res, ‘javascript’)); } }) } }) It doesn’t like the {} after dialog.showOpenDialog( The error I’m getting […]

Categories
Mastering Development

I get an error when trying to establish a $ lookup relationship in Mongodb and nodejs

I’m at the learning stage yet. I am having trouble establishing a relationship in Mongodb. error not found 404 I made all the operations in the collections with the data in both tables, and in the training I received. But somehow I couldn’t run it successfully. Models Books const Book = require(‘../Models/Book’); router.post(‘/new’, function(req, res, […]

Categories
Mastering Development Software

Is there a less complicated alternative to handling this simple mySQL query in Node?

To Put My Question In Better Context… I am about done writing my first real-world Node application, which would be classified as a REST API. For myself, it was a bit challenging to wrap my head around Node’s Async event processing. I still don’t think I fully grasp it, as you will see by the […]

Categories
Mastering Development

How to select and compare id’s of a json file and write new json files for each result in node.js

I have a JSON file with two kinds of arrays, namely Persons and Cars. Each person has an ID and with each person they have a car or multiple cars. Each kind of car has also an ID. First I want to create a new directory. In that directory, I want to create new JSON […]

Categories
Cryptocurrency Ethereum Mastering Development

problem help me gas * price + value

i see all topic , but yet not slove my problem . please help me <pre> var EthereumTx=require(‘ethereumjs-tx’).Transaction const Web3=require(‘web3’) const web3 = new Web3(‘https://rinkeby.infura.io/v3/85xxxxxxxxxxx2af25e829b8d9df‘) const account1=’0xbd77caf08fe49d3f5aef6f83fc23b8d2129b468f’ const main = async () => { const count = await web3.eth.getTransactionCount(‘0xxxxxxxxxxxxxxxf5aef6f83fc23b8d2129b468f’); const nonce = web3.utils.toHex(count); const block = await web3.eth.getBlock(‘latest’); const gasLimit = web3.utils.toHex(3000000) const gasPrice = […]

Categories
Mastering Development

Mongoose findOneAndUpdate not returning the updated object despite {new: true} option when using async/await

I have read almost every answer on SO regarding this, but I couldn’t find the solution to my problem. I think it has more to do with my inchoate understanding of promises. My express application is structured using MVC & services design pattern. I have a following service method, which concerns me: const incrementPoolSize = […]

Categories
Mastering Development

Keep track of last login date with NodeJS and MongoDB

I’m working on adding a last login functionality to my Node app and can’t seem to get it to work. Here’s what I’ve got for a mongoose user schema: userSchema = new mongoose.Schema({ username: { type: String, unique: true }, password: String, email: { type: String, unique: true }, avatar: String, firstName: String, lastName: String, […]

Categories
Mastering Development

Getting inconsistent API response from Firebase function

I’ve wrote an API with Firebase functions. When I’m testing locally firebase serve –only functions, giving a URL as: http://localhost:5000/techsupper-server/us-central1/app and firebase serve –only function,hosting giving the URL: http://localhost:5000 I get the responses that I’m expecting, but when I deploy my code (firebase deploy) some routes stop working. After deploying once again without changing my […]

Categories
Mastering Development

Updating fields in array -NodeJs

I have this code that loop through all users in DB then look for specific events based on the id value and if there is a match it should update the field caption with a new given data, for the code : 1- search all potential user = OK 2 – search and find events […]