public IsTrueWithNewTokenResponse isVoice(String token){
    IsTrueWithNewTokenResponse isTrue = isWhatever(token, 0)
    resultStatus.success = isTrue.generalResultResponse.success;
    resultStatus.statusCode = isTrue.generalResultResponse.statusCode;
    resultStatus.statusDescription  = isTrue.generalResultResponse.statusDescription;
    if(isTrue != null && isTrue.generalResultResponse != null && isTrue.generalResultResponse.success){
        isTrue.isTrue = !isTrue.isTrue
        return isTrue
    } else {
        return isTrue
    }
}
By Anonymous, 2017-12-18 09:11:43
private static final double RESULT_OF_DIVISION_BY_0 = 9.99;

public static double getPercentageDifference(long currentResult, long previousResult) {
    if (previousResult == 0 && currentResult == 0) {
        return 0;
    } else if (previousResult == 0) {
        return RESULT_OF_DIVISION_BY_0;
    } else {
        return (currentResult - previousResult) * 1.0 / previousResult;
    }
}
By Anonymous, 2017-12-20 10:56:50
Public Shared Function CompeleteDateStr(DateStr As String) As String
    'MBS 96-09-25: High Caliber DataEntry
    Dim DateVal = CType(DateStr, Integer)
    If DateVal < 1 Then Return ""
    If DateVal < maxDay Then 'DayOnly
        Return MakeJalaliDate(curYear, curMonth, DateVal, _4DigitYear)
    ElseIf DateVal > maxDay Then
        Dim YearPiece? As Short = Nothing, MonthPiece? As Byte = Nothing, DayPiece As Byte
        Select Case DateVal
            Case Is < 100
                MonthPiece = (DateVal \ 10) Mod 10
                DayPiece = DateVal Mod 10
                If IsValidMonth(MonthPiece) AndAlso IsValidDay(DayPiece, MonthPiece, curYear) Then Return MakeJalaliDate(curYear, MonthPiece, DayPiece, _4DigitYear)
            Case Is < 1000
                MonthPiece = DateVal \ 10
                DayPiece = DateVal Mod 10
                If IsValidMonth(MonthPiece) AndAlso IsValidDay(DayPiece, MonthPiece, curYear) Then Return MakeJalaliDate(curYear, MonthPiece, DayPiece, _4DigitYear)
                MonthPiece = (DateVal \ 100) Mod 10
                DayPiece = DateVal Mod 100
                If IsValidMonth(MonthPiece) AndAlso IsValidDay(DayPiece, MonthPiece, curYear) Then Return MakeJalaliDate(curYear, MonthPiece, DayPiece, _4DigitYear)
                DayPiece = DateVal \ 10
                MonthPiece = DateVal Mod 10
                If IsValidMonth(MonthPiece) AndAlso IsValidDay(DayPiece, MonthPiece, curYear) Then Return MakeJalaliDate(curYear, MonthPiece, DayPiece, _4DigitYear)
                DayPiece = (DateVal \ 100) Mod 10
                MonthPiece = DateVal Mod 100
                If IsValidMonth(MonthPiece) AndAlso IsValidDay(DayPiece, MonthPiece, curYear) Then Return MakeJalaliDate(curYear, MonthPiece, DayPiece, _4DigitYear)
            Case Is < 10000
                MonthPiece = DateVal \ 100
                DayPiece = DateVal Mod 100
                If IsValidMonth(MonthPiece) AndAlso IsValidDay(DayPiece, MonthPiece, curYear) Then Return MakeJalaliDate(curYear, MonthPiece, DayPiece, _4DigitYear)
                MonthPiece = DateVal Mod 100
                DayPiece = DateVal \ 100
                If IsValidMonth(MonthPiece) AndAlso IsValidDay(DayPiece, MonthPiece, curYear) Then Return MakeJalaliDate(curYear, MonthPiece, DayPiece, _4DigitYear)
                DayPiece = DateVal \ 100
                MonthPiece = DateVal Mod 100
                If IsValidMonth(MonthPiece) AndAlso IsValidDay(DayPiece, MonthPiece, curYear) Then Return MakeJalaliDate(curYear, MonthPiece, DayPiece, _4DigitYear)
                DayPiece = DateVal Mod 100
                MonthPiece = DateVal \ 100
                If IsValidMonth(MonthPiece) AndAlso IsValidDay(DayPiece, MonthPiece, curYear) Then Return MakeJalaliDate(curYear, MonthPiece, DayPiece, _4DigitYear)
                MonthPiece = (DateVal \ 10) Mod 10
                YearPiece = DateVal \ 100
                If IsValidMonth(MonthPiece) Then
                    DayPiece = DateVal Mod 10
                    If IsValidDay(DayPiece, MonthPiece, YearPiece) Then Return MakeJalaliDate(YearPiece, MonthPiece, DayPiece, _4DigitYear)
                Else
                    MonthPiece = (DateVal \ 100) Mod 10
                    YearPiece = DateVal Mod 100
                    DayPiece = DateVal \ 1000
                    If IsValidMonth(MonthPiece) AndAlso IsValidDay(DayPiece, MonthPiece, YearPiece) Then Return MakeJalaliDate(YearPiece, MonthPiece, DayPiece, _4DigitYear)
                End If
            Case Is < 100000
                Dim DaySize As Byte = 2
                MonthPiece = (DateVal Mod 1000) \ 10
                If Not IsValidMonth(MonthPiece) Then
                    MonthPiece = (DateVal \ 100) Mod 10
                    DaySize = 1
                    If Not IsValidMonth(MonthPiece) Then Return ""
                End If
                YearPiece = DateVal \ 1000
                DayPiece = DateVal Mod 10 ^ DaySize
                If IsValidDay(DayPiece, MonthPiece, YearPiece) Then Return MakeJalaliDate(YearPiece, MonthPiece, DayPiece)
                YearPiece = DateVal Mod 100
                DayPiece = DateVal \ (10000 \ (10 ^ DaySize))
                If IsValidDay(DayPiece, MonthPiece, YearPiece) Then Return MakeJalaliDate(YearPiece, MonthPiece, DayPiece)
            Case Is < 1000000
                MonthPiece = (DateVal Mod 10000) \ 100
                If IsValidMonth(MonthPiece) Then
                    YearPiece = DateVal \ 10000
                    DayPiece = DateVal Mod 100
                    If IsValidDay(DayPiece, MonthPiece, YearPiece) Then Return MakeJalaliDate(YearPiece, MonthPiece, DayPiece, _4DigitYear)
                    YearPiece = DateVal Mod 100
                    DayPiece = DateVal \ 10000
                    If IsValidDay(DayPiece, MonthPiece, YearPiece) Then Return MakeJalaliDate(YearPiece, MonthPiece, DayPiece, _4DigitYear)
                End If
                YearPiece = DateVal \ 100
                If YearPiece > 1300 AndAlso YearPiece < 1500 Then
                    MonthPiece = (DateVal \ 10) Mod 10
                    DayPiece = DateVal Mod 10
                    If IsValidMonth(MonthPiece) AndAlso IsValidDay(DayPiece, MonthPiece, YearPiece) Then Return MakeJalaliDate(YearPiece, MonthPiece, DayPiece, _4DigitYear)
                End If
                YearPiece = DateVal Mod 10000
                If YearPiece > 1300 AndAlso YearPiece < 1400 Then
                    DayPiece = DateVal \ 100000
                    MonthPiece = (DateVal \ 10000) Mod 10
                    If IsValidMonth(MonthPiece) AndAlso IsValidDay(DayPiece, MonthPiece, YearPiece) Then Return MakeJalaliDate(YearPiece + If(_4DigitYear, 0, -1300), MonthPiece, DayPiece, _4DigitYear)
                End If
            Case Is < 10000000
                Dim DaySize As Byte = 2
                MonthPiece = (DateVal Mod 1000) \ 10
                If Not IsValidMonth(MonthPiece) Then
                    MonthPiece = (DateVal \ 100) Mod 10
                    DaySize = 2
                    If Not IsValidMonth(MonthPiece) Then Return ""
                End If
                YearPiece = DateVal \ 1000
                DayPiece = DateVal Mod 10 ^ DaySize
                If IsValidDay(DayPiece, MonthPiece, YearPiece) Then Return MakeJalaliDate(YearPiece, MonthPiece, DayPiece)
                YearPiece = DateVal Mod 10000
                DayPiece = DateVal \ (100000 * (10 ^ DaySize))
                If IsValidDay(DayPiece, MonthPiece, YearPiece) Then Return MakeJalaliDate(YearPiece, MonthPiece, DayPiece)
            Case Is < 100000000
                MonthPiece = (DateVal Mod 10000) \ 100 '13961229
                If IsValidMonth(MonthPiece) Then
                    YearPiece = DateVal \ 10000
                    DayPiece = DateVal Mod 100
                    If IsValidDay(DayPiece, MonthPiece, YearPiece) Then Return MakeJalaliDate(YearPiece, MonthPiece, DayPiece, _4DigitYear)
                    YearPiece = DateVal Mod 10000
                    DayPiece = DateVal \ 1000000
                    If IsValidDay(DayPiece, MonthPiece, YearPiece) Then Return MakeJalaliDate(YearPiece, MonthPiece, DayPiece, _4DigitYear)
                End If
        End Select
        Return ""
    End If
