Categories
User Help

Some standard commands freeze on remote machine

I’m using a remote machine (ssh connection), and some commands suddenly stopped working. By that I mean that I enter them and nothing happens: they just kind of freeze, without any output and without finishing the execution. Commands which work: top, bc, nvidia-smi, sh, vim ~/.bashrc Commands which don’t: python, python2, python3 (regardless of arguments), […]

Categories
Mastering Development

How to Match Strings from multiple data frame and return indexes with AND and OR options,& How to make the process fast; SQL, Tensor Array?

This is the data frame that I want to search on and get back the matching row number. ** Real data contains 2 million rows and 53 columns df2 = pd.DataFrame(np.array([‘A’,’B’,’AC’,’AD’,’NAN’,’BB’,’BC’,’C’,’AC’,’AD’,’NAN’,’BB’,’BC’,’D’,’AA’,’AC’,’AD’,’NAN’,’BB’,’BC’,’AB’,’AC’,’AD’,’NAN’,’BB’,’BC’,’AC’,’AC’,’AD’,’NAN’,’BB’,’BC’,’BB’,’BC’,’AD’]).reshape(5,7),columns=[‘a’,’b’,’c’,’d’,’e’,’f’,’g’]) The strings I will be searching is from this smaller data frame. Where each row has to be searched as, to get back matched […]

Categories
Mastering Development

Regex works only on first occurance?

Update: Kindly read my comment on jignatius’s answer I wrote the following code to find specific matches in a string using regex and to delete them and replace with another value, but it doesn’t work as expected. For example given the following input: f={a,b}+{c,d} I would expect it to delete both {a,b} and {c,d} but […]

Categories
Mastering Development

sql query for like to Order exact match at top in list

sql query for like to show exact match first in list: dataset: "abcd", "a","b","bc","bcd" select * from table where data like "%bc%"; it should show in order bc, abcd, bcd.

Categories
Database Development

Ways to optimize the PostgreSQL/TimeScaleDB query

What approaches I could take to optimize the performance of the following joinless query on the following PostgreSQL/TimeScaleDB table? So far, I managed to create the right index which is obviously being used by the query planner. But the query is still not fast enough. The layout of the table and its indices is: The […]

Categories
Mastering Development Software

C++ Strong Typedef and DRY

I’ve been writing a gameboy emulator over the last couple weeks in my spare time, and something I keep returning to is how I am implementing the CPU registers. There are 8 registers, and each register is 8bits: A, F, B, C, D, E, H, L. However, the registers can also be paired together to […]

Categories
Mastering Development

mysql: natural join

everyone! I’m currently trying to make a simple table with MySQL that satisfies the below condition. make a table of ship names, displacement, and numGuns with ones participated ‘Guadalcanal’ battle 3 tables are needed to make this. I’ve tried several codes but they all failed. I also wonder if I can use ‘natural join’ redundantly. […]

Categories
Mastering Development

Fast conversion of multicolumn dataframe into dictionary

I have the following problem. I have a pandas dataframe with columns A to D with columns A and B being kind of the identifier. My ultimate goal is to create a dictionary where the tuple (A,B) denotes he keys and the values C and D are stored under each key as numpy array. I […]

Categories
Mastering Development

Algorithm to reduce and limit memory usage of a set combination search

I would like to reduce and limit the memory footprint used in comparing all combinations of items in a set to each other, where the set could grow to any size. I was thinking of splitting up the set into smaller pieces but then as all combinations are required, I can’t see how to do […]

Categories
User Help

Make readline edit input command in external editor (similar behavior as “edit-and-execute-command” from bash)

Background So far I’ve found readline very useful since just by modifying a single configuration file (i.e. ~/.inputrc), you are configuring all those programs that depends on readline. The programs that I use in my workflow that can work along with readline are maxima, python, bash, bc, lua, sqlite3. When reading the documentation on bash, […]