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
5 answers

Correct syntax for $(this)

I have a jquery function where I repeat the .red way too many times. I would like to replace them for $(this) instead, but I don't know the correct way to do it apparently. $(".red").ready(function () { …
Dlacrem
  • 71
  • 3
  • 10
-3
votes
2 answers

Shrinking url in PHP

I'm trying to show this url http://www.xyz.com/catnew/newcat.php as http://www.xyz.com/cat. Any help is appreciated.
Kishor Kumar
  • 543
  • 1
  • 12
  • 33
-3
votes
3 answers

How do I make this python code a one liner?

for _ in line: if line == "t": t += 1 else: s += 1 How do I make this python code a one liner?
-3
votes
2 answers

Join table with values in multiple columns to table with values in multiple rows

I have two tables. REJECT_REASONS Account_No Resn_Id1 Resn_Id2 Resn_Id3 Resn_Id4 100 0001 0005 0006 0104 101 0005 0006 0104 102 0001 0006 103 104 0001 REASON_DESC Resn_Id Resn_Desc 0001 Bad…
marecar
  • 1
  • 1
-3
votes
3 answers

How to reduce the character as small as possible for the assigned function in Python

For Python, def fun1(name, ext): if ext == '' : fname = name + '$' else: fname = name + ext return fname I have to make fun2 as short as possible with less than 25 characters that work exactly the same as fun1. So far, I…
JungSoo Ok
  • 11
  • 4
-3
votes
3 answers

Python Bulk 'If' Statements

I'm drawing a blank on what should be a simple question so any help is appreciated. Is there a better way to handle all these 'if' statements rather than having them copied into each function? This isn't the whole code but it should show my issue.…
Alex
  • 5
-3
votes
2 answers

How to simplify an account code?

I am making an account code in python and it works but it is really long and I want to know if there is a way to shorten it. Here is my code: user1 = "Jeff" user2 = "Bob" password1 = "Password" password2 = "Lol" username = input("Login: >>…
S.James
  • 19
  • 7
-3
votes
1 answer

what is the opposite of this logical statement

I would like to check for the else condition only. Is there a way that I can simplify the code below? if (_endCurrentGoal && _startCurrentGoal && _startCurrentGoal === _startEffectiveDate && _endCurrentGoal === _endEffectiveDate) { //no…
noob
  • 45
  • 3
  • 11
-3
votes
1 answer

How can I simplify this JavaScript?

I made this. Can anyone suggest how I can make it shorter without losing its properties? Please keep the English simple. function LetterChanges(str) { var se = ""; for(var i = 0;i < str.length;i++){ var ser = str.charAt(i); …
aqw alhadary
  • 184
  • 1
  • 10
-3
votes
1 answer

Simpler way to write this code?

This is for my button named Edit, when you have an entry into the shopping basket and click on the entry and click Edit it opens up a new window which allows you to edit the entries, product name, quantity or price. This is what I have and it…
-3
votes
1 answer

New to jQuery with ASP.NET, simplifying jQuery code?

So I have the below little number on a ASP.NET page. The page consists of a gridview that I'm happy with, there is a checkbox in each row and once checked enables other controls in row, a save button iterates through the rows and actions into…
-3
votes
1 answer

Simplify JQuery Codes

Good Day! I'd like to ask something . Is there such a way that could shorten these lines of mine in jquery? I mean specially in the if-else part. Thank you! $("#banner a").bind("click",function(event){//2 event.preventDefault(); target =…
-4
votes
2 answers

How to simplify converting several column attributes and recoding multiple columns?

I have several lines of codes that I'm figuring out how to simplify. My attempts to do so have resulted in errors. Below is a small section of the lines of code: SS_data$Cope1 <- as.numeric(SS_data$Cope1) SS_data$Cope2 <-…
Jarhed
  • 13
  • 3
-4
votes
2 answers

Trying to Beautify this Arduino Code [Beginner here]

complete beginner here, I was wondering if it's possible to simplify this code, to thin it down or shorten it up. As you can easily tell, this thing makes one led turn on when the other is off and viceversa, in a loop. void setup() { pinMode(3,…
-4
votes
1 answer

How do I simplify this code and remove some loops?

Is it possible to write the following code with less foreach loops? var pensInShed = _db.Pens.Where(w => w.ShedId == selectedShedGuid).Select(s => s.PensGuid); foreach(var penId in pensInShed) { …
GeorgeB
  • 808
  • 1
  • 8
  • 26
1 2 3
51
52