Categories
Mastering Development

Converting array to 8-bit codes in c

I have an array of 200 elements. I want to divide this array into 25 parts and find the RMS values ​​of these parts and print 0 if it is less than 20, 1 if it is greater. Example signal1[200] Output data[8]={0,1,0,0,1,0,1,1) I find code for RMS calculation #include <stdio.h> #include <math.h> double rms(double* v, […]

Categories
Mastering Development

Accessing elements in Counter() in a loop python

I have this: num_values = 3 lst = [1, 2, 3, 1, 2, 2, 2, 2, 2, 2] counters = Counter(lst) Counter({2: 7, 1: 2, 3: 1}) I need to do a for loop and access every value in my Counter. How do I do this? Example: for value in counters: scores = 0 if […]

Categories
Mastering Development

SQL error – trigger/function may not see it

I was working on my project, here I got this error while inserting some values in a row: ERROR at line 1: ORA-04091: table SYSTEM.PRODUCTS is mutating, trigger/function may not see it ORA-06512: at "SYSTEM.PROD_TOTAL", line 2 ORA-04088: error during execution of trigger ‘SYSTEM.PROD_TOTAL’ This is my insert statement: insert into products values (1, 1001, […]

Categories
Mastering Development

Keras predict new image

I’m using this example. when run all as untouched all works fine, but now I want to make a test of a single file, I’m doing it in this mode: image = encode_img(‘new_image/x3fwf.png’) image = image[‘image’] image.shape // TensorShape([200, 50, 1]) prediction_model.predict(image) so here i get back: ValueError: Negative dimension size caused by subtracting 2 […]

Categories
Mastering Development

R – nudge only selected values and keep others static with geom_text_repel

I want to use geom_text_repel to have my labels lie as close to the edge of a pie graph as possible unless the percent is under a certain value, in which case the label should be nudged further away and connected with a line. I adapted a solution from Move labels in ggplot2 pie graph […]

Categories
Game Creation Mastering Development

set model to transparent where texture is transparent

I finally got around to applying textures to my game, and I noticed that the areas that are transparent on the .png of the texture are not transparent on the actual model.It is illustrated in the image below. I want the areas of the model that are supposed to be transparent to be transparent. The […]

Categories
Mastering Development

Access DbContext from Inside of a Class

In a Controller, we can do this to inject the DbContext in to the Controller. This works fine. public class HockeyPlayer : Controller { private readonly MyDbContext _context; public HockeyPlayer(MyDbContext context) { _context = context; } } However; one thing I have never been able to do is to inject (or access) DbContext in a […]

Categories
Mastering Development

Find the less frequent number in a NumPy array

Suppose I have the following NumPy array: a = np.array([1,2,3,1,2,1,1,1,3,2,2,1]) How can I find the less frequent number in this array?

Categories
Mastering Development

Logic of recognize digits using neural network

the task is to recognize the digits (0-9) represented by the 5×6 bitmap by means of a neural network and use the backpropagation algorithm for this. I understand it like this, I have a 5×6 bitmape, i.e. the input layer neurons are 30, in the hidden layer e.g. 17 and in the output layer 10 […]

Categories
Mastering Development

fpdf generate separate page (in one document) for each entry from mysql database

I am new to php and fpdf. I am able to display data from phpmyadmin in pdf but only first database entry. I am looking for a loop that pick each entry from database and create a new pdf page for that (in a single document). I am sharing my php code. It will be […]