private void EnableGPSAutoMatically() {
        GoogleApiClient googleApiClient = null;
        if (googleApiClient == null) {
            oogleApiClient = new GoogleApiClient.Builder(this)
                    .addApi(LocationServices.API).addConnectionCallbacks(this)
                    .addOnConnectionFailedListener(this).build();
            /* about 50 lines of code were here ... 
             * all depends on this if statement ... !
             * Actually the whole method depends on this if statement ! */
                    }
                }
            });
        }
}

what if that mysterious power change it to be not null !! It gonna be a holly object and You should not "new" it anymore ?! damn ... :)))

By Anonymous, 2018-03-28 11:31:15
string AllPDF = "";
int CountPDF = 0;
AllPDF = txtInput.Text;
string[] AllPDF2 = AllPDF.Split(';');
List<string> PDF = new List<string>();
PDF.AddRange(AllPDF2);
while (PDF.Count != CountPDF)
{
    File.Delete(AllPDF2[0 + CountPDF] + ".pdf");
	CountPDF++;
}

I believe, there are so many easier ways to do that

By Anonymous, 2018-03-27 12:15:10
return isDisabled == false ? false : true;
By Anonymous, 2018-03-23 22:02:31
if student_id:
    assignments = Assignment.objects.filter(week__in=weeks)

    unenrolled_students = Wave.objects.filter(week__in=weeks).values_list('unenrolled_students', flat=True)

    # Construct responses based on assignment type
    Assignment.build_assignments_for_weeks(responses, assignments, students, unenrolled_students)
    max_num_assessments = Assessment.build_assessments_for_weeks(responses)
    Comment.build_comments_for_weeks(responses, weeks, students, unenrolled_students)

elif wave_id:
    assignments = Assignment.objects.filter(week__in=weeks)

    unenrolled_students = Wave.objects.filter(week__in=weeks).values_list('unenrolled_students', flat=True)

    # Construct responses based on assignment type
    Assignment.build_assignments_for_weeks(responses, assignments, students, unenrolled_students)
    max_num_assessments = Assessment.build_assessments_for_weeks(responses)
    Comment.build_comments_for_weeks(responses, weeks, students, unenrolled_students)

else:
    # can't happen
    pass
By Anonymous, 2018-03-23 12:46:10
#266 Java -27
        //JSONObject input;
        
        String givenName = input.get("propName") != null ? (String)input.get("propName") : null;

WHAT DA FUCK ASSHOLES

By Anonymous, 2018-03-15 15:28:55
#265 PHP +17
if((strtotime(date("Y-m-d"))-strtotime(date("Y-m-d", filemtime($filename))))/(3600)<=$config->hourDiff) return true; else return false;

please notice the brackets around 3600

By Anonymous, 2018-03-13 21:56:00
if ($this->getTestSku()) {
   ...
} elseif ($this->getTestOffset() >= 0 && $this->getTestLimit() > 0) {
   ...
} else {
   Mage::throwException(sprintf("Invalid parameters for test mode: sku %s or offset %s and limit %s", $this->getTestSku(), $this->getTestOffset(), $this->getTestLimit()));
}
By Anonymous, 2018-03-13 13:56:56
in_array($this->market, ["ru"])

There is an old mysterious legend, which says that those conditions are lightening fast which are using in_array($source, ["target"]) instead of just "==". Is says always that probably you never do code refactoring, and keep all shit alive

By Anonymous, 2018-03-12 14:47:24
function sortUsers(a, b) {
  return a.last_name.localeCompare(b.last_name) * -1;
}
By Anonymous, 2018-03-06 22:44:30
if (cookiesBannerHeight !== 0 && isMobile) {
      style = {
        top: cookiesBannerHeight === 0 ? 0 : cookiesBannerHeight
      }
}
By Kubus, 2018-02-28 11:00:11
public void Method1(Enum foo)
{
    if (GetCondition1(foo))
    {
        doSomething();
    }
}

private bool GetCondition1(Enum foo)
{
    if (foo == Enum.Value1)
        return true;

    return false;
}
By Anonymous, 2018-02-23 17:34:55

// enum - full enumeration of knapsack solutions
// (C) Joshua Knowles

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>

FILE *fp;  // file pointer for reading the input files
int Capacity;     // capacity of the knapsack (total weight that can be stored)
int Nitems;    // number of items available
int *item_weights;  // vector of item weights
int *item_values;  // vector of item profits or values
int *temp_indexes;  // list of temporary item indexes for sorting items by value/weight
int QUIET=0; // this can be set to 1 to suppress output

extern void read_knapsack_instance(char *filename);
extern void print_instance();
extern void sort_by_ratio();
extern int check_evaluate_and_print_sol(int *sol,  int *total_value, int *total_weight);
void enumerate();
int next_binary(int *str, int Nitems);

int main(int argc, char *argv[])
{
  read_knapsack_instance(argv[1]);
  print_instance();
  enumerate();
  return(0);
}

void enumerate()
{
  // Do an exhaustive search (aka enumeration) of all possible ways to pack
  // the knapsack.
  // This is achieved by creating every binary solution vector of length Nitems.
  // For each solution vector, its value and weight is calculated.


  int i;  // item index
  int solution[Nitems+1];   // (binary) solution vector representing items packed
  int best_solution[Nitems+1];  // (binary) solution vector for best solution found
  int best_value; // total value packed in the best solution
  double j=0;
  int total_value, total_weight; // total value and total weight of current knapsack solution
  int infeasible;  // 0 means feasible; -1 means infeasible (violates the capacity constraint)

  // set the knapsack initially empty
  for(i=1;i<=Nitems;i++)
    {
      solution[i]=0;
    }
  QUIET=1;
  best_value=0;

 while(!(next_binary(&solution[1], Nitems)))
    {

      /* ADD CODE IN HERE TO KEEP TRACK OF FRACTION OF ENUMERATION DONE */

          // calculates the value and weight and feasibility:
      infeasible=check_evaluate_and_print_sol(solution, &total_value, &total_weight);  
      /* ADD CODE IN HERE TO KEEP TRACK OF BEST SOLUTION FOUND*/

    }
 /* ADD CODE TO PRINT OUT BEST SOLUTION */

}


int next_binary(int *str, int Nitems)
{
  // Called with a binary string of length Nitems, this 
  // function adds "1" to the string, e.g. 0001 would turn to 0010.
  // If the string overflows, then the function returns 1, else it returns 0.
  int i=Nitems-1;
  while(i>=0)
    {
      if(str[i]==1)
	{
	  str[i]=0;
	  i--;
	}
      else
	{
	  str[i]=1;
	  break;
	}
    }
  if(i==-1)
    {
      return(1);
    }
  else
    {
      return(0);
    }
}

A genuine UoM lab.

By Joshua Knowles, 2018-02-23 10:58:03
if(computedDate != null){
    myObject.setDueDate(computedDate);
}
else{
    myObject.setDueDate(null);
}
By Anonymous, 2018-02-22 04:46:08
/**
 * Creates hash of client/customer password
 * @param string $password The actual password
 * @return string MD5 hash of password with salt
 */
public static function hashPassword($password)
{
	return md5($password . $password. 'SOME-SECRET-STRING' . $password);
}
By Anonymous, 2018-02-21 13:22:27
<?
function null($null) {
    return null;   
}
By SH2, 2018-02-20 11:31:33