End Function

this code is so wrong in so many different levels

By NoobProger, 2017-12-20 12:37:08
// check if user is valid or not
ValidUserValidationResult userValidationResult = validUserValidator.validateUser(validationRequest);
By Anonymous, 2020-12-09 17:45:18
$("#search-submit").click(function() {
  $("#search form").submit()
});

type="submit" is too mainstream, jquery is the proper way to do it

By Kadet, 2016-02-13 16:44:10

var move=0;
var kier=0;
var pic=0;
var rol=0;

var rol2=171;
var rol3=343;
var rol4=514;
var rol2_cel=171;
var rol3_cel=343;
var rol4_cel=514;

function onpic(p) {
  pic=p;
}

function offpic(p) {
  if( pic==p ) pic=0;
}

 function next() { if(move<40) move = 40; kier=0; }
 function prev() { if(move<40) move = 60; kier=1; }
 function set() {
  document.getElementById('ba1').style.left=0;
  document.getElementById('ba2').style.left=rol2;
  document.getElementById('ba3').style.left=rol3;
  document.getElementById('ba4').style.left=rol4;
}


function SetOpacity(object,opacityPct)
{
  // IE.
  object.style.filter = 'alpha(opacity=' + opacityPct + ')';
  // Old mozilla and firefox
  object.style.MozOpacity = opacityPct/100;
  // Everything else.
  object.style.opacity = opacityPct/100;
}


