public static int findSplitVariable(LinkedList<ByteDataRow> matrix) {
		LinkedList<ByteDataRow> list = new LinkedList<ByteDataRow>();
		int maxNoOfZeros = 0;
		int maxNoOfOnes = 0;
		int varId = -1;
		int[] NoOfOnesInColumn = new int[matrix.get(0).getInVars().length];


		for (ByteDataRow bdr : matrix) {
			int tmpNoOfZeros = bdr.getNumberOfZeros();
			if (maxNoOfZeros < tmpNoOfZeros) {
				list.clear();
				list.add(bdr.clone());
				maxNoOfZeros = tmpNoOfZeros;
			} else if (maxNoOfZeros == tmpNoOfZeros) {
				list.add(bdr.clone());
			}
		}

		for (ByteDataRow bdr : list) {
			byte[] vars = bdr.getInVars();
			for (int i = 0; i < vars.length; i++) {
				NoOfOnesInColumn[i] = NoOfOnesInColumn[i]
						+ Byte.compare(vars[i], Byte.parseByte("0"));
				if (NoOfOnesInColumn[i] > maxNoOfOnes) {
					maxNoOfOnes = NoOfOnesInColumn[i];
					varId = i;
				}
			}
		}

		return varId;
	}

	public static int findSplitVariable(LinkedList<ByteDataRow> matrix, int varIdx) {
		LinkedList<ByteDataRow> list = new LinkedList<ByteDataRow>();
		int maxNoOfZeros = 0;
		int maxNoOfOnes = 0;
		int varId = -1;
		int[] NoOfOnesInColumn = new int[matrix.get(0).getInVars().length];

		// Wybierz kostkÍ z najwiÍkszπ liczbπ zer.
		for (ByteDataRow bdr : matrix) {
			int tmpNoOfZeros = bdr.getNumberOfZeros();
			if (maxNoOfZeros < tmpNoOfZeros) {
				list.clear();
				list.add(bdr.clone());
				maxNoOfZeros = tmpNoOfZeros;
			} else if (maxNoOfZeros == tmpNoOfZeros) {
				list.add(bdr.clone());
			}
		}

		for (ByteDataRow bdr : list) {
			byte[] vars = bdr.getInVars();
			for (int i = 0; i < vars.length; i++) {
				NoOfOnesInColumn[i] = NoOfOnesInColumn[i]
						+ Byte.compare(vars[i], Byte.parseByte("0"));
				if (NoOfOnesInColumn[i] > maxNoOfOnes) {
					maxNoOfOnes = NoOfOnesInColumn[i];
					varId = i;
				}
			}
		}

		return varId;
	}

There are two methods findSplitVariable. Second one takes extra parameter (varIdx) that is not used anywhere.

By Paul, 2018-02-17 14:47:37
#411 C# +13
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
local Plr = game.Players.LocalPlayer

for i,v in pairs(game.ReplicatedStorage.DataStorage[Plr.Name].Data["Slot1"].AccessoriesList:GetChildren()) do
v.Value = "Unlocked"
end
for i,v in pairs(game.ReplicatedStorage.DataStorage[Plr.Name].Data["Slot1"].StanceList:GetChildren()) do
v.Value = "Unlocked"
end
for i,v in pairs(game.ReplicatedStorage.DataStorage[Plr.Name].Data["Slot1"].RunningList:GetChildren()) do
v.Value = "Unlocked"
end
for i,v in pairs(game.ReplicatedStorage.DataStorage[Plr.Name].Data["Slot1"].FlyingList:GetChildren()) do
v.Value = "Unlocked"
end
for i,v in pairs(game.ReplicatedStorage.DataStorage[Plr.Name].Data["Slot1"].FightingStyles:GetChildren()) do
v.Value = "Unlocked"
end
for i,v in pairs(game.ReplicatedStorage.DataStorage[Plr.Name].Data["Slot1"].MoveList:GetChildren()) do
v.Value = "Unlocked"
end
for i,v in pairs(game.ReplicatedStorage.DataStorage[Plr.Name].Data["Slot1"].ClothingList:GetChildren()) do
v.Value = "Unlocked"
end

Bad unlock script for Roblox

