Questions tagged [simplify]

This tag refers to the process of making something simpler or smaller in order to increase its efficiency, usability, or operation speed.

Use this tag for questions related to making something simpler or smaller in order to increase its efficiency, usability, or operation speed.

770 questions
-2
votes
2 answers

How to simplify object

I have an issue here where the code is quite heavy and quite hard to read imo. I've simplified the code as much as I can but I was wandering if there's a way to simplify this code even further? Or maybe if there is any better terminology i could use…
-2
votes
1 answer

How can I Simplify this code of Laravel 8?

I have this code in routes, is it possible to simplify it? Thanks Route::get('/post1', function () { return view("post1"); })->name("/post1");
Omar GB
  • 29
  • 6
-2
votes
2 answers

I want to freeze all my transforms but code is too long

I am trying to create a function which allows me to zero out all of my transforms(scale, rotation, translation) I have found a way to code it in python but it seems to be a bit too much coding. I am wondering if there is any way to simplify this…
-2
votes
1 answer

Regex to identify 2 characters in the correct position from a 4 character string

For example, I have the String "abcd", and I want all matches to be found in which at least 2 of those characters match, in the correct position. So, ab12, a1c2, 12cd, etc will all match because they contain at least 2 characters in the correct…
Anon
  • 9
-2
votes
1 answer

Can this MIPS assembly code be simplified?

I'm trying to write a function that counts the length of a string with the fewest number of dynamic instructions. This is what I have as of now: strlen: li $v0, 0 # len = 0 top: lbu $t0, 0($a0) # get…
jiyoon
  • 201
  • 4
  • 14
-2
votes
1 answer

Simplify sql query(date to period)

got this table: initial table Need to get table like this: Target table what I used: Select ID_CLIENT, BALANCE, HIST_DT as Start_dt, isnull(lead(hist_dt) over (partition by id_client order by hist_dt asc), '2999.12.31') as End_dt from ( select…
-2
votes
1 answer

How to simplify with XOR after using Quine–McCluskey's Algorithm?

For my program, I need to simplify boolean expressions, and I can do this using Quine–McCluskey's algorithm, however the end result only contains NOTs, ANDs, and ORs, but no XORs, and the involvement of XORs is crucial for my program - if the result…
flamebull5
  • 17
  • 4
-2
votes
1 answer

Simplifying Big-o notation

I know we can eliminate the lower function in our Big-O notation if it is in addition. Something like O(4^n + n^2) will be simplified to O(4^n) However, if it is something like O(4^n * n^2) or O(n * 3^n), how do they get simplified, now that the…
-2
votes
7 answers

Simplify this into one sentence only

How can I simplify this into one sentence in vba? If [BT12] = "a" Then Range("AB12").ClearContents End If If [BT13] = "a" Then Range("AB13").ClearContents End If If [BT14] = "a" Then Range("AB14").ClearContents End If
Santos Lee
  • 29
  • 4
-2
votes
1 answer

Finding the number of k-primes within a range

Write function count_Kprimes with given parameters k, start, nd, that returns a list of the k-primes between start (inclusive) and end (inclusive). Here is my attempt: def count_Kprimes(k, start, nd): ls = [] for x in range(start, nd + 1): y…
-2
votes
1 answer

How can I simplify my Java code?

I am very new to Java and am stuck on the following assignment. I've been asked to create a method in the AddressBook class that returns the Person object with the highest total ActivityLevel. I have created the getSocialMediaActivityLevel(),…
stacey
  • 7
-2
votes
1 answer

Simplifying code of complex list comprehension in Python

Assume a list of dictionaries (lst_of_dcts) in Python. Further, assume that I wish to modify (e.g., encode in ASCII) each value v of the key-value pairs k:v in each of the dictionaries dcts. In order to do so, I am using list comprehension, but the…
Michael Gruenstaeudl
  • 1,609
  • 1
  • 17
  • 31
-2
votes
2 answers

Summarizing DataFrame using partitioned columnwise means

I want to take a dataframe that's a million lines long, and summarize it so I take the columnwise mean of every block of 20 rows. Is there an easy way to do this?
Rob
  • 3,333
  • 5
  • 28
  • 71
-2
votes
2 answers

Looking to simplify my code

The code below is very repetitive and it looks like the words I need to replace can be subbed into the three lines of code one by one, I'm just not sure how to do it. If anyone is wondering it's just a bit of code to find and replace common errors.…
Jac
  • 19
-2
votes
2 answers

How can I replace the if-else statement for something way shorter?

I think the following code speaks for itself. if (card==1) { cardImageString = @"myGrabbedImage1.png"; } else if (card==2) { cardImageString = @"myGrabbedImage2.png"; } else if (card==3) { cardImageString = @"myGrabbedImage3.png"; } else…
Vince
  • 648
  • 1
  • 7
  • 17