var randtim=new Array(110,103,130,125,108,118,112,122,101,100);
var showtimer=0;
var showpic=1;

 
 function Animuj() {
   if( pic==0 ) {
     rol2_cel=171;
     rol3_cel=343;
     rol4_cel=514;
   } else if( pic==1 ) {
     rol2_cel=342;
     rol3_cel=457;
     rol4_cel=571;
   } else if( pic==2 ) {
     rol2_cel=115;
     rol3_cel=457;
     rol4_cel=571;
   } else if( pic==3 ) {
     rol2_cel=114;
     rol3_cel=229;
     rol4_cel=571;
   } else if( pic==4 ) {
     rol2_cel=114;
     rol3_cel=228;
     rol4_cel=344;
   }
   var a = (rol2-rol2_cel)/10; if(( a< -0.1 )&&( a> -1 )) a = -1; if(( a>0.1 )&&( a<1 )) a = 1;
   if( rol2!=rol2_cel ) rol2-= a;
   var a = (rol3-rol3_cel)/10; if(( a< -0.1 )&&( a> -1 )) a = -1; if(( a>0.1 )&&( a<1 )) a = 1;
   if( rol3!=rol3_cel ) rol3-= a;
   var a = (rol4-rol4_cel)/10; if(( a< -0.1 )&&( a> -1 )) a = -1; if(( a>0.1 )&&( a<1 )) a = 1;
   if( rol4!=rol4_cel ) rol4-= a;
   set();
    document.getElementById('ba2').style.left=rol2;



 showtimer+=1;
 if(showtimer>100) {
  for( st=0; st<9; ++st ) {
   if(showtimer==randtim[st]) { SetOpacity(document.getElementById("ps"+st), 0); document.getElementById("ps"+st).style.backgroundImage="url('cs/log"+showpic+".jpg')"; }
   if(showtimer==(randtim[st]+1)) SetOpacity(document.getElementById("ps"+st),20); 
   if(showtimer==(randtim[st]+2)) SetOpacity(document.getElementById("ps"+st),40); 
   if(showtimer==(randtim[st]+3)) SetOpacity(document.getElementById("ps"+st),60); 
   if(showtimer==(randtim[st]+4)) SetOpacity(document.getElementById("ps"+st),80); 
   if(showtimer==(randtim[st]+5)) { document.getElementById("pn"+st).style.backgroundImage="url('cs/log"+showpic+".jpg')"; SetOpacity(document.getElementById("ps"+st),0); }
  }
  if(showtimer>150) {
   showtimer=0;
   for( st=0; st<9; ++st ) randtim[st]=Math.floor(Math.random()*26)+100;
   showpic+=1; if(showpic>2) showpic=0;
  }
 }


 }

 window.setInterval("Animuj()", 50);

This is how public money is spent in poland

By Anonymous, 2019-05-29 18:35:09
void destroy_phone(T9obj* ptr_T9Obj){
    free(ptr_T9Obj);
}

