Categories
Mastering Development

Insert values between other values in numpy array

Let’s say I start with this array: start_array = [[1.48, 1.79, 2.10, 2.80] [63, 60, 57, 60]] I want to take the values in this second array: second_array = np.array([2.3,3.42, 4.47]) and insert them in in between the values in the first row, with a 1 in another row to code that something occurred there. […]

Categories
Mastering Development System & Network

Unable to mount device

Trying to mount volume but not working. lsblk saying: NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT nvme0n1 259:4 0 20G 0 disk ├─nvme0n1p1 259:5 0 8G 0 part / └─nvme0n1p128 259:6 0 1M 0 part nvme3n1 259:3 0 838.2G 0 disk nvme2n1 259:2 0 838.2G 0 disk nvme1n1 259:0 0 22G 0 disk └─nvme1n1p1 259:1 […]

Categories
Game Creation Mastering Development

LibGDX/Box2D dynamic body can climb up static bodies

Right now I’m sitting on a Terraria clone. I have a problem with my player body which gets stuck on other static tiledmaptile-bodies when I jump on them. I have seen that this has something to do with the friction value that both bodies have. The problem is, if I lower this friction now, the […]

Categories
Mastering Development

Rails service call not allowing minus equals on active record object to create ticket

I have a service that fires when a stripe checkout is completed. I am expecting a ticket to be added to the users inventory with a unique number. Note the object.client_reference_id and the metadata come from the Stripe webhook and are both confirmed to be returning the correct data. # services/ticket_service.rb class TicketService def self.call(event) […]

Categories
Mastering Development

Rails service call not allowing minus equals on active record object to create ticket

I have a service that fires when a stripe checkout is completed. I am expecting a ticket to be added to the users inventory with a unique number. Note the object.client_reference_id and the metadata come from the Stripe webhook and are both confirmed to be returning the correct data. # services/ticket_service.rb class TicketService def self.call(event) […]

Categories
Mastering Development

Compare element 0 of two lists of lists; make new list of lists with items in z[0] that are not in x

If i[0] of each list in z is not in x, put that z list in g and if it’s already in x, put x in g. x = [[68, 40000], [69, 40800.0], [70, 41616.0]] z = [[62, 0], [63, 0], [64, 0], [65, 0], [66, 0], [67, 0], [68, 0], [69, 0], [70, 0]] […]

Categories
Mastering Development

Solving modular linear congruences for large numbers

I’m looking for a better algorithm than one I found on stackoverflow to handle 4096 byte numbers, i’m hitting a maximum recursion depth. Code from stackoverlow post, i copy/pasted it but lost the original link: def linear_congruence(a, b, m): if b == 0: return 0 if a < 0: a = -a b = -b […]

Categories
Mastering Development

Dictionary entries all are the same after enumerating Pandas dataframe

I am using enumerate to get the row number for each row to use as image_id but it keeps returning the length of rows and not the index. def get_detectron_format(self): """Returns the dataset in the Detectron2 list(dict) format""" csv = self.get_data_csv() dataset_dicts = [] record = dict() for i, (index, data) in enumerate(csv.iterrows()): record[‘file_name’] = […]

Categories
Mastering Development

Regex to find multiple values between two words

I’m trying to retrieve multiple values between two words, delimiting a specific part of the text. The pattern is this: (^\d\d\d\d)\D+ I’ve tried a lot of regex, but I was not successful. Below is an example of an attempt that is not working, because it is only returning the first value. Livro[\s\S]*?(^\d\d\d\d)\D+[\s\S]*(?=em moeda corrente) The […]

Categories
Mastering Development

How to Un-Sort The legends in the graph in R?

I am not an expert in R. I am having an issue, the legends are sorted alphabetically. I cannot arrange them manually because I have 87 patients and each patient has 300 days and the status (category) changes every day so i want to plot the graph exactly like it has in the source. ggplot(data […]