Categories
Development

Simple calculation on array of arrays

I am having the following collection: { “price” : [ 55800000, 62800000 ], “surface” : [ 81.05, 97.4 ], } I would want to calculate the price/m2. I have tried the following but got the following error: “$divide only supports numeric types, not array and array”. db.entries.aggregate( [ { $project: { url: 1, pricePerSquareMeter: { […]

Categories
Development

a char minus ‘0’, doesn’t work without ” 0″

I am working on leetcode question 728 Self Dividing Numbers. When checking if a number can be divided by each of its own digits and none of its digit should be 0, I saw the following code (from the question’s solution page), for (char c: String.valueOf(n).toCharArray()) { if (c == ‘0’ || (n % (c […]

Categories
Development

How to fix the stuck after the command, ‘bash flash.sh’

I was trying to flash the mendel-enterprise-chef-13 to the Coral EdgeTPU Development Board but got stuck after the command, “bash flash.sh.” The host computer is the MacBook Pro (2018) with macOS Mojave ver. 10 and connected with the Coral EdgeTPU Dev Board. I have followed the instructions on the Coral Document listed at https://coral.withgoogle.com/docs/dev-board/get-started/. The […]

Categories
Development

Problem with Stereo Camera on one usb connect with OpenCV 4 and Python 3.7

I have this cam in test (https://www.amazon.de/gp/product/B01JLU20C0/ref=ppx_yo_dt_b_asin_title_o04_s00?ie=UTF8&psc=1) for a stero vision project. The module has two cameras which are connected to the computer via a USB port. With this I would like to test depth detection for a project. If I only take photos, it works very well. Only the live stream doesn’t work the […]

Categories
C++ Development

Sending some lines from server in python to QT(C++) client

Ia have serwer in Python on my Raspberry Pi and Android application in QT (C++). I wan to send some data (lines) from my serwer (from csv file) to client application and save it in QListWidget. Client can connect by Bluetooth or TCP (I created 2 servers on RPi). I tried to send line by […]

Categories
Development

Django select_for_update function in concurrent process

When I testing the function of update_or_create in multi threading condition, I found the result is not what I wanted,they created more than one record in MySQL. As the code show, update_or_create used select .. for update to lock rows in MySQL, then it should be only one record in MySQL. I used SQLAlchemy and […]

Categories
Development

Prometheus Smoothing Utilization Metric

Trying to figure out how to smooth this metrics over 5m so data is not so jumpy. Current metric shows the worker utilization by taking worker used divided by number of workers. http_Stats_Resque_worker_main_working{app_name=’workflow’}/http_Stats_Resque_worker_main_total{app_name=’workflow’}

Categories
Development

How to make a percentage from baseball player stats

I need to get a program to converts stats of a baseball player to a whole percentage. Not a decimal. I have googled and youtubed. No one has the answer I need. ##Batter: Charlie Blackmon ##At Bats: 514 ##Hits: 164 ##Total Bases: 299 ##Home Runs: 27 ##Strike Outs: 93 ## ##Batting Stats: ##Batting Average: 0 […]

Categories
Development

Why VS2017 debugging will not stop at dllmain breakpoint?

I’m building a dll for the first time and everything is working as expected but I cannot debug it. I made the most minimal example possible, of just a dllmain() and set the project up using the wizard for windows DLL (non-MFC). active build configuration: x86 debug right clicked project -> Set as startup project […]

Categories
Development PHP

php parse array in object detail

I got stuck on parsing array in my php object [details] => Array ( [0] => stdClass Object ( [account] => [address] => add1 [category] => receive [amount] => 1100 [label] => [vout] => 1 ) [1] => stdClass Object ( [account] => [address] => add2 [category] => receive [amount] => 11600 [label] => [vout] […]