Such thoughtful name!

By farhanhubble, 2019-05-30 08:57:39
int w = 100;

for (nil; w!=0; nil) {

    w -= 1;

    //so some shit
}

this code was found in chinese contract work

By JeanetteMueller, 2021-03-08 11:58:39
class PythonClass {
    protected boolean True = true;
    protected boolean False = false;
    protected Object None = null;
}

class MyClass extends PythonClass {
    String do_something(Object foo) {
        if (foo == False)
            return ""                                  ;
        
        
        else if (foo == None)
            return "!"                                 ;
            
        else if (foo == True)
            return "Yay!"                              ;
    }
}

Yikes

By imaginedev, 2021-04-03 02:44:52
if ($customerId > 0) {
    $customerId = $customerId;
} else {
    $customerId = $this->customerSession->getId();
}
By Anonymous, 2018-01-10 16:42:14
if(computedDate != null){
    myObject.setDueDate(computedDate);
}
else{
    myObject.setDueDate(null);
}
By Anonymous, 2018-02-22 04:46:08
def possibilities():
    alphabets=(n,o,r,t,h,e,a,s,u,w,m,y)
    combinations=list()
    for n in range(9,-1,-1):
            for o in range(9,-1,-1):
                    for r in range(9,-1,-1):
                            for t in range(9,-1,-1):
                                    for h in range(9,-1,-1):
                                            for e in range(9,-1,-1):
                                                    for a in range(9,-1,-1):
                                                            for s in range(9,-1,-1):
                                                                    for u in range(9,-1,-1):
                                                                            for w in range(9,-1,-1):
                                                                                    for m in range(9,-1,-1):
                                                                                            for y in range(9,-1,-1):
                                                                                                    if len(set([n,o,r,t,h,e,a,s,u,w,m,y]))==12:
                                                                                                    north=10000*n + 1000*o +100*r +10*t +h
                                                                                                    east=1000*e +100*a +10*s +t
                                                                                                    south=10000*s + 1000*o +100*u +10*t +h
                                                                                                    west=1000*w + 100*e +10*s +t
                                                                                                    earth= 10000*e + 1000*a + 100*r +10*t +h
                                                                                                    if north +east +south +west == earth:
                                                                                                            combinations.append((north,east,south,west,earth))

    return combinations
By Dusk Code, 2018-04-25 11:47:49
   // Test read access of memory
   try
   {
      c = ( (char*) pvMemory )[0];
      c = ( (char*) pvMemory )[iNLen - 1];
   }

   catch( ... ) {
      return -1;
   }
By Anonymous, 2022-10-19 16:28:05
public List<Location> searchLocations(final String phrase) {
        final String like = phrase.replaceAll("(\\s)", "%$1") + "%";
        final List<Location> result = getLocations(
                "replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(\n" +
                        "replace(lower(name),'.',' '),\n" +
                        "'á','a'),\n" +
                        "'é','e'),\n" +
                        "'í','i'),\n" +
                        "'ĺ','l'),\n" +
                        "'ó','o'),\n" +
                        "'ŕ','r'),\n" +
                        "'ú','u'),\n" +
                        "'ý','y'),\n" +
                        "'č','c'),\n" +
                        "'ď','s'),\n" +
                        "'ľ','l'),\n" +
                        "'ň','n'),\n" +
                        "'š','s'),\n" +
                        "'ť','t'),\n" +
                        "'ž','z'),\n" +
                        "'ä','a'),\n" +
                        "'ô','o') LIKE lower(?)\n" +
                        "ORDER BY CASE country_code WHEN 'SK' THEN 0 ELSE 1 END, length(name), name", like);
        return result;
    }

Author: I am satisfied with the project and I don't think I have anything to be ashamed of

By Anonymous, 2020-07-16 10:49:27
string month = DateTime.Today.Month.ToString();
if (DateTime.Today.Month < 10)
{
    month = "0" + month;
}
string day = DateTime.Today.Day.ToString();
if (DateTime.Today.Day < 10)
{
    day = "0" + day;
}

string dateCorrect = String.Format("{0}.{1}.{2}", DateTime.Today.Year, month, day);

string dateDue = "";
if (transferFields.DueDate.SelectedDate.HasValue)
{
    var dateDuearr = transferFields.DueDate.Value.Split(' ')[0].Split('.');
    dateDue = dateDuearr[2] + '.' + dateDuearr[1] + '.' + dateDuearr[0];
}
else {
    dateDue = dateCorrect;
}

Real developers don't use built in parsing and formatting methods.

By You will be proud of our code!, 2017-12-12 09:53:08