Categories
Mastering Development

Group by and update value based on another column using python

I have a data frame with below columns, using which need to create new columns by grouping Name. Status should be updated as active to entire group if it is active for any one St. data = {‘Name’:[‘Tom’, ‘Tom’, ‘krish’, ‘jack’,’jack’,’Nam’,’sue’], ‘St’:[‘S-123’, ‘S-290’, ‘S-123’, ‘S-147′,’S-98′,’S-123′,’S-38’], ‘Status’:[‘Inactive’,’active’,’active’,’inactive’,’active’,’Inactive’,’Inactive’]} df = pd.DataFrame(data) The desired output is Name St […]

Categories
Apple User Help

How to write an Applescript that shuts down a Drobo when a specific application quits

I have dabbled with Applescript in the past, but only in a small way, so need help this time please. I am not even sure this is possible… I have a small server cabinet with 3x Drobo, two Mac Minis and assorted 2.5" HD cases. One Drobo, at the top, is getting too hot (fans […]

Categories
Mastering Development

Joining dataframes without ON clause but with multiple column condition and populate flag in pyspark

I am trying to join 2 dataframes and retrieve ID from A by matching with some column conditions. Basically I have to fill ‘0’ s in B with ID’s from A and I don’t have an ON clause for this, so I may need a cross join, but the thing is I would need only […]

Categories
Mastering Development

Query Elastic DSL – Search query using spring boot data

I have the following properties file generated via Java and spring boot data elasticsearch. The file is generated in a User.java class and the property "friends" is a List where Friends is a Fiends.java file, both class file act as the model. Essentially I want to produce a select statement but in Query DSL Language […]

Categories
Mastering Development

How do I graph a distribution curve that shows percent of total population on the Y-axis

I am trying to use matplotlib to graph the distribution of salary grouped by region, with the y-axis showing the % of people having that salary. So far I have been able to come up with: import pandas as pd import numpy as np import matplotlib.pyplot as plt records = pd.DataFrame({‘Name’: [‘John’,’Rachel’,’Tom’,’Stan’,’Jack’,’Ben’,’Joe’,’Juliet’,’Nigel’,’Veronica’,’Cam’], ‘salary’: [40104,29401,57383,38494,99302,44733,40242,49555,13934,44011,88920], ‘Country’: […]

Categories
Mastering Development

Linq query with multiple joins and groups

I am quite new to linq expressions and am trying to work out the equivalent linq version of this tsql: SELECT p.Name, Count(a.Street) [Number of addresses], c.ContractType, COUNT(cv.ContractVersionId) Number, MAX(cv.ChangedDate) [Last change date] From Person p LEFT JOIN Address a ON p.PersonId = a.PersonId AND a.ChangedDate IS NULL LEFT JOIN Contract c ON p.PersonId = […]

Categories
Mastering Development

creating objects with multiple arrays

is there an easier way to set multiple lines of a file into an object without typing them all out Ive got a json array which has parsed a file into an array i have set each element to a variable id = array[0]; name = array[1]; position = array[2]; and put it in a […]

Categories
Database Development

MySQL 8.021 = 100% CPU when many queries to 1 table

I just install fresh LEMP stack at Freebsd 12 with MySQL 8.021 Noticing high usage of CPU I tested my queries in normal conditions individual and every is about 0.2s execute time – which is absolutely fine for me, but… My PHP script VERY SIMPLE queries: update set value=0 in client_table; update set value=1 in […]

Categories
Ask Games Video Games

Minecraft: can I get filled in maps using command blocks?

I don’t mind cheating in my single player survival world. But I used kill all entities while filling a large chunk with air to get rid of the mobs. But I didn’t know item frames are also entities. Why are item frames also entities? Minecraft can be so frustrating at times. You see, I also […]

Categories
CMS Mastering Development Wordpress

How to redirect after seller wizard completion in Dokan

Im working on a multi-vendor project and I need all vendors to select a ‘subscription plan’ at the end of the wizard so they only get access to the features they are paying for. How would I hook in to the completion of the seller wizard and redirect the user to the ‘plan selection’ page […]