int number = -1;
//todo: refactor this horse shit.
for (String res: results) {
if(number == -1){
if(res.toLowerCase().contains("ten") || res.contains("10") || res.contains("10") || res.contains("十") || res.contains("십")){
number = 10;
}
else if(res.toLowerCase().contains("nine") || res.contains("9") || res.contains("9") || res.contains("九") || res.contains("구")){
number = 9;
}
else if(res.toLowerCase().contains("eight") || res.contains("8") || res.contains("8") || res.contains("八") || res.contains("팔")){
number = 8;
}
else if(res.toLowerCase().contains("seven") || res.contains("7") || res.contains("7") || res.contains("七") || res.contains("칠")){
number = 7;
}
else if(res.toLowerCase().contains("six") || res.contains("6") || res.contains("6") || res.contains("六") || res.contains("육")){
number = 6;
}
else if(res.toLowerCase().contains("five") || res.contains("5") || res.contains("5") || res.contains("五") || res.contains("오")){
number = 5;
}
else if(res.toLowerCase().contains("four") || res.contains("4") || res.contains("4") || res.contains("四") || res.contains("사")){
number = 4;
}
else if(res.toLowerCase().contains("three") || res.contains("3") || res.contains("3") || res.contains("三") || res.contains("삼")){
number = 3;
}
else if(res.toLowerCase().contains("two") || res.contains("2") || res.contains("2") || res.contains("二") || res.contains("이")){
number = 2;
}
else if(res.toLowerCase().contains("one") || res.contains("1") || res.contains("1") || res.contains("一") || res.contains("일")){
number = 1;
}
}
}
refactor this horse shit.
function downScaleCanvas(a, b) {
var c = Math.ceil,
d = Math.floor;
if (!(1 > b) || !(0 < b)) throw "scale must be a positive number <1 ";
var e = b * b,
f = a.width,
g = a.height,
h = d(f * b),
i = d(g * b),
j = 0,
k = 0,
l = 0,
m = 0,
n = 0,
o = 0,
p = 0,
q = 0,
r = 0,
s = 0,
t = 0,
u = 0,
v = 0,
x = 0,
y = 0,
z = !1,
A = !1,
B = a.getContext("2d").getImageData(0, 0, f, g).data,
C = new Float32Array(3 * h * i),
D = 0,
E = 0,
F = 0;
for (k = 0; k < g; k++)
for (n = k * b, r = 0 | n, o = 3 * r * h, A = r != (0 | n + b), A && (x = r + 1 - n, y = n + b - r - 1), j = 0; j < f; j++, l += 4) m = j * b, q = 0 | m, p = o + 3 * q, z = q != (0 | m + b), z && (u = q + 1 - m, v = m + b - q - 1), D = B[l], E = B[l + 1], F = B[l + 2], z || A ? z && !A ? (s = u * b, C[p] += D * s, C[p + 1] += E * s, C[p + 2] += F * s, t = v * b, C[p + 3] += D * t, C[p + 4] += E * t, C[p + 5] += F * t) : A && !z ? (s = x * b, C[p] += D * s, C[p + 1] += E * s, C[p + 2] += F * s, t = y * b, C[p + 3 * h] += D * t, C[p + 3 * h + 1] += E * t, C[p + 3 * h + 2] += F * t) : (s = u * x, C[p] += D * s, C[p + 1] += E * s, C[p + 2] += F * s, t = v * x, C[p + 3] += D * t, C[p + 4] += E * t, C[p + 5] += F * t, t = u * y, C[p + 3 * h] += D * t, C[p + 3 * h + 1] += E * t, C[p + 3 * h + 2] += F * t, t = v * y, C[p + 3 * h + 3] += D * t, C[p + 3 * h + 4] += E * t, C[p + 3 * h + 5] += F * t) : (C[p] += D * e, C[p + 1] += E * e, C[p + 2] += F * e);
var G = document.createElement("canvas");
G.width = h, G.height = i;
var H = G.getContext("2d"),
I = H.getImageData(0, 0, h, i),
J = I.data,
K = 0;
for (l = 0, p = 0; K < h * i; l += 3, p += 4, K++) J[p] = c(C[l]), J[p + 1] = c(C[l + 1]), J[p + 2] = c(C[l + 2]), J[p + 3] = 255;
return H.putImageData(I, 0, 0), G
}
dohhhhhh !!
boolean darkModeSelected = (!darkModeSelected ? true : false);
i++;
i++;
i++;
i++;
Console.WriteLine(i);
He doesn't know what is " i+=4 " :||||
int minimum(int a, int b, int c){
int mini =a*b*c;
int iterator=0;
int test[3];
test[0]=a;
test[1]=b;
test[2]=c;
for (iterator=0;iterator<3;iterator++){
if (test[iterator]<mini){
mini=test[iterator];
}
}
return mini;
}
I hope that your 3 numbers aren't larger than 1290!
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();
}
UIButton * btn = [UIButton new];
[btn addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
//May god have mercy of me
[[btn titleLabel] setFont:[UIFont systemFontOfSize:14 weight:UIFontWeightMedium]];
[btn setTitle:[NSString stringWithFormat:@" %@ ", btnTxt] forState:UIControlStateNormal];
[btn sizeToFit];
[btn setTitle:btnTxt forState:UIControlStateNormal];
Why keep playing with label padding or insets when you can add spaces?
if (logger.isDebugEnabled()) {
logger.debug("process (FollettPojo) - start");
}
String dnum = StringUtil.toCapitalizedString(pojo.getDnum().toString());
pojo.setDnum(new String(dnum));
if (logger.isDebugEnabled()) {
logger.debug("process (FollettPojo) - middle ");
}
String rawI = StringUtil.toCapitalizedString(pojo.getRawInput().trim().toString());
pojo.setRawInput(new String(rawI));
if (logger.isDebugEnabled()) {
logger.debug("process (FollettPojo) - end ");
}
/* And you may ask what is this toCapitalizedString? Well here you go a separate class to boot */
public static String toCapitalizedString(String string){
StringBuilder strb = new StringBuilder();
if(string != null && string.trim().length() > 0
&& Character.isLetter(string.charAt(0))
&& Character.isLowerCase(string.charAt(0))){
strb.append(string.substring(0,1).toUpperCase()).append(string.substring(1));
return strb.toString();
}
return string;
}
SpringBatch this is the processor for each record...dnum example D00000000
self.isOptionsVisible = ko.computed(function() {
if((self.type() == 'select') || (self.type() == 'multiselect') || (self.type() == 'radio') || (self.type() == 'checkbox') || (self.type() == 'upload')) {
return true;
}
return false;
}, this);
self.isNameVisible = ko.computed(function() {
if((self.type() == 'text') || (self.type() == 'textarea') || (self.type() == 'select') || (self.type() == 'multiselect') || (self.type() == 'radio') || (self.type() == 'checkbox') || (self.type() == 'upload')) {
return true;
}
return false;
}, this);
self.isBeforeAfterImagesVisible = ko.computed(function() {
if((self.type() == 'text') || (self.type() == 'textarea') || (self.type() == 'select') || (self.type() == 'multiselect') || (self.type() == 'radio') || (self.type() == 'checkbox') || (self.type() == 'upload')) {
return true;
}
return false;
}, this);
self.isTooltipVisible = ko.computed(function() {
if((self.type() == 'text') || (self.type() == 'textarea') || (self.type() == 'select') || (self.type() == 'multiselect') || (self.type() == 'radio') || (self.type() == 'checkbox') || (self.type() == 'upload')) {
return true;
}
return false;
}, this);
self.isLabelVisible = ko.computed(function() {
if((self.type() == 'text') || (self.type() == 'textarea') || (self.type() == 'select') || (self.type() == 'multiselect') || (self.type() == 'radio') || (self.type() == 'checkbox') || (self.type() == 'upload') || (self.type() == 'info')) {
return true;
}
return false;
}, this);
self.isClassVisible = ko.computed(function() {
if((self.type() == 'text') || (self.type() == 'textarea') || (self.type() == 'select') || (self.type() == 'multiselect') || (self.type() == 'radio') || (self.type() == 'checkbox') || (self.type() == 'upload')) {
return true;
}
return false;
}, this);
self.isStyleVisible = ko.computed(function() {
if((self.type() == 'text') || (self.type() == 'textarea') || (self.type() == 'select') || (self.type() == 'multiselect') || (self.type() == 'radio') || (self.type() == 'checkbox') || (self.type() == 'upload')) {
return true;
}
return false;
}, this);
object orientation overrated. let's check the fields in several places ...
private boolean isToRemove(byte b) {
byte[] toRemoveB = { -106 };
for(byte c : toRemoveB) {
if(b == c) {
return true;
}
}
return false;
}
it goes without saying...
<input type="button" value="Go and fill later" onclick="javascript:window.location='<?php echo $url; ?>info.php'" />
Well, a is obsolete, let's do links as buttons!
if(year%100 === 79 ||
year%100 === 90 ||
year%100 === 1 ||
year%100 === 7 ||
year%100 === 18) {
if(month === 1) { while(day%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 2) { while((day + 3)%7 ===0) {day=Math.ceil(Math.random() * 28);}}
if(month === 3) { while((day + 3)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 4) { while((day - 1)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 5) { while((day + 1)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 6) { while((day + 4)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 7) { while((day - 1)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 8) { while((day + 2)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 9) { while((day + 5)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 10) { while(day%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 11) { while((day + 3)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 12) { while((day + 5)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
}
if(year2%100 === 79 ||
year2%100 === 90 ||
year2%100 === 1 ||
year2%100 === 7 ||
year2%100 === 18) {
if(month2 === 1) { while(day2%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 2) { while((day2 + 3)%7 ===0) {day2=Math.ceil(Math.random() * 28);}}
if(month2 === 3) { while((day2 + 3)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 4) { while((day2 - 1)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 5) { while((day2 + 1)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 6) { while((day2 + 4)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 7) { while((day2 - 1)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 8) { while((day2 + 2)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 9) { while((day2 + 5)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 10) { while(day2%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 11) { while((day2 + 3)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 12) { while((day2 + 5)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
}
if(year3%100 === 79 ||
year3%100 === 90 ||
year3%100 === 1 ||
year3%100 === 7 ||
year3%100 === 18) {
if(month3 === 1) { while(day3%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 2) { while((day3 + 3)%7 ===0) {day3=Math.ceil(Math.random() * 28);}}
if(month3 === 3) { while((day3 + 3)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 4) { while((day3 - 1)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 5) { while((day3 + 1)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 6) { while((day3 + 4)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 7) { while((day3 - 1)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 8) { while((day3 + 2)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 9) { while((day3 + 5)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 10) { while(day3%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 11) { while((day3 + 3)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 12) { while((day3 + 5)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
}
if(year%100 === 96) {
if(month === 1) { while(day%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 2) { while((day + 3)%7 ===0) {day=Math.ceil(Math.random() * 29);}}
if(month === 3) { while((day + 2)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 4) { while((day - 2)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 5) { while((day + 2)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 6) { while((day + 3)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 7) { while((day - 2)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 8) { while((day + 1)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 9) { while((day + 4)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 10) { while((day - 1)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 11) { while((day + 2)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 12) { while((day + 4)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
}
if(year2%100 === 96) {
if(month2 === 1) { while(day2%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 2) { while((day2 + 3)%7 ===0) {day2=Math.ceil(Math.random() * 29);}}
if(month2 === 3) { while((day2 + 2)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 4) { while((day2 - 2)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 5) { while((day2 + 2)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 6) { while((day2 + 3)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 7) { while((day2 - 2)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 8) { while((day2 + 1)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 9) { while((day2 + 4)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 10) { while((day2 - 1)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 11) { while((day2 + 2)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 12) { while((day2 + 4)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
}
if(year3%100 === 96) {
if(month3 === 1) { while(day3%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 2) { while((day3 + 3)%7 ===0) {day3=Math.ceil(Math.random() * 29);}}
if(month3 === 3) { while((day3 + 2)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 4) { while((day3 - 2)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 5) { while((day3 + 2)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 6) { while((day3 + 3)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 7) { while((day3 - 2)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 8) { while((day3 + 1)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 9) { while((day3 + 4)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 10) { while((day3 - 1)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 11) { while((day3 + 2)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 12) { while((day3 + 4)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
}
if(year%100 === 85 ||
year%100 === 91 ||
year%100 === 2 ||
year%100 === 13 ||
year%100 === 19) {
if(month === 1) { while((day - 1)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 2) { while((day + 2)%7 ===0) {day=Math.ceil(Math.random() * 28);}}
if(month === 3) { while((day + 2)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 4) { while((day - 2)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 5) { while(day%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 6) { while((day + 3)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 7) { while((day - 2)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 8) { while((day + 1)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 9) { while((day + 4)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 10) { while((day - 1)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 11) { while((day + 2)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 12) { while((day + 4)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
}
if(year2%100 === 85 ||
year2%100 === 91 ||
year2%100 === 2 ||
year2%100 === 13 ||
year2%100 === 19) {
if(month2 === 1) { while((day2 - 1)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 2) { while((day2 + 2)%7 ===0) {day2=Math.ceil(Math.random() * 28);}}
if(month2 === 3) { while((day2 + 2)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 4) { while((day2 - 2)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 5) { while(day2%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 6) { while((day2 + 3)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 7) { while((day2 - 2)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 8) { while((day2 + 1)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 9) { while((day2 + 4)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 10) { while((day2 - 1)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 11) { while((day2 + 2)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 12) { while((day2 + 4)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
}
if(year3%100 === 85 ||
year3%100 === 91 ||
year3%100 === 2 ||
year3%100 === 13 ||
year3%100 === 19) {
if(month3 === 1) { while((day3 - 1)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 2) { while((day3 + 2)%7 ===0) {day3=Math.ceil(Math.random() * 28);}}
if(month3 === 3) { while((day3 + 2)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 4) { while((day3 - 2)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 5) { while(day3%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 6) { while((day3 + 3)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 7) { while((day3 - 2)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 8) { while((day3 + 1)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 9) { while((day3 + 4)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 10) { while((day3 - 1)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 11) { while((day3 + 2)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 12) { while((day3 + 4)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
}
if(year%100 === 80 ||
year%100 === 8) {
if(month === 1) { while((day - 1)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 2) { while((day + 2)%7 ===0) {day=Math.ceil(Math.random() * 29);}}
if(month === 3) { while((day + 1)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 4) { while((day - 3)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 5) { while((day - 1)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 6) { while((day + 2)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 7) { while((day - 3)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 8) { while(day%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 9) { while((day + 3)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 10) { while((day - 2)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 11) { while((day + 1)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 12) { while((day + 3)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
}
if(year2%100 === 80 ||
year2%100 === 8) {
if(month2 === 1) { while((day2 - 1)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 2) { while((day2 + 2)%7 ===0) {day2=Math.ceil(Math.random() * 29);}}
if(month2 === 3) { while((day2 + 1)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 4) { while((day2 - 3)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 5) { while((day2 - 1)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 6) { while((day2 + 2)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 7) { while((day2 - 3)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 8) { while(day2%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 9) { while((day2 + 3)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 10) { while((day2 - 2)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 11) { while((day2 + 1)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 12) { while((day2 + 3)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
}
if(year3%100 === 80 ||
year3%100 === 8) {
if(month3 === 1) { while((day3 - 1)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 2) { while((day3 + 2)%7 ===0) {day3=Math.ceil(Math.random() * 29);}}
if(month3 === 3) { while((day3 + 1)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 4) { while((day3 - 3)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 5) { while((day3 - 1)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 6) { while((day3 + 2)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 7) { while((day3 - 3)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 8) { while(day3%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 9) { while((day3 + 3)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 10) { while((day3 - 2)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 11) { while((day3 + 1)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 12) { while((day3 + 3)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
}
if(year%100 === 86 ||
year%100 === 97 ||
year%100 === 3 ||
year%100 === 14) {
if(month === 1) { while((day - 2)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 2) { while((day + 1)%7 ===0) {day=Math.ceil(Math.random() * 28);}}
if(month === 3) { while((day + 1)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 4) { while((day - 3)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 5) { while((day - 1)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 6) { while((day + 2)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 7) { while((day - 3)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 8) { while(day%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 9) { while((day + 3)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 10) { while((day - 2)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 11) { while((day + 1)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 12) { while((day + 3)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
}
if(year%100 === 92) {
if(month === 1) { while((day - 2)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 2) { while((day + 1)%7 ===0) {day=Math.ceil(Math.random() * 29);}}
if(month === 3) { while(day%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 4) { while((day - 4)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 5) { while((day - 2)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 6) { while((day + 1)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 7) { while((day - 4)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 8) { while((day - 1)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 9) { while((day + 2)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 10) { while((day - 3)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 11) { while(day%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 12) { while((day + 2)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
}
if(year2%100 === 86 ||
year2%100 === 97 ||
year2%100 === 3 ||
year2%100 === 14) {
if(month2 === 1) { while((day2 - 2)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 2) { while((day2 + 1)%7 ===0) {day2=Math.ceil(Math.random() * 28);}}
if(month2 === 3) { while((day2 + 1)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 4) { while((day2 - 3)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 5) { while((day2 - 1)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 6) { while((day2 + 2)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 7) { while((day2 - 3)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 8) { while(day2%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 9) { while((day2 + 3)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 10) { while((day2 - 2)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 11) { while((day2 + 1)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 12) { while((day2 + 3)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
}
if(year2%100 === 92) {
if(month2 === 1) { while((day2 - 2)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 2) { while((day2 + 1)%7 ===0) {day2=Math.ceil(Math.random() * 29);}}
if(month2 === 3) { while(day2%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 4) { while((day2 - 4)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 5) { while((day2 - 2)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 6) { while((day2 + 1)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 7) { while((day2 - 4)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 8) { while((day2 - 1)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 9) { while((day2 + 2)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 10) { while((day2 - 3)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 11) { while(day2%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 12) { while((day2 + 2)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
}
if(year3%100 === 86 ||
year3%100 === 97 ||
year3%100 === 3 ||
year3%100 === 14) {
if(month3 === 1) { while((day3 - 2)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 2) { while((day3 + 1)%7 ===0) {day3=Math.ceil(Math.random() * 28);}}
if(month3 === 3) { while((day3 + 1)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 4) { while((day3 - 3)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 5) { while((day3 - 1)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 6) { while((day3 + 2)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 7) { while((day3 - 3)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 8) { while(day3%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 9) { while((day3 + 3)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 10) { while((day3 - 2)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 11) { while((day3 + 1)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 12) { while((day3 + 3)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
}
if(year3%100 === 92) {
if(month3 === 1) { while((day3 - 2)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 2) { while((day3 + 1)%7 ===0) {day3=Math.ceil(Math.random() * 29);}}
if(month3 === 3) { while(day3%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 4) { while((day3 - 4)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 5) { while((day3 - 2)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 6) { while((day3 + 1)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 7) { while((day3 - 4)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 8) { while((day3 - 1)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 9) { while((day3 + 2)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 10) { while((day3 - 3)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 11) { while(day3%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 12) { while((day3 + 2)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
}
if(year%100 === 81 ||
year%100 === 87 ||
year%100 === 98 ||
year%100 === 9 ||
year%100 === 17) {
if(month === 1) { while((day - 3)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 2) { while(day%7 ===0) {day=Math.ceil(Math.random() * 28);}}
if(month === 3) { while(day%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 4) { while((day - 4)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 5) { while((day - 2)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 6) { while((day + 1)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 7) { while((day - 4)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 8) { while((day - 1)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 9) { while((day + 2)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 10) { while((day - 3)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 11) { while(day%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 12) { while((day + 2)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
}
if(year%100 === 4) {
if(month === 1) { while((day - 3)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 2) { while(day%7 ===0) {day=Math.ceil(Math.random() * 29);}}
if(month === 3) { while((day + 1)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 4) { while((day - 5)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 5) { while((day - 3)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 6) { while(day%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 7) { while((day - 5)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 8) { while((day - 2)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 9) { while((day + 1)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 10) { while((day - 4)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
if(month === 11) { while((day - 1)%7 ===0) {day=Math.ceil(Math.random() * 30);}}
if(month === 12) { while((day + 1)%7 ===0) {day=Math.ceil(Math.random() * 31);}}
}
if(year2%100 === 81 ||
year2%100 === 87 ||
year2%100 === 98 ||
year2%100 === 9 ||
year2%100 === 17) {
if(month2 === 1) { while((day2 - 3)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 2) { while(day2%7 ===0) {day2=Math.ceil(Math.random() * 28);}}
if(month2 === 3) { while(day2%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 4) { while((day2 - 4)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 5) { while((day2 - 2)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 6) { while((day2 + 1)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 7) { while((day2 - 4)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 8) { while((day2 - 1)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 9) { while((day2 + 2)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 10) { while((day2 - 3)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 11) { while(day2%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 12) { while((day2 + 2)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
}
if(year2%100 === 4) {
if(month2 === 1) { while((day2 - 3)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 2) { while(day2%7 ===0) {day2=Math.ceil(Math.random() * 29);}}
if(month2 === 3) { while((day2 + 1)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 4) { while((day2 - 5)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 5) { while((day2 - 3)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 6) { while(day2%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 7) { while((day2 - 5)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 8) { while((day2 - 2)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 9) { while((day2 + 1)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 10) { while((day2 - 4)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
if(month2 === 11) { while((day2 - 1)%7 ===0) {day2=Math.ceil(Math.random() * 30);}}
if(month2 === 12) { while((day2 + 1)%7 ===0) {day2=Math.ceil(Math.random() * 31);}}
}
if(year3%100 === 81 ||
year3%100 === 87 ||
year3%100 === 98 ||
year3%100 === 9 ||
year3%100 === 17) {
if(month3 === 1) { while((day3 - 3)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 2) { while(day3%7 ===0) {day3=Math.ceil(Math.random() * 28);}}
if(month3 === 3) { while(day3%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 4) { while((day3 - 4)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 5) { while((day3 - 2)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 6) { while((day3 + 1)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 7) { while((day3 - 4)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 8) { while((day3 - 1)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 9) { while((day3 + 2)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 10) { while((day3 - 3)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 11) { while(day3%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 12) { while((day3 + 2)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
}
if(year3%100 === 4) {
if(month3 === 1) { while((day3 - 3)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 2) { while(day3%7 ===0) {day3=Math.ceil(Math.random() * 29);}}
if(month3 === 3) { while((day3 + 1)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 4) { while((day3 - 5)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 5) { while((day3 - 3)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 6) { while(day3%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 7) { while((day3 - 5)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 8) { while((day3 - 2)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 9) { while((day3 + 1)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 10) { while((day3 - 4)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
if(month3 === 11) { while((day3 - 1)%7 ===0) {day3=Math.ceil(Math.random() * 30);}}
if(month3 === 12) { while((day3 + 1)%7 ===0) {day3=Math.ceil(Math.random() * 31);}}
}
function IsAOrB(const p_Id: string): boolean;
begin
if ((p_Id = 'A') or (p_Id = 'B')) then begin
Result := true;
Exit;
end;
Result := false;
end;
Result := ((p_Id = 'A') or (p_Id = 'B'));
That would have been enough. But this also features Exit and an asymmetrical if.
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
public void Method1(Enum foo)
{
if (GetCondition1(foo))
{
doSomething();
}
}
private bool GetCondition1(Enum foo)
{
if (foo == Enum.Value1)
return true;
return false;
}