elsif ( $att =~ m/!!ARRAY!!/ ) {    # Updated to allow us to get data from an Array - 
        &Debug("get_value_from_hash:: parsing the ARRAY attribute - $att");
        my ( $key1, $key2, $key3, $key4, $key5, $key6 ) = split( /\./, $att );

        #&Debug("get_value_from_hash:: key1=$key1, key2=$key2, key3=$key3, key4=$key4, key5=$key5");
        if ( defined $key6 ) {
            if ( $key5 =~ m/!!ARRAY!!/ ) {
                for my $item ( @{ $hash->{$key1}->{$key2}->{$key3}->{$key4} } ) { $value = $item->{$key6}; }
            }
            elsif ( $key4 =~ m/!!ARRAY!!/ ) {
                for my $item ( @{ $hash->{$key1}->{$key2}->{$key3} } ) { $value = $item->{$key5}->{$key6}; }
            }
            elsif ( $key3 =~ m/!!ARRAY!!/ ) {
                for my $item ( @{ $hash->{$key1}->{$key2} } ) { $value = $item->{$key4}->{$key5}->{$key6}; }
            }
            elsif ( $key2 =~ m/!!ARRAY!!/ ) {
                for my $item ( @{ $hash->{$key1} } ) { $value = $item->{$key3}->{$key4}->{$key5}->{$key6}; }
            }
            elsif ( $key1 =~ m/!!ARRAY!!/ ) {
                for my $item ( @{$hash} ) { $value = $item->{$key2}->{$key3}->{$key4}->{$key5}->{$key6}; }
            }
        }
        elsif ( defined $key5 ) {
            if ( $key4 =~ m/!!ARRAY!!/ ) {
                for my $item ( @{ $hash->{$key1}->{$key2}->{$key3} } ) { $value = $item->{$key5}; }
            }
            elsif ( $key3 =~ m/!!ARRAY!!/ ) {
                for my $item ( @{ $hash->{$key1}->{$key2} } ) { $value = $item->{$key4}->{$key5}; }
            }
            elsif ( $key2 =~ m/!!ARRAY!!/ ) {
                for my $item ( @{ $hash->{$key1} } ) { $value = $item->{$key3}->{$key4}->{$key5}; }
            }
            elsif ( $key1 =~ m/!!ARRAY!!/ ) {
                for my $item ( @{$hash} ) { $value = $item->{$key1}->{$key3}->{$key4}->{$key5}; }
            }
        }
        elsif ( defined $key4 ) {
            if ( $key3 =~ m/!!ARRAY!!/ ) {
                for my $item ( @{ $hash->{$key1}->{$key2} } ) { $value = $item->{$key4}; }
            }
            elsif ( $key2 =~ m/!!ARRAY!!/ ) {
                for my $item ( @{ $hash->{$key1} } ) { $value = $item->{$key3}->{$key4}; }
            }
            elsif ( $key1 =~ m/!!ARRAY!!/ ) {
                for my $item ( @{$hash} ) { $value = $item->{$key1}->{$key3}->{$key4}; }
            }
        }
        elsif ( defined $key3 ) {
            if ( $key2 =~ m/!!ARRAY!!/ ) {
                for my $item ( @{ $hash->{$key1} } ) { $value = $item->{$key3}; }
            }
            elsif ( $key1 =~ m/!!ARRAY!!/ ) {
                for my $item ( @{$hash} ) { $value = $item->{$key3}; }
            }
        }
        elsif ( defined $key2 ) {
            if ( $key1 =~ m/!!ARRAY!!/ ) {
                for my $item ( @{$hash} ) { $value = $item->{$key2}; }
            }
        }
    }
    elsif ( $att =~ m/!!HITS\[\d+\]!!/ ) {
        &Debug("get_value_from_hash:: parsing the HITS attribute - $att");
        my $id = $att;
        $id =~ s/!!HITS\[(\d+)\]!!.*/$1/;
        $att =~ s/!!HITS\[\d+\]!!\.//;
        &Debug("get_value_from_hash:: parsing the attribute - $att");
        my ( $key1, $key2, $key3, $key4, $key5, $key6 ) = split( /\./, $att );

        #&Debug("get_value_from_hash:: id=$id, key1=$key1, key2=$key2, key3=$key3, key4=$key4, key5=$key5");
        if ( defined $key6 ) {
            $value = $$hash{hits}{hits}[$id]{$key1}{$key2}{$key3}{$key4}{$key5}{$key6};
        }
        elsif ( defined $key5 ) {
            $value = $$hash{hits}{hits}[$id]{$key1}{$key2}{$key3}{$key4}{$key5};
        }
        elsif ( defined $key4 ) {
            $value = $$hash{hits}{hits}[$id]{$key1}{$key2}{$key3}{$key4};
        }
        elsif ( defined $key3 ) {
            $value = $$hash{hits}{hits}[$id]{$key1}{$key2}{$key3};
        }
        elsif ( defined $key2 ) {
            $value = $$hash{hits}{hits}[$id]{$key1}{$key2};
        }
    }
    elsif ( $att =~ m/!!DELIMITER!!.+!!/ ) {
        &Debug("get_value_from_hash:: parsing the DELIMITER attribute - $att");
        my $delimiter = $att;
        $delimiter =~ s/!!DELIMITER!!(.*)!!.*/$1/;
        $att =~ s/!!DELIMITER!!.+!!//;
        &Debug("get_value_from_hash:: parsing the attribute - $att");
        my ( $key1, $key2, $key3, $key4, $key5, $key6 ) = split( $delimiter, $att );

        #        &Debug("get_value_from_hash:: key1=$key1, key2=$key2, key3=$key3, key4=$key4, key5=$key5, key6=$key6");
        if ( defined $key6 ) {
            $value = $$hash{$key1}{$key2}{$key3}{$key4}{$key5}{$key6};
        }
        elsif ( defined $key5 ) {
            $value = $$hash{$key1}{$key2}{$key3}{$key4}{$key5};
        }
        elsif ( defined $key4 ) {
            $value = $$hash{$key1}{$key2}{$key3}{$key4};
        }
        elsif ( defined $key3 ) {
            $value = $$hash{$key1}{$key2}{$key3};
        }
        elsif ( defined $key2 ) {
            $value = $$hash{$key1}{$key2};
        }
    }
    else {
        &Debug("get_value_from_hash:: parsing the attribute - $att");
        my ( $key1, $key2, $key3, $key4, $key5, $key6 ) = split( /\./, $att );

        #&Debug("get_value_from_hash:: key1=$key1, key2=$key2, key3=$key3, key4=$key4, key5=$key5");
        if ( defined $key6 ) {
            $value = $$hash{$key1}{$key2}{$key3}{$key4}{$key5}{$key6};
        }
        elsif ( defined $key5 ) {
            $value = $$hash{$key1}{$key2}{$key3}{$key4}{$key5};
        }
        elsif ( defined $key4 ) {
            $value = $$hash{$key1}{$key2}{$key3}{$key4};
        }
        elsif ( defined $key3 ) {
            $value = $$hash{$key1}{$key2}{$key3};
        }
        elsif ( defined $key2 ) {
            $value = $$hash{$key1}{$key2};
        }
    }

