Categories
Mastering Development

Is there a way to execute strings in a for loop?

I’ve created an array that holds all possible html tag which when run would navigate to the target string or nothing. group = [‘div’,’span’,’a’,’link’,’dl’,’dt’,’dd’,’b’,’p’,’meta’,”] comb = [] for g1 in group: if g1 != ”: for g2 in group: if g2 != ”: for g3 in group: if g3 != ”: res = “tag.”+g1+”.”+g2+”.”+g3+”.string” comb.append(res) […]

Categories
Mastering Development

How display in QTableView math texts like Latex [closed]

I’ve an instance: pandas.DataFrame and I wrote in its cells in Latex format, I.g: $\sigma_Y$, $\sigma_{Von Misses}$. Right now, I want to display all this information into QTableView using PyQT5. I findet a solution who takes the matlplotlib library to insert a latex text inside a QtLabel, the problem with it, is that, It doesn’t […]

Categories
Mastering Development

Why my predicate div/4 enters an infinite loop after giving me one answer?

I’m trying to implement the Euclidean division (a = bq + r) using Peano Axioms, so far I’ve done this predicates: % Dd = Dr * C + R div(Dd,s(0),Dd,0). div(Dd,Dr,C,R) :- less(Dr,Dd), mod(Dd,Dr,R), times(Dr,C,X), plus(X,R,Dd). mod(X,Y,X) :- less(X,Y). mod(X,Y,Z) :- plus(X1,Y,X), mod(X1,Y,Z). less(0,s(X)) :- nat(X). less(s(X),s(Y)) :- less(X,Y). times(0,_,0). times(s(0),X,X):- nat(X). times(s(X),Y,Z) :- times(X,Y,M), […]

Categories
Mastering Development

Separate numbers from string in DataFrame

I have this dataframe: df=pd.DataFrame({‘A’: [‘rob12′,’mark kevin34′,’john’], ‘B’ : [‘aa’,’bb’,’dd’], ‘C’:[10,34,98]}) and I want to delete the numbers from the first column to get a column like A [‘rob’, ‘mark kevin’, ‘john’]. Any suggestion?

Categories
Development

Nested decode in where clause

I have a cursor that fetches address for the id passed, based on the latest activity date. CURSOR get_address_upd_c ( id t1.id%TYPE ) IS SELECT street_line1, street_line2, city, stat_code, zip, activity_date, atyp_code FROM addr WHERE addr_im = ‘1’ AND status_ind IS NULL AND from_date < SYSDATE AND DECODE (TO_DATE, NULL, SYSDATE, TO_DATE) >= SYSDATE ORDER […]

Categories
Development

Optimize R nested loops with apply or similar

The code I show you here calculates exactly what I want, except for one problem: for large datasets, it takes just TOO LONG. Therefore, I was wondering if there is an alternative solution using the apply() family or some other way. I always have a hard time to reexpress nested loops into vectorial functions. Do […]

Categories
Development Linux Ubuntu

Unable to suspend Ryzen 7 2700U

On my Thinkpad A485 I’m unable to suspend my laptop while the charger plugged in. When it’s unpluged, it works just fine. When I close the lid while charging, it does not suspend (still able to hear the fan) and if I open the lid, the screen is black. But if I close the lid, […]

Categories
Development

Show dropdown menu only when start typing in R Shinyapp

With Shiny when you use SelectizeInput with multiple = TRUE: a dropdown menu with all the element appears as soon as you are in that box. Then, when you start typing, the result in the dropdown menu are filtered depending on what you type. When the list is very long, sometimes the point 1 is […]

Categories
Development

qsort creates a non specific number of zeros

So my program reads integers from a file while skipping lines that start with #,stores then in an array and prints them sorted using the qsort function. However, when they are printed, at the beginning for some reason it prints a number of zeros and then the sorted numbers. If the pairs of numbers are […]

Categories
Development

Merge iteratively one of multiple columns to dataframes in a list

I have a (probably small) issue in iteratively combining columns from a single dataframe with other dataframes from a list. Some data to illustrate: # load example data library(vegan) data(varechem) data(varespec) # generate predictor tables with overlapping rows and different amount of cols varespec1 <- varespec[c(1:9), ] varespec2 <- varespec[c(8:16), c(1:43)] varespec3 <- varespec[c(14:24), c(1:41)] […]