Categories
Mastering Development

I have a warning “passing argument 2 of ‘bins’ make integer from pointer without cast”, could anyone help me?

In a binary search, I have the warning I wrote in the title: #include <stdio.h> int bins(int, int, int, int);/*this function do a binary search*/ int main() { int n, low, high, v[]={0,1,2,3,4,5,6,7,8,9,10}; low=0;high=11; printf(“please enter the num you want to find\n:”); scanf(“%d”, &n); printf(“%d”, bins(n, v, low, high)); return 0; } int bins(int n, […]

Categories
Mastering Development

Using another variable to store context inside a different variable

I want to add value inside a textbox.text variable only I don’t want to use another variable for that issue: $temp = ‘$textbox’ $textbox.text = “this will store this string exactly as I want” # I want to use temp for that issue but this code of course won’t work: $temp.text = “this will not […]

Categories
Mastering Development

Send data to Octobercms using PyQt

I have a barcode reader that reads the code of the citizenship card and verifies, on a server with OctoberCMS, if the user is registered. If you are registered, it returns the information of the user that is hosted in the database. If it is not, it will create a record in the database with […]

Categories
Mastering Development

swap key value pairs in a dictionary with values as lists

I have a dictionary with keys and values as lists. something like: d={1:[0,1,2,3,4],2:[1,3]} I was on the lookout for swapping key value pairs. The output I am trying to get is: o={0:[1],1:[1,2],2:[1],3:[1,2],4:[1]} Was wondering if there is a way to achieve this in the most efficient way

Categories
Mastering Development

3D bar plot with dates, strings and numbers in 3 axes with matplotlib in python

I have three lists as mentioned below. xx = [‘TT’, ‘AN’, ‘AP’, ‘AR’, ‘AS’, ‘BR’, ‘CH’, ‘CT’, ‘DN’, ‘DD’, ‘DL’, ‘GA’, ‘GJ’, ‘HR’, ‘HP’, ‘JK’, ‘JH’, ‘KA’, ‘KL’, ‘LA’, ‘LD’, ‘MP’, ‘MH’, ‘MN’, ‘ML’, ‘MZ’, ‘NL’, ‘OR’, ‘PY’, ‘PB’, ‘RJ’, ‘SK’, ‘TN’, ‘TG’, ‘TR’, ‘UP’, ‘UT’, ‘WB’] yy = [datetime.date(2020, 5, 27), datetime.date(2020, 5, 28), […]

Categories
Mastering Development

Write a code that Calculates the average number of non-zero ratings per individual in our data set

So I’ve written my code below but I am having a hard time getting the code to not include the number of zeros. It runs but unfortunately not the way I want it to. Can anyone shed some light? the variable movies is basically a list of movies we were given The code will be […]

Categories
Linux Mastering Development Ubuntu

No Route To Host – ssh to Openstack Instances on new networks

I have installed Ubuntu Openstack on a single server… using MicroStack snap [installed: stein] on Ubuntu 18.04 LTS. PHYSICAL SERVER IP: 10.129.4.236 OPENSTACK [HORIZON IP]: 10.20.20.1 FLOATING IP SUBNET: 10.20.20.0/24 ALL TEST SUBNETS: Network Type: geneve ALL NETWORKS ARE CONNECTED TO OPENSTACK ROUTER ALL INSTANCES HAVE SAME SECURITY GROUP Test Subnet 1 [DEFAULT TEST NETWORK]: […]

Categories
Mastering Development

Use mapreduce to read CSVs (where not all columns match) and combine into DataFrame

I’m using Julia 1.4.2. I want to use mapreduce() to: Read a bunch of CSVs, then Combine them into one big DataFrame. First the preliminaries: using CSV, DataFrames # Create CSVs df1 = DataFrame([[‘a’, ‘b’, ‘c’], [1, 2, 3]], [“name”, “id”]) df2 = DataFrame([[‘d’, ‘e’, ‘f’], [4, 5, 6]], [“name”, “id”]) # NOTE: This df […]

Categories
Linux Mastering Development

How to match two CSV files by awk?

I have two CSV files as ID1,V1,V2,V3,V4 1,4,5,3,3 2,66,77,46,44 ID2,V1,V2,V3,V4 55,4,5,3,3 84,66,77,46,44 How can I get a CSV of ID1,ID2 1,55 2,84 by matching V1,V2,V3,V4 blocks in two CSV files? The files are well-formatted. Only digits separated by , in five columns shown. The files are quite large (1B lines), and this is the reason […]

Categories
Mastering Development

Using a template with lambda function pointer

I’m playing around with some C++11 features, and I encountered the following: #include <iostream> #include <vector> template <class T> void map(std::vector<T>& values, T(*func)(T)) { for (int &value : values) { value = func(value); } } int mul2(int x) { return 2*x; } auto mul3 = [](int value) { return value * 3; }; int main() […]