By JayRain, 2020-03-14 03:01:24
case (RSel)
      4'b0000:begin
                R1e = 1'b0;   R2e = 1'b0;  R3e = 1'b0;  R4e = 1'b0;  
              end
      4'b0001:begin
                R1e = 1'b0;   R2e = 1'b0;  R3e = 1'b0;  R4e = 1'b1; 
              end
      4'b0010:begin
                R1e = 1'b0;   R2e = 1'b0;  R3e = 1'b1;  R4e = 1'b0; 
              end
      4'b0011:begin
                R1e = 1'b0;   R2e = 1'b0;  R3e = 1'b1;  R4e = 1'b1; 
              end
      4'b0100:begin
                R1e = 1'b0;   R2e = 1'b1;  R3e = 1'b0;  R4e = 1'b0;
              end
      4'b0101:begin
                R1e = 1'b0;   R2e = 1'b1;  R3e = 1'b0;  R4e = 1'b1;  
              end
      4'b0110:begin
                R1e = 1'b0;   R2e = 1'b1;  R3e = 1'b1;  R4e = 1'b0; 
              end
      4'b0111:begin
                R1e = 1'b0;   R2e = 1'b1;  R3e = 1'b1;  R4e = 1'b1;  
              end
      4'b1000:begin
                R1e = 1'b1;   R2e = 1'b0;  R3e = 1'b0;  R4e = 1'b0;  
              end
      4'b1001:begin
                R1e = 1'b1;   R2e = 1'b0;  R3e = 1'b0;  R4e = 1'b1;
              end
      4'b1010:begin
                R1e = 1'b1;   R2e = 1'b0;  R3e = 1'b1;  R4e = 1'b0; 
              end
      4'b1011:begin
                R1e = 1'b1;   R2e = 1'b0;  R3e = 1'b1;  R4e = 1'b1; 
              end
      4'b1100:begin
                R1e = 1'b1;   R2e = 1'b1;  R3e = 1'b0;  R4e = 1'b0; 
              end
      4'b1101:begin
                R1e = 1'b1;   R2e = 1'b1;  R3e = 1'b0;  R4e = 1'b1; 
              end
      4'b1110:begin
                R1e = 1'b1;   R2e = 1'b1;  R3e = 1'b1;  R4e = 1'b0; 
              end
      4'b1111:begin
                R1e = 1'b1;   R2e = 1'b1;  R3e = 1'b1;  R4e = 1'b1;
              end
     
    endcase
    
    case (TSel)
          4'b0000:begin
                    T1e = 1'b0;  T2e = 1'b0; T3e = 1'b0;  T4e = 1'b0;
                  end
          4'b0001:begin
                    T1e = 1'b0;  T2e = 1'b0; T3e = 1'b0;  T4e = 1'b1;
                  end
          4'b0010:begin
                    T1e = 1'b0;  T2e = 1'b0; T3e = 1'b1;  T4e = 1'b0;
                  end
          4'b0011:begin
                    T1e = 1'b0;  T2e = 1'b0; T3e = 1'b1;  T4e = 1'b1;
                  end
          4'b0100:begin
                    T1e = 1'b0;  T2e = 1'b1; T3e = 1'b0;  T4e = 1'b0;
                  end
          4'b0101:begin
                    T1e = 1'b0;  T2e = 1'b1; T3e = 1'b0;  T4e = 1'b1;
                  end
          4'b0110:begin
                    T1e = 1'b0;  T2e = 1'b1; T3e = 1'b1;  T4e = 1'b0;
                  end
          4'b0111:begin
                    T1e = 1'b0;  T2e = 1'b1; T3e = 1'b1;  T4e = 1'b1;
                  end
          4'b1000:begin
                    T1e = 1'b1;  T2e = 1'b0; T3e = 1'b0;  T4e = 1'b0;
                  end
          4'b1001:begin
                    T1e = 1'b1;  T2e = 1'b0; T3e = 1'b0;  T4e = 1'b1;
                  end
          4'b1010:begin
                    T1e = 1'b1;  T2e = 1'b0; T3e = 1'b1;  T4e = 1'b0;
                  end
          4'b1011:begin
                    T1e = 1'b1;  T2e = 1'b0; T3e = 1'b1;  T4e = 1'b1;
                  end
          4'b1100:begin
                    T1e = 1'b1;  T2e = 1'b1; T3e = 1'b0;  T4e = 1'b0;
                  end
          4'b1101:begin
                    T1e = 1'b1;  T2e = 1'b1; T3e = 1'b0;  T4e = 1'b1; 
                  end
          4'b1110:begin
                    T1e = 1'b1;  T2e = 1'b1; T3e = 1'b1;  T4e = 1'b0;
                  end
          4'b1111:begin
                    T1e = 1'b1;  T2e = 1'b1; T3e = 1'b1;  T4e = 1'b1;
                  end
        endcase

