Categories
Linux Mastering Development

wrong grub prefix (efi) `grub-install` and `update-grub` doesn’t fix it

problem: When booting, grub goes to the prompt (grub>, not grub rescue>). I need to type in: set prefix=(hd0,gpt8)/boot/grub insmod normal normal To get the normal grub menu. Every post I found so far was solved by doing grub-install and/or update-grub once you manage to boot your system. I tried these but the problem persists. […]

Categories
Database Development

MYSQL Slow Query WARNING

I am running FiveM (Grand Theft Auto 5 Multiplayer Game Modification) server, which uses MYSQL as database. When I have a lot of data stored in the database, the data starts executing very slow and In my console appears that Slow Query Warning. Can someone help me ? How can I fix/improve/remove the limit of […]

Categories
Mastering Development

onClick doesn’t work on first click after rerender

const NavigationButtons = ({onBtnClicked, btnClass, label, route, btnAct}) => { return( <p className={`btn ${btnClass} ${btnAct}`} onClick={()=>onBtnClicked(route)} >{label}</p> ) } This is my button component, I’m giving it to another component as btns1 props {!isSigned?btns1:windowPixel?btns1:null} Basically, when isSigned is false, btns1 is rendered. There’s really no problem here. When isSigned is true, it checks if windowPixel […]

Categories
CMS Mastering Development Wordpress

Attaching category queries to search field

I’m trying to filter the loop based on some category buttons, so when someone clicks the button the search results are filtered. However, I can’t seem to pass the category to the search results. Here is the query function in functions.php: poet_category_button_query() function poet_category_button_query( $category ) { global $category_query; return $category_query = get_posts( array( ‘category_name’ […]

Categories
Mastering Development

reduxForm validation issue in Field Component (Error: Maximum update depth exceeded)

The error message is : Error: Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops. This problem appears only when I add required function in validate attribute in Field component. Without required all works fine. I […]

Categories
Mastering Development

Use pivot_table and groupby for calculation

I have a big df that looks something like this: df = pd.DataFrame({‘Product’: [‘A’, ‘C’, ‘B’, ‘A’, ‘C’, ‘C’], ‘Inv_type’: [‘Packaging’, ‘Raw Materials’,’Packaging’, ‘Raw Materials’,’Packaging’,’Raw Materials’], ‘Total_cost’: [5, 7, 8, 9, 10, 19], ‘Batch’ : [‘1000’, ‘1001’, ‘1002’,’1003′, ‘1003’, ‘1004’], ‘Item’ : [‘peas’, ‘can’, ‘carrots’, ‘label’, ‘can’, ‘onion}) It’s basically a bill of materials list. […]

Categories
Linux Mastering Development

Resize dev/sda2 Ubuntu VMWare

Using VMWare Workstation 15 Player (15.5.6) on Win10 host, Ubuntu 18.04 guest. I had originally 10GB disk attached to this VM. Started getting error no space left on device. Deleted /tmp (rm -rf /tmp/*). Increased the 10GB Disk size to 25GB, added another disk 20GB. But the VM is not recognizing the new disk or […]

Categories
Mastering Development

problem while applying k-means on cv2.saliency

I’m working on project which detects people. So I’m using saliency in opencv and applying k-means clustering on the output of the saliency. The problem is the output after applying k-means clustering is totally black Here is the code: import cv2 import time import numpy as np cap=cv2.VideoCapture("video.avi") while(cap.isOpened()): #time.sleep(0.05) _,frame=cap.read() image=frame saliency = cv2.saliency.StaticSaliencySpectralResidual_create() […]

Categories
Mastering Development

ReactWrapper can only wrap valid elements (material-ui – enzyme)

I’m writing a test for a component to test one of its functions, but I am getting an error: ShallowWrapper can only wrap valid elements The component file is as follows – TextInput.js: /* eslint-disable react/require-default-props */ import React from ‘react’ import PropTypes from ‘prop-types’ import { InputLabel, TextField } from ‘@material-ui/core’ const TextInput = […]

Categories
Mastering Development

Why does the iterator in csv.reader not allow reading the entire results into a list at one time?

My understanding of how iterators work in python is that they can be "materialized" into a list by either using a for comprehension: all = [i for i in my_iterator] or by simply converting explicitly to a list: all = list(iterator) Example code for using the csv.reader indicates it is an iterator https://docs.python.org/3.7/library/csv.html: import csv […]