/**
* 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);
}
$partnerChargesRegular = $row['charges'];
$partnerChargesIrregular = $row['charges'];
if (!isset($partnerChargesIrregular) || $partnerChargesIrregular == "") {
$partnerChargesIrregular = $partnerChargesRegular;
}
Look. We take A from X and B from X. Then, you make a check, and if it is true you assing A to B. BUT A AND B ARE TAKEN FROM THE SAME X PLACE!!! HOW CAN THEY DIFFER?!?!!!?!?!?!?!!
$options.splice($options.indexOf('option7'), 1);
$options.splice($options.indexOf('option5'), 1);
$options.splice($options.indexOf('option4'), 1);
$options.splice($options.indexOf('option3'), 1);
$options.splice($options.indexOf('option2'), 1);
$options.splice($options.indexOf('option1'), 1);
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.
base.transform.name = this.bodyName;
this.radius = this.diameterKm * 500.0;
this.mass = Math.Pow(this.radius, 2.0) * this.surfaceGravity;
this.cameraSwitchHeightM = this.cameraSwitchHeightKm * 1000.0;
if (this.atmosphereData.shadowIntensity == 0f)
{
this.atmosphereData.shadowIntensity = 1.65f;
}
this.atmosphereData.atmosphereHeightM = this.atmosphereData.atmosphereHeightKm * 1000.0;
if (this.terrainData.terrainMaterial != null)
{
this.terrainData.terrainMaterial.color = this.terrainData.terrainColor;
}
this.terrainData.maxTerrainHeight = this.GetMaxTerrainHeight();
this.terrainData.unitToAngle = 360.0 / ((this.radius + this.terrainData.maxTerrainHeight) * 2.0 * 3.1415926535897931);
for (int i = 0; i < this.terrainData.detailLevels.Length; i++)
{
this.terrainData.detailLevels[i].chunckSize = (double)this.terrainData.baseChunckSize / Math.Pow(2.0, (double)i);
this.terrainData.detailLevels[i].angularSize = (float)this.terrainData.detailLevels[i].chunckSize / (float)this.terrainData.heightMaps[0].heightMap.HeightDataArray.Length * 360f;
}
this.terrainData.detailLevels[0].loadDistance = double.PositiveInfinity;
if (this.type == CelestialBodyData.Type.Star)
{
this.parentBody = null;
this.orbitData.SOIMultiplier = double.PositiveInfinity;
}
if (this.parentBody != null && (this.type == this.parentBody.type || (this.type == CelestialBodyData.Type.Planet && this.parentBody.type == CelestialBodyData.Type.Moon)))
{
this.parentBody = null;
}
if (this.parentBody != null)
{
this.orbitData._period = Kepler.GetPeriod(0.0, this.orbitData.orbitHeightM, this.parentBody.mass);
this.orbitData.periodString = Ref.GetTimeString(this.orbitData._period);
this.orbitData._meanMotion = -6.2831853071795862 / this.orbitData._period;
this.orbitData.orbitalVelocity = this.orbitData.orbitHeightM * this.orbitData._meanMotion;
this.orbitData.SOI = this.orbitData.orbitHeightM * Math.Pow(this.mass / this.parentBody.mass, 0.4) * this.orbitData.SOIMultiplier;
if (!this.ParentHasThisBodyAsSatellite())
{
List<CelestialBodyData> list = new List<CelestialBodyData>(this.parentBody.satellites);
list.Add(this);
this.parentBody.satellites = list.ToArray();
this.parentBody.ValidateSatellites();
}
$d = explode(".",$request->get("due_date",".."));
foreach ($d as $key => $val) $d[$key]=(int)$val;
if (
!is_numeric($d[0]) || $d[0]<1 ||$d[0]>31 ||
!is_numeric($d[1]) || $d[1]<1 ||$d[1]>12 ||
!is_numeric($d[2]) || $d[2]<2005 ||$d[2]>2100 ) {
$error["due_date"] = "Missing date.";
}
I think this was the last piece of code the developer wrote .... :D
<?php
$k =1;
for($v = 0; $v < $nt; $v++) {
$bgClass= 'blueBg';
if($k > 1 && $k%2 == 0){
$bgClass= 'whiteBg';
}
?>
<tr class="row_tr <?php echo $bgClass;?>">
<td class="row_td td_column_0"> </td>
<td class="row_td column_1"><?php echo $rows[$v]['nothing'];?></td>
...
<td class="row_td td_column_0"> </td>
</tr>
<?php
$k++;
}
?>
var filter = options.dataSource.filter();
if(e.filter) {
filter = filter && filter.filters.length ? filter.filters.concat(e.filter.filter) : e.filter.filters;
}
else {
filter = filter && filter.filters.length ? filter.filters.linqRemove({ field: e.field }) : [];
}
options.dataSource.filter(filter);
...
if (alignEntrySize & 1)
alignEntrySize++;
if (alignEntrySize & 2)
alignEntrySize += 2;
...
private static function derivePrice(...)
{
$price = self::derivePriceUnchecked($vars);
if (isset($price)) {
// CODE HERE
}
if (isset($price)) {
// CODE HERE
}
if (isset($price)) {
// CODE HERE
}
if (isset($price)) {
// CODE HERE
}
if (isset($price)) {
// CODE HERE
}
if (isset($price)) {
// CODE HERE
}
if (isset($price)) {
// CODE HERE
}
if (isset($price)) {
// CODE HERE
}
return $price;
}
$guard = ($vars->a_payment) + (0) * $price;
if ($bless >= $guard) {
$amount = $bless;
}
Why not to write just 1 line?! $amount = max($bless, $vars->a_payment);
for x,x1 in enumerate(hack):
if hack[x] in letters:
exception +=1
ffs why
contracts = Contract.objects.filter(staff=staff).filter(active=True)
if contracts.__len__() > 0:
ind = contracts.__len__() - 1
dic[‘active_contract_id’] = contracts[ind].id
else:
dic[‘active_contract_id’] = contracts[0].id
Get last object of queryset in django
if (isset(self::$proposals[$view])) {
$best_proposals = [];
$all_sources = [];
foreach (self::$proposals[$view] as $proposal_source => $proposal) {
if (!isset($this->backend_branch) || substr($this->backend_branch, 0, 11) != "adjust-for:" || substr($this->backend_branch, 11) == $proposal_source) {
if ($proposal['orig_base'] == $curr_base || $relax_checking) {
$age = time() - $proposal['updated_at'];
if ($age < self::MAX_AGE) {
foreach ($proposal['proposals'] as $proposal_label => $proposal_price) {
if (!in_array($proposal_label, [self::SK_LABEL_AVIASALES, self::SK_LABEL_SKYSCANNER, self::SK_LABEL_YANDEX, self::SK_LABEL_MOMONDO])) {
$proposal_key = $proposal_label;
if (!isset($best_proposals[$proposal_key]) || $best_proposals[$proposal_key]['price'] > $proposal_price) {
$best_proposals[$proposal_key] = [
'price' => $proposal_price,
'name' => $proposal_price . "@" . implode("~", array_map(function ($part) {
return preg_replace('/[~|=#@ ]/', '_', $part);
}, [
'label' => $proposal_label,
'source' => $proposal_source,
])),
'age' => $age,
];
$all_sources[$proposal_source] = null;
}
}
}
}
}
}
}