Just write assign {R1e, R2e, R3e, R4e} = Rsel assign {T1e, T2e, T3e, T4e} = Tsel

By dawidogg, 2023-04-01 16:40:34
public override List<Value> Values
{
    get 
    {
        if (_values == null && shouldLoadLazily)
        {
            _values = _lazerLoader.LoadValues<Value>()
        }
        
        return _values;
    }
    set 
    {
        throw new InvalidOperationException("Values are actually readonly- please set in constructor")
    }
}

How to create immutable fields in c#

By Unknown, 2017-12-12 14:42:38
FOR x IN ( SELECT COUNT(*) cnt
            FROM DUAL
           WHERE EXISTS ( SELECT NULL FROM task
                           WHERE task.task_type_id = lib.task_type_check()
                             AND task.task_status_id = lib.task_status_open()
                             AND task.unit_id = in_unit_id
                             AND task.station_id = v_station_id
                        )
         )
LOOP
  IF( x.cnt = 1 ) THEN
    v_task_exist := TRUE;
  ELSE
    v_task_exist := FALSE;
  END IF;
END LOOP;
By Anonymous, 2019-08-01 15:25:36
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
<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
function sortUsers(a, b) {
  return a.last_name.localeCompare(b.last_name) * -1;
}
By Anonymous, 2018-03-06 22:44:30
#53 C++ +11
int chromosome::getScore()
{
    return this->getScore();
}
By Anonymous, 2015-11-05 15:41:39
#!/bin/bash

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )";

export KUBECONFIG="${DIR}/my_secret_stuff/kube.conf";

Example on how to get location of the script right

