Categories
Mastering Development

MIPS – Delete consecutive duplicates from input

I’m trying to convert a program written in java to mips. The program asks user to enter a string and delete consecutive duplicates. For example if the users enters “abbcddeffga”, the output would be “abcdefga”. In Java everything works fine, but in MIPS I’ve probably messed up something with the registers or something else, and […]

Categories
Mastering Development

Using ggplot to plot more than 6 groups

I’m aware this question has been asked before and have attempted to use the solutions in said posts but to no avail, and to avoid necro’ing old posts I thought I’d make a new one. In my free time, which I have a lot of these days given the current pandemic, I’ve been watching episodes […]

Categories
Mastering Development

How can I adjust bars on X-axis accord to numerical order?

The ideal order of bars on X-axis is (S1,S2,S3,S4,S5,S6,S7,S8,S9,S10).But it just can not be adjust successfully ggplot(data=T1, aes(x=Scenarios, y=Yields, fill=Scenarios)) + geom_bar(stat=”identity”) + scale_fill_manual(values=cbPalette)

Categories
Linux Mastering Development

Straight and Opposite Links in Network Topology

I’m running a topology (Python code) via mininet that looks like this. First, I run the code sudo python network.py Next, I set a server for example like this: h4 iperf -s & Then, I run an iperf measurement like this: h1 iperf -c h4 -i 10 -t 60 from h1 to h4. Here, the […]

Categories
Development

Using regular expressions to multiply and sum numeric string characters contained in a hash of mixed numeric strings

Without getting too much into biology, Proteins are made of Amino Acids. Each of the 20 Amino Acids that make up Proteins are represented by characters in a sequence. Each Amino Acid char has a different chemical formula, which I represent as strings. For example, “M” has a formula of “C5H11NO2S” Given the 20 different […]

Categories
Development

How to handle column separator being present in one of the columns without using any in-built library in Python?

I want to read a CSV file in Python3 but cannot use any library due to some constraints. In almost every row, one or more columns contain the commas (“,”) and using row.split(‘,’) is causing issues as the number of columns to get increased. My code is: import csv file_name = “train_1.csv” columns = [ […]

Categories
Development

How to use Array List generated from MouseEvent btn1 in MouseEvent btn2

As a beginner, I would like to understand the use of events by making a tiles shuffling app. Please help me I would like a javafx app with two buttons: Button 1 – Clicking it shuffles a premade string list of 136 items (list1: String[] allTiles) Button 2 – Clicking it takes the first 13 […]

Categories
Cryptocurrency Development Ethereum

Ganache become disconnected after some hours

I am running my program to deploy thousand of contracts and millions of transaction to interact with them, which definitely need a lot of hours. But, when i let my program running during night (without using my laptop at all), then Ganache GUI become disconnected after some hours, which cause my program to stop. and […]

Categories
Development

Python regex matching group with multi-layer conditions

I have this regex : cont_we_re = r”((?!\S+\s?(?:(cbf|cd3|cbm|m3|m[\\\>\?et]?|f3|ft3)))(?:([0-9,\.]+){2,})(?:\s*(?:(lb|kg)\.?s?))?)” Right now, the logic followed is match with any numeric chunk optionally if followed by only kgs or lbs but don’t match if cbf, cd3, cbm, m3 etc. are found after the numeric chunk. It works perfectly for these sample cases : s1 = “18300 kg 40344.6 […]

Categories
Development

Sympy gives wrong derivative when dealing with long expressions

I have a sydtem of ODE which I want to find the jacobi but sympy gives wrong answer for derivatives. printing.init_printing(use_latex=True) from sympy import * import numpy as np import matplotlib.pyplot as plt import sympy as sp N,x1,x2,x3,x4,y1,y2,r1,r2,r3,r4,eta1,eta2,eta3,eta4,R,c1,c2,c3,c4,a11,a12,a21,a22,a31,a32,a41,a42,b12,h,h11,h12,h21,h22,h31,h32,h41,h42,s1,s2,s3,s4,epsilon1,epsilon2,omega1,omega2,K11,K22,beta11,beta21,beta31,beta41,beta12,beta22,beta32,beta42,gamma12=sp.symbols(‘x1,x2,x3,x4,y1,y2,r1,r2,r3,r4,eta1,eta2,eta3,eta4,N,R,c1,c2,c3,c4,a11,a12,a21,a22,a31,a32,a41,a42,b12,h,h11,h12,h21,h22,h31,h32,h41,h42,s1,s2,s3,s4,epsilon1,epsilon2,omega1,omega2,K11,K22,beta11,beta21,beta3a,beta41,beta12,beta22,beta32,beta42,gamma12’) F1=R-c1*x1-c2*x2-c3*x3-c4*x4 F2=x1*(r1*(1-(eta1*x1+eta2*x2+eta3*x3+eta4*x4)/N)-(a11*y1)/(y1+a11*h11*x1)-(a12*y2)/(y2+a12*h12*x1))+s1 F3=x2*(r2*(1-(eta1*x1+eta2*x2+eta3*x3+eta4*x4)/N)-(a21*y1)/(y1+a21*h21*x2)-(a22*y2)/(y2+a22*h22*x2))+s2 F4=x3*(r3*(1-(eta1*x1+eta2*x2+eta3*x3+eta4*x4)/N)-(a31*y1)/(y1+a31*h31*x3)-(a32*y2)/(y2+a32*h32*x3))+s3 F5=x4*(r4*(1-(eta1*x1+eta2*x2+eta3*x3+eta4*x4)/N)-(a41*y1)/(y1+a42*h41*x4)-(a42*y2)/(y2+a42*h42*x4))+s4 F6=y1*(-epsilon1*(1+(y1+omega2*y2)/K22)-(b12*y2)/(y2+b12*h*y1)\ +beta11*(a11*x1)/(y1+a11*h11*x1)\ +beta21*(a21*x2)/(y1+a21*h21*x2)\ +beta31*(a31*x3)/(y1+a31*h31*x3)\ +beta41*(a41*x4)/(y1+a41*h41*x4)) F7=y2*(-epsilon2*(1+(omega1*y1+y2)/K11)-gamma12*(b12*y1)/(y2+b12*h*y1)\ +beta12*(a12*x1)/(y2+a12*h12*x1)\ +beta22*(a22*x2)/(y2+a22*h22*x2)\ +beta32*(a32*x3)/(y2+a32*h32*x3)\ +beta42*(a42*x4)/(y2+a42*h42*x4)) dF2dN=sp.diff(F2,N) print(dF2dN) […]