When you try to debug, why value is not filled, and find this...

By Anonymous, 2022-01-04 07:00:11
        protected override void OnStartup(StartupEventArgs e)
        {
            Current.DispatcherUnhandledException += ApplicationUnhandledException;

            base.OnStartup(e);

#if (DEBUG)
            RunInDebugMode(e.Args);
#else
            RunInReleaseMode(e.Args);
#endif
        }

#endregion

        private static void RunInReleaseMode(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += AppDomainUnhandledException;

            try
            {
                SplashScreen screen = new SplashScreen(@"Images\splashscreen.png");
                screen.Show(true, true);

                RunInDebugMode(args);
            }
            catch (Exception ex)
            {
                HandleException(ex);
            }
        }

        private static void RunInDebugMode(string[] args)
        {
            var bootstrapper = new Bootstrapper();
            bootstrapper.Run();
        }
By Anonymous, 2019-07-09 09:44:00
 const configs = {
    employeeObject: {
      // tab 0
      firstName: "",
      middleName: "",
      nickname: "",
      lastName: "",
      gender: "",
      race: "",
      title: "",
      dob: "",
      employeeIDNo: "",
      // tab 1
      userName: "",
      permissionRole: 0,
      employeeNo: "",
      phoneExt: "",
      startDate: "",
      company: "",
      division: "",
      jobDescription: "",
      businessUnit: "",
      regionId: "",
      participantStatus: "",
      costCentre: "",
      personType: "",
      comments: "",
      // tab 2
      phone1: "",
      phone2: "",
      phone3: "",
      address1: "",
      address2: "",
      address3: "",
      address4: "",
      postalCode: "",
      email: "",
    },

Why add another object with a title when you can just add a comment saying... well... nothing really...

By Mr Verster, 2022-04-08 14:19:12
function resetfields_simple()
{
	pole1=document.getElementById('dataOd');
	pole1.value='';
	pole2=document.getElementById('dataDo');
	pole2.value='';
	pole3=document.getElementById('trescKom');
	pole3.value='';	
	pole4=document.getElementById('katId');
	pole4.value='';	
}

function resetfields()
{
	pole1=document.getElementById('dataOd');
	pole1.value='';
	pole2=document.getElementById('dataDo');
	pole2.value='';
	pole3=document.getElementById('trescKom');
	pole3.value='';	
	pole4=document.getElementById('dokId');
	pole4.value='';	
	pole5=document.getElementById('katId');
	pole5.value='';	
	pole6=document.getElementById('currId');
	pole6.value='';		
}

function resetfields_arch()
{
	pole1=document.getElementById('dataOd');
	pole1.value='';
	pole2=document.getElementById('dataDo');
	pole2.value='';
	pole3=document.getElementById('trescKom');
	pole3.value='';	
	pole4=document.getElementById('dokId');
	pole4.value='';	
	pole5=document.getElementById('katId');
	pole5.value='';	
}
By javascriptowiec, 2020-06-30 21:29:57
func runAnsible(c *cli.Context) {
    runAnsibleCmd1(c.String("command"), c.StringSlice("var-file"), c.StringSlice("var"))
}
func runAnsibleCmd1(cmd string, varfiles []string, varstrs []string) {
    runAnsibleCmd2(cmd, util.ToVars(varfiles, varstrs))
}
func runAnsibleCmd2(cmd string, vars map[string]interface{}) {
    err := exec.SyscallExecute(cmd, vars)
    log.Error("Error running ansible command.", "err", err.Error())
}
By PANDUDH, 2019-04-16 18:03:41
        public static bool ValidateEmailAddress(string emailAddress)
        {
            string pattern = "^((?>[a-zA-Z\\d!#$%&'*+\\-/=?^_`{|}~]+\x20*|\"((?=[\x01-\x7f])[^\"\\]|\\[\x01-\x7f])*\"\x20*)*(?<angle><))?((?!\\.)(?>\\.?[a-zA-Z\\d!#$%&'*+\\-/=?^_`{|}~]+)+|\"((?=[\x01-\x7f])[^\"\\]|\\[\x01-\x7f])*\")@(((?!-)[a-zA-Z\\d\\-]+(?<!-)\\.)+[a-zA-Z]{2,}|\\[(((?(?<!\\[)\\.)(25[0-5]|2[0-4]\\d|[01]?\\d?\\d)){4}|[a-zA-Z\\d\\-]*[a-zA-Z\\d]:((?=[\x01-\x7f])[^\\\\[\\]]|\\[\x01-\x7f])+)\\])(?(angle)>)$";

            if (!String.IsNullOrEmpty(emailAddress) && !(Regex.Match(emailAddress.Trim(), pattern, RegexOptions.IgnoreCase)).Success)
            {
                return false;
            }
            return true;
        }
By Anonymous, 2019-07-17 23:47:20
try
{
    len = readBufferSize(reader);
}
catch (IOException xcp)
{
    throw xcp;
}

I swear I didn't omit a single symbol (except for tabs at the beginning)

By RusAD, 2019-07-18 09:24:10
 filterForProvincia() {
    console.log('ciao');
 }

The last line of code of a parting Developer

By Anonymous, 2019-07-23 11:31:51
if(typeof(sortOrder) != "boolean"){        
    return items;
}
filtered.sort(function (a, b) {
    if(sortOrder == true){
        return (CustomOrder(a.status) > CustomOrder(b.status) ? 1 : -1);
    }
    else if(sortOrder == false){
        return (CustomOrder(a.status) < CustomOrder(b.status) ? 1 : -1);
    }
});

The status property is a string ("Started", "Running", "Failed", "Finished", etc.), and CustomOrder is a function with a switch that just returns a predefined integer for each string. I switched CustomOrder to just be a simple lookup table object, and the sort call was changed to filtered.sort((a, b) => CustomOrder[a.status] - CustomOrder[b.status]);

By Anonymous, 2017-12-13 00:06:25
val weekEnd = DateTime.now.withDayOfWeek(5).plusDays(2)
By Anonymous, 2017-12-22 13:55:37
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.


   O | O | O 
  -----------
   O | O | O 
  -----------
   O | O | O 
     

 */
package tictactoe;

import java.util.Scanner;

public class TicTacToe {

    /**
     * @param args the command line arguments
     * @throws java.lang.InterruptedException
     */
    public static void main(String[] args) throws InterruptedException {
        Scanner input = new Scanner(System.in);
        String a1 = "1";
        String a2 = "2";
        String a3 = "3";
        String a4 = "4";
        String a5 = "5";
        String a6 = "6";
        String a7 = "7";
        String a8 = "8";
        String a9 = "9";
        int inO;
        int inX = 0;
        boolean winner = false;
        PrintBoard(a1,a2,a3,a4,a5,a6,a7,a8,a9);
        System.out.printf("How to play - wait for your turn and when it comes write the number of the field that you want to draw in (from 1 to 9)\n");
        System.out.printf("Player O's turn: ");
        inO = input.nextInt();
        while (true) {
            switch (inO) {
                case 1:
                    if (a1 == "1") {
                        a1 = "O";
                    }
                    break;
                case 2:
                    if (a2 == "2") {
                    a2 = "O";
                    }
                    break;
                case 3:
                    if (a3 == "3") {
                    a3 = "O";
                    }
                    break;
                case 4:
                    if (a4 == "4") {
                    a4 = "O";
                    }
                    break;
                case 5:
                    if (a5 == "5") {
                    a5 = "O";
                    }
                    break;
                case 6:
                    if (a6 == "6") {
                    a6 = "O";
                    }
                    break;
                case 7:
                    if (a7 == "7") {
                    a7 = "O";
                    }
                    break;
                case 8:
                    if (a8 == "8") {
                    a8 = "O";                        
                    }
                    break;
                case 9:
                    if (a9 == "9") {
                    a9 = "O";
                    }
                    break;
                default:
                    System.out.printf("An error occured. Please accept it politely and restart the game.");
                    break;
            }
            System.out.printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
            if (null != Winners(a1,a2,a3,a4,a5,a6,a7,a8,a9))switch (Winners(a1,a2,a3,a4,a5,a6,a7,a8,a9)) {
                case "NONE":
                    if (a1 != "1" && a2 != "2" && a3 != "3" && a4 != "4" && a5 != "5" && a6 != "6" && a7 != "7" && a8 != "8" && a9 != "9") {
                        winner = true;
                        System.out.println("DRAW!");
                        Thread.sleep(3000);
                        break;
                    } else {
                    PrintBoard(a1,a2,a3,a4,a5,a6,a7,a8,a9);
                    System.out.printf("Player X's turn: ");
                    inX = input.nextInt();
                    break;
                    }
                case "X":
                    winner = true;
                    System.out.println("X HAS WON!!!");
                    Thread.sleep(3000);
                    break;
                case "O":
                    winner = true;
                    System.out.printf("O HAS WON!!!");
                    Thread.sleep(3000);
                    break;
                default:
                    break;
            }
            if (winner) {
                break;
            }
            switch (inX) {
                case 1:
                    if (a1 == "1") {
                    a1 = "X";
                    }
                    break;
                case 2:
                    if (a2 == "2") {
                    a2 = "X";
                    }
                    break;
                case 3:
                    if (a3 == "3") {
                    a3 = "X";
                    }
                    break;
                case 4:
                    if (a4 == "4") {
                    a4 = "X";
                    }
                    break;
                case 5:
                    if (a5 == "5") {
                    a5 = "X";
                    }
                    break;
                case 6:
                    if (a6 == "6") {
                    a6 = "X";
                    }
                    break;
                case 7:
                    if (a7 == "7") {
                    a7 = "X";
                    }
                    break;
                case 8:
                    if (a8 == "8") {
                    a8 = "X";
                    }
                    break;
                case 9:
                    if (a9 == "9") {
                    a9 = "X";
                    }
                    break;
                default:
                    System.out.printf("An error occured. Please accept it politely and restart the game.");
                    break;
            }
            System.out.printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
            if (null != Winners(a1,a2,a3,a4,a5,a6,a7,a8,a9))switch (Winners(a1,a2,a3,a4,a5,a6,a7,a8,a9)) {
                case "NONE":
                    if (a1 != "1" && a2 != "2" && a3 != "3" && a4 != "4" && a5 != "5" && a6 != "6" && a7 != "7" && a8 != "8" && a9 != "9") {
                        winner = true;
                        System.out.println("DRAW!");
                        Thread.sleep(3000);
                        break;
                    } else {
                    PrintBoard(a1,a2,a3,a4,a5,a6,a7,a8,a9);
                    System.out.printf("Player O's turn: ");
                    inO = input.nextInt();
                    break;
                    }
                case "X":
                    winner = true;
                    System.out.println("X HAS WON!!!");
                    Thread.sleep(3000);
                    break;
                case "O":
                    winner = true;
                    System.out.println("O HAS WON!!!");
                    Thread.sleep(3000);
                    break;
                default:
                    break;
            }
            if (winner) {
                break;
            }
        }    
    }
    
    public static void PrintBoard(String f1, String f2, String f3, String f4, String f5, String f6, String f7, String f8, String f9) {  
        System.out.printf("   %s | %s | %s \n",f1,f2,f3);
        System.out.printf("  ----------- \n");
        System.out.printf("   %s | %s | %s \n",f4,f5,f6);
        System.out.printf("  ----------- \n");
        System.out.printf("   %s | %s | %s \n",f7,f8,f9);
        System.out.printf(" \n");
    }
    
    public static String Winners(String f1, String f2, String f3, String f4, String f5, String f6, String f7, String f8, String f9) {
        if (f1 == f2 && f2 == f3 && f3 == "O") {
            return "O";
        } else if (f4 == f5 && f5 == f6 && f6 == "O") {
            return "O";
        } else if (f7 == f8 && f8 == f9 && f9 == "O") {
            return "O";
        } else if (f1 == f4 && f4 == f7 && f7 == "O") {
            return "O";
        } else if (f2 == f5 && f5 == f8 && f8 == "O") {
            return "O";
        } else if (f3 == f6 && f6 == f9 && f9 == "O") {
            return "O";
        } else if (f1 == f5 && f5 == f9 && f9 == "O") {
            return "O";
        } else if (f3 == f5 && f5 == f7 && f7 == "O") {
            return "O";
        } else if (f1 == f2 && f2 == f3 && f3 == "X") {
            return "X";
        } else if (f4 == f5 && f5 == f6 && f6 == "X") {
            return "X";
        } else if (f7 == f8 && f8 == f9 && f9 == "X") {
            return "X";
        } else if (f1 == f4 && f4 == f7 && f7 == "X") {
            return "X";
        } else if (f2 == f5 && f5 == f8 && f8 == "X") {
            return "X";
        } else if (f3 == f6 && f6 == f9 && f9 == "X") {
            return "X";
        } else if (f1 == f5 && f5 == f9 && f9 == "X") {
            return "X";
        } else if (f3 == f5 && f5 == f7 && f7 == "X") {
            return "X";
        } else {
            return "NONE";
        }
    }
}

There are sooo many problems with this...

By umnikos, 2017-12-12 17:27:24
#411 C# +11
if (date.Training != null)
            {
                var training = date.Training;
                var status = new TrainingStatus();
                var refresher = new Training();

                if (training.Trainings != null)
                    refresher = training.Trainings;

                bool hasTakenRefresher = false;
                status.Value = date.Date.AddDays(
                    TrainingHelper.CalculateValidityDays(training.Validity ?? 0, training.ValidityType ?? 0));

                status.Name = training.TrainingName;
                status.ID = training.TrainingID;
                status.Category = training.CategoryTraining != null ? training.CategoryTraining.Name : "Other";
                status.IsTrained = _validityUtilsService.IsValid(training, date.Date);

                if (status.IsTrained)
                {
                    status.IsExpiring = _validityUtilsService.IsExpiring(training, date.Date,
                                            TrainingHelper.CalculateValidityDays(
                                                training.ExpirationWarningValidity ?? 0,
                                                training.ExpirationWarningValidityType ?? 0));
                }

                if (refresher.ID != 0)
                {
                    hasTakenRefresher = employee.Dates
                        .Count(x => x.Training != null
                            && x.TrainingID == refresher.ID) > 1;

                    if (hasTakenRefresher && (status.IsExpiring || !status.IsTrained))
                    {
                        status.IsExpiring = false;
                        var trainingWithNewValidity = new Training();

                        status.Value = date.Date.AddDays(
                            TrainingHelper.CalculateValidityDays(training.ValidityRefresher ?? 0,
                                training.ValidityRefresherType ?? 0));

                        trainingWithNewValidity.Validity = training.ValidityRefresher;
                        trainingWithNewValidity.ValidityType = training.ValidityRefresherType;
                        status.IsTrained = _validityUtilsService.IsValid(trainingWithNewValidity, date.Date);

                        if (status.IsTrained)
                        {
                            status.IsExpiring = _validityUtilsService.IsExpiring(trainingWithNewValidity, date.Date,
                                TrainingHelper.CalculateValidityDays(
                                    refresher.ExpirationWarningValidity ?? 0,
                                    refresher.ExpirationWarningValidityType ?? 0));
                        }
                    }
                }

                if (status.IsTrained && !status.IsExpiring)
                    status.Status = TrainingStatuses.Trained;
                else if (status.IsTrained && status.IsExpiring)
                    status.Status = TrainingStatuses.Expiring;
                else if (!status.IsTrained && !status.IsExpiring)
                    status.Status = TrainingStatuses.Expired;

                status.EmpID = employee.ID;

                return status;
            }

test

By NN, 2019-10-29 12:59:14
class ExampleClass {
    public void DoSomething()
    {
       if (this != null) {
           //omitted
       }
    }
    
    public void DoSomething2()
    {
       if (this != null) {
           //omitted
       }
    }
    
}

Explanation: This can't be null in C# virtual instance methods - I was so confused by the widespread use of this check that I asked this question at SO: https://stackoverflow.com/questions/31747718/can-this-be-null-in-c-sharp-virtual-methods-what-happens-with-the-rest-of-ins

By Michail Michailidis, 2017-12-13 14:54:58
    if (!recruiters
                    .stream().map(UserData::getUserName).collect(Collectors.toList())
                    .contains(recruiter.getUserData().getUserName())) {
    }
By somebody11, 2022-03-11 09:56:35
<h1 className="sidebar-text">
	<h1 className="sidebar-text">My Applauses</h1>
</h1>

How do you even miss this... the Console will literally complain in red to you...

By Mr Verster, 2022-04-07 16:53:40