Categories
Mastering Development

write to serial port with usleep problems

I’am trying to write to serial port using usleep, when i try this in main code it works fine: int set_interface_attribs(int fd, int speed) { struct termios my_termios; memset(&my_termios, 0, sizeof my_termios); if(tcgetattr(fd, &my_termios) != 0) { fprintf(stderr, "error %d from tcgetattr", errno); return -1; } cfsetospeed(&my_termios, speed); cfsetispeed(&my_termios, speed); my_termios.c_cflag |= CS8; my_termios.c_cflag |= […]

Categories
User Help Web Apps

ImportError: cannot import name ‘UserGroup’ from ‘bloodapp.models’ (/home/abbracx/Documents/virtualenv/Bloodbank/bloodapp/models.py

please what could be the possible cause of these error? i have no idea and have been trying to fix it for the pass 6 hours. bloodapp.models has these: from django.contrib.auth.models import AbstractUser from django.utils import timezone from django_countries.fields import CountryField from django.urls import reverse from django.utils.text import slugify import random import string from Bloodbank […]

Categories
Mastering Development

Pandas dataframe column with title ‘name’

I have multiple dataframes which I join based on a common column. The code looks like this: df=reduce(lambda x,y:pd.merge(x,y,on=’name’),[total,eliminated, actionable, bug]) Afterwards, I intend to rename the column name. But name is not anymore in the column list. When I print the df, the name column shows but I don’t know how to work with […]

Categories
User Help

Microsoft Excel – getting the right data

I have an intermediate usage level. There is 3 list cells with options, Rating, Term & Sector, I pick my 3 options then I have various tables with corresponding data on a different sheet, I hope to pick out the relevant data from these tables. (1 different table for each sector, columns term and rows […]

Categories
Mastering Development

Count the number of duplicate grouped by ID pandas

I’m not sure if this is a duplicate question, but here it goes. Assuming I have the following table: import pandas lst = [1,1,1,2,2,3,3,4,5] lst2 = [‘A’,’A’,’B’,’D’,’E’,’A’,’A’,’A’,’E’] df = pd.DataFrame(list(zip(lst, lst2)), columns =[‘ID’, ‘val’]) will output the following table +—-+—–+ | ID | Val | +—-+—–+ | 1 | A | +—-+—–+ | 1 | […]

Categories
Mastering Development

Multiprocessing how do I improve this?

I have a script in which I am taking xlsx files and reformatting them and creating a txt document recording the reformatting. The script works well and does what I want it to do. However, It is not as fast as I would like as the multiprocessing is not being fully utilized. At times there […]

Categories
Mastering Development

Specifying random effects for repeated measures in logistic mixed model in R: lme4::glmer()

I am looking for feedback to determine how to correctly specify random effects to account for correlation in a repeated measures design, but with multiple levels of correlation (including the data being longitudinal for each combination of predictors). The outcome is binary, so I will be fitting a logistic mixed model. I was planning to […]

Categories
Linux Mastering Development

awk how to separate in different files all the lines with the same content in a given column

I have a big csv file (Test.csv), which looks like this: 1,2,3,A,5 1,2,3,B,5 1,2,3,E,5 1,2,3,D,5 1,2,3,Z,5 1,2,3,B,5 I want to print the lines in which the 4th column has the same content in different files. Actually, I need to join these lines that have the same content in a new csv or txt file, named […]

Categories
Database Development

How can I go about building a relationship with variable but ordered number of columns in a table?

First, I’m not a DBA or even much of an SQL person, so I apologize if this is too much of an entry-level question! I have been tasked with redoing an old csv file and turning it into a relational database on an old Microsoft SQL Server 2008 we have. It needs to track both […]

Categories
Mastering Development

LCD screen display random characters

So I am ultimately trying to build a fun security system using a 4×4 number pad, arduino, and a solenoid. While trying to get the number pad and LCD to work together, I keep running into issues for reasons unknown to me. The code below is what I have so far: #include <LiquidCrystal.h> // includes […]