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
-1
votes
10 answers

Simplyfing code with a lot of ifs

I have a method which based on the enum, and to be clear at start we have this situation: public void MyMetohd(Somestatus status) { if(status == Somestatus.Enum1) { DoA(); DoB(); DoC(); DoD(); DoE(); } if(status ==…
user278618
  • 19,306
  • 42
  • 126
  • 196
-1
votes
1 answer

Simplify multiple script

Please help me simplify this code I have a quiz item which you select an answer and the answer will append to .response class Appology as my previous question is not clear. I am new in jQuery so your help is much appreaciated. Here's the scenario,…
Sohee
  • 13
  • 4
-1
votes
1 answer

How can i simplify this for loop?

I need to fill a 360 element matrix with periods of 90 elements for different phiStart and phiExit values: flute = 4; phiStart = 0; phiExit = 90; phiDelta = 1; phiPitch = 360 / flute; for g = 0:abs(phiExit - phiStart); for k = 0:abs(phiExit…
-1
votes
1 answer

how to simplify this statement using indexOf?

How can I simplfy the following text inside the if statement in Javascript using "indexof"? if (a === 1 || a === 2 || a === 3) { return "correct"; }; I am guessing an array needs to be made for 1,2, and 3, but am unsure of how to us instanceof…
-1
votes
2 answers

simplify functions jquery

I have these "functions" that are repeated in the block for the various elements. How can I simplify using "var"? thank you : ) For example: $('#test1').waypoint(function (direction) { if (direction === 'down') { $(this).addClass("here"); …
Andrea
  • 57
  • 7
-1
votes
1 answer

Simplify boolean xy + xy’z + x’yz

I'm trying to prove that XYZ + XYZ' + XY'Z + X'YZ = XY+ XZ + YZ I have gotten so far i think. I don't know if I am on the right track but i keep getting stuck when i end up with this xy + xy’z + x’yz.... here is what i have done: F(X,Y,Z) = XYZ +…
tiinkx
  • 13
  • 1
  • 2
-1
votes
2 answers

Can someone help me simplify this JQuery code?

I'm a beginner in jquery with very basic JavaScript knowledge. I tried to search for a tutorial to simplify my codes, but I couldn't find any. Here is my code: $(".trigger_slide1").hover(function () { …
sandalkoyak
  • 265
  • 2
  • 10
-1
votes
1 answer

Simplyfing functions to plot multiple lines in r

I read a case with the same title in stackoverflow, but it did not solve my questions. I have a data frame like this: ID T1 T2 T3 T4....T10 1 40 50 50 70....40 2 30 60 29 50....NA 3 59 80 NA NA....NA 4 80 90 90 NA....NA I want to have just one…
William Liu
  • 339
  • 1
  • 2
  • 9
-1
votes
3 answers

How to implement greatest common divisor to simplify fractions

#include using namespace std; int g_c_d(int n, int d); class Fraction { private: //variables to store numerator and denominator int num; int denom; public: Fraction(){} Fraction(int num): num(num) {} Fraction(int num, int…
frag r33f
  • 35
  • 4
-1
votes
2 answers

Simplify multiple similar statements on (while)

For example let's say i have this: while( i1 % 1!=0 || i1 % 2!=0 || i1 % 11!=0 || i1 % 16!=0 || i1 % 7!=0 ||i1 % 3!=0 ||i1 % 12!=0 ||i1 % 17!=0 || i1 % 8!=0 ||i1 % 4!=0 ||i1 % 13!=0 ||i1 % 18!=0 || i1 % 9!=0 ||i1 % 5!=0 ||i1…
Ma4nni
  • 1
-1
votes
3 answers

How to simplify an extensive C if statement?

I am wondering what the best way is to approach this problem. I have a randomizing function set up that takes 8 strings as input and outputs a random one of them. I would like this randomizer to disregard all strings which have no value. For…
user1757682
  • 15
  • 1
  • 5
-1
votes
3 answers

How can I avoid the repetitive code in this jQuery code?

I am making a site and this code lets me have several pages in 1 .html file. Can the iterative-ness of this code be avoided? Can it be simplified?