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

callback?: (any) => void what this code mean?

i’m a newbie in javascript and angular, so i’m learning these. could anybody interpret below code snippet for me? public loadDataForPage(page: number, pageSize: number, callback?: (any) => void) { this._http.get(this._buildDataUrl(page, pageSize)) .subscribe((data: any) => { const startIndex = (page-1) * pageSize; this._updateData(data, startIndex); this._data.next(data); callback({data}); }); } i don’t know this part callback?: (any) => […]

Categories
Mastering Development

How to create a user-defined function in Postgresql?

I have the following query in Postgres. I want to have a function where the user can define the value of record_year and record_month using the function call, dynamically without having to specify in the query statement. That way the same query can be reused for different user input values for record_year and record_month (in […]

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

Algorithm crashing

int function(int A[], int n) { int i = 0; int sum= 0; int amount = 0; while (amount> 0) { if (A[i] > 0) { sum = sum + A[i]; amount++; } else { i++; } while (!(i < n)) { if (amount> 0) { return sum / amount; } else { return 0; […]

Categories
Mastering Development

How to negate whole words in regex

I used regular expression a little bit already but now I’ve stumbled upon a situation, where I don’t really know how to do it, and all the online tutorials I read didn’t cover my situation. The problem reads quite easy to solve, and it is probably easy to solve, but I didn’t find a solution […]

Categories
Mastering Development

Show how this field is used to solve the problem in the corresponding protocol

“Time to live” (TTL) is used by some of the protocols that you have studied in this lesson. Show how this field is used to solve the problem in the http protocol. Show how this field is used to solve the problem in the DNS protocol.

Categories
Mastering Development

I have column x in hh:mm format of datatype varchar in SQL Server and I want to perform sum on that ‘x’ column

I have column x in hh:mm format of datatype varchar in SQL Server and I want to perform sum on that x column. I created a user-defined function to convert total min into hh:mm format. Then I tried to perform sum to calculate total duration: sum(cast(new_totalmin AS Int)) also i want total of HH:mm exactly […]

Categories
Mastering Development

Get type parameter value from URL with livewire

I wanted to get the value of type from the url "example.com/user?type=agent" using livewire. I have tried using Input::get(‘type’) but is not working in livewire component class