By Piotr, 2020-05-11 12:45:57
try {
    channel.send(eventMessage);
} catch (MessageHandlingException ex) {
    channel.send(eventMessage);
}
By Anonymous, 2019-03-29 08:53:50
if (isLink($content[$i][$j])) {

					if (isImageLink($content[$i][$j])) {

						$image_src = create_image($content[$i][$j], "img");

						$cell = <<<HTML
							<td>
								<img {$image_src} {$img_style}></td></img>
							</td>
HTML;
					} else if (isNestedLink($content[$i][$j])) {

						$links = explode("!", $content[$i][$j]);

						$cell = <<<HTML
							<td><a style="color: {$cards_button_bg_color};" href="{$links[1]}" $open_links_in >{$links[0]}</a></td>
HTML;
					} else {
						
						//Checking if it's a link or a button

							if ($j == $table_button_column) {
														
							//Button HTML
								$table_button_text = explode("-", $content[0][$j])[0];

								$cell = <<<HTML
									<td><a {$open_links_in} href="{$content[$i][$j]}" style="background-color: {$cards_button_bg_color}; color: {$cards_button_text_color};" class="btn">{$table_button_text}</a></td>
HTML;
							} else {
							
							// Link HTML			
								$cell = <<<HTML
									<td><a style="color: {$cards_button_bg_color};" href="{$content[$i][$j]}" $open_links_in >{$content[0][$j]}</a></td>
HTML;
							}
					}
By PHPhillip, 2020-06-09 23:28:49
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
SELECT 
	tblPosts.idPost,
	tblPosts.postTitle, 
	tblPosts.postCode, 
	tblPostsStatus.scsTitle, 
	concat(code, '<br>', pTitle) AS pTitle, (CASE WHEN postResult = 1 THEN 'yes' ELSE 'no' END) AS postResult , 
	concat(date_format(postStartedDate, '%d.%m.%Y'), '<br>', date_format(postStartedDate, '%H:%i')) AS dateStart, 
	date_format(tblPosts.updated_at, '%d.%m.%Y %H:%i') AS dtUpdated, tblPerson.mobile, tblPerson.mail, tblPerson.isoLang, tblPostsReason.surname, 
	concat(coalesce(clientFName, ''), ' ', coalesce(clientName, '')) AS client, 
	concat(coalesce(concat(tblGender.gender, ' '), ''), coalesce(eFName, ''), ' ', coalesce(eName, '')) AS pers, 
	(CASE WHEN tblPosts.idCollab is NULLTHEN '' ELSE concat(coalesce(tblCol.cFName, ''), ' ', coalesce(tblCol.cName, '')) END) AS starter, 
	concat("<img src='img/status_", tblPosts.status, ".png' height='12px' border='1' />") AS displaystat,
	concat("<a href='index.php?arg=posts&id=", tblPosts.idPost, "&idAccess=", coalesce(tblAccess.idAccess, ''), "' title='Prepare Interface'><img src='../DG/styles/flat/images/edit.gif' style='height:14px; width:32px;' border='0'></a>") AS elink, 
	concat("<a href='email.php?frame=1&idPost=", tblPosts.idPost, "&source=PERS&idSrc=", tblPerson.idPerson, "&lang=", tblPerson.isoLang, "&from=", ";;SENDER", "&to=", tblPerson.persMail, "&idTperslate=CLI_diff_joindre_can,PERS_demande_contact,PERS_demande_CV&title=", replace(replace(replace(coalesce(pTitle, ''), "'", ";;APO"), "(", ";;PLT"), ")", ";;PGT"), "' title='", concat(coalesce(persName, ''), ' ', coalesce(persFname, '')), "' class='fancybox fancybox.iframe'><img src='img/email.png' height='12px' border='1' title='Messages' ></a>") AS mailink, 
	concat("<a href='post_email.php?frame=1&op=resend&idPosts=", tblPosts.idPost, "&idPerson=", tblPerson.idPerson, "&lang=", tblPerson.isoLang, "&idAccess=", coalesce(tblAccess.idAccess, ''), "&title=", replace(replace(replace(coalesce(pTitle, ''), "'", ";;APO"), "(", ";;PLT"), ")", ";;PGT"), "' title='", concat(coalesce(perName, ''), ' ', coalesce(perFName, '')), "' class='fancybox fancybox.iframe'><img src='img/emailNew.png' height='12px' border=1 title='New Posts' ></a>") AS newlink, 
	concat("<a href='comment.php?idPosts=", tblPosts.idPost, "&idPostsElem=-1&idClient=", tblPosts.idClient, "&frame=1&title=", replace(replace(replace(pTitle, "'", ";;APO"), "(", ";;PLT"), ")", ";;PGT"), "' title='", concat(coalesce(persName, ''), ' ', coalesce(persFName, '')), "' class='fancyboxstepreload fancybox.iframe'><div id='divBadgeComm", tblPosts.idPost, "' class='divBadge'>", (select count(*) from tblComment where idPosts=tblPosts.idPost and idElem is NULLand visibleClient=1), "</div><img src='img/comment.png' height='12px' border='1' title='Comments' /></a>") AS comments, 
	concat("<a href='docs.php?frame=1&idPosts=", tblPosts.idPost, "&title=", replace(replace(replace(pTitle, "'", ";;APO"), "(", ";;PLT"), ")", ";;PGT"), "' title='", concat(coalesce(persName, ''), ' ', coalesce(persFname, '')), "' class='fancyboxstep fancybox.iframe'><div id='divBadgeDocument", tblPosts.idPost, "' class='divBadge'>", (select count(*) from tblDocs where idPosts=tblPosts.idPost and docFileName <> '' and status=1), "</div><img src='img/dir.png' height='12px' border='1' title='Docs' /></a>") AS documents, 
FROM tblPosts
-- lots of LEFT JOIN
WHERE 1;

Maybe he didn't know how to do it in PHP ?

By Not a real programmer, 2018-07-10 11:03:17