if(date.getFullYear() <= 2017) {
if(date.getMonth() <= 11) {
if(date.getDate() <= 26) {
if(date.getHours() <= 23) {
if(date.getMinutes() <= 59) {
if(date.getSeconds() <= 59) {
//Display popup before 2017-11-27
}
}
}
}
}
}
function changePassword() {
if (isInputEmpty()) {
$.ajax({
type: 'POST',
data: '...'
url: '...',
success: function (result) {
if (result.substring(0, 3) != "!!!") {
//success
} else {
//faliure
}
},
error: function () {
}
});
}
}
And of course,in production, it always reported success and never changed the password, because of equally bad server code.
def divide(a, b):
try:
return a / b
except:
x = 17
My smart exception handling before meeting "pass" :))
if(computedDate != null){
myObject.setDueDate(computedDate);
}
else{
myObject.setDueDate(null);
}
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
if (string.Compare(json["result"].ToString(), "OK", true) == 0)
{
if (string.Compare(json["list"][0]["result"].ToString(), "OK", true) == 0)
return null;
//omitted
}
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.
outerloop:
try {
if (selectedFile == null) {
break outerloop;
} else {
if (selectedFile != null) {
readTo = new PrintStream(selectedFile);
readTo.println(userCodeInput.getText());
readTo = readTheOptionsIntegers(readTo);
}
} catch(IOException e) {
System.out.println(e);
}
int true = 0;
while (true)
{
//do something
}
true = false
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;
}
foreach (Byte bajt in data ) {
BufferIndex = i++;
if (!char.IsControl((char)bajt))
MyCharacter = Convert.ToChar(bajt).ToString();//Encoding.ASCII.GetString(new[]{bajt});
else
MyCharacter = " ";
if (BufferIndex == 200)
{
int a = BufferIndex;
}
if (BufferIndex < 200)
{
sw.WriteLine("PrintBuffer1[" + BufferIndex + "] :=\t" + bajt + "\t; // " + String.Format(@"0x{0:x2}", (ushort)bajt) + "\t" + MyCharacter );
}
if (BufferIndex >= 200 && BufferIndex < 400)
{
BufferIndex = BufferIndex - 200;
sw.WriteLine("PrintBuffer2[" + BufferIndex + "] :=" + bajt + "; // " + String.Format(@"0x{0:x2}", (ushort)bajt) + " " + MyCharacter);
}
if (BufferIndex >= 400 && BufferIndex < 600)
{
BufferIndex = BufferIndex - 400;
sw.WriteLine("PrintBuffer3[" + BufferIndex + "] :=" + bajt + "; // " + String.Format(@"0x{0:x2}", (ushort)bajt) + " " + MyCharacter);
}
if (BufferIndex >= 600 && BufferIndex < 800)
{
BufferIndex = BufferIndex - 600;
sw.WriteLine("PrintBuffer4[" + BufferIndex + "] :=" + bajt + "; // " + String.Format(@"0x{0:x2}", (ushort)bajt) + " " + MyCharacter);
}
if (BufferIndex >= 800 && BufferIndex < 1000)
{
BufferIndex = BufferIndex - 800;
sw.WriteLine("PrintBuffer5[" + BufferIndex + "] :=" + bajt + "; // " + String.Format(@"0x{0:x2}", (ushort)bajt) + " " + MyCharacter);
}
if (BufferIndex >= 1000 && BufferIndex < 1200)
{
BufferIndex = BufferIndex - 1000;
sw.WriteLine("PrintBuffer6[" + BufferIndex + "] :=" + bajt + "; // " + String.Format(@"0x{0:x2}", (ushort)bajt) + " " + MyCharacter);
}
if (BufferIndex >= 1200 && BufferIndex < 1400)
{
BufferIndex = BufferIndex - 1200;
sw.WriteLine("PrintBuffer7[" + BufferIndex + "] :=" + bajt + "; // " + String.Format(@"0x{0:x2}", (ushort)bajt) + " " + MyCharacter);
}
if (BufferIndex >= 1400 && BufferIndex < 1600)
{
BufferIndex = BufferIndex - 1400;
sw.WriteLine("PrintBuffer8[" + BufferIndex + "] :=" + bajt + "; // " + String.Format(@"0x{0:x2}", (ushort)bajt) + " " + MyCharacter);
}
if (BufferIndex >= 1600 && BufferIndex < 1800)
{
BufferIndex = BufferIndex - 1600;
sw.WriteLine("PrintBuffer9[" + BufferIndex + "] :=" + bajt + "; // " + String.Format(@"0x{0:x2}", (ushort)bajt) + " " + MyCharacter);
}
if (BufferIndex >= 1800 && BufferIndex < 2000)
{
BufferIndex = BufferIndex - 1800;
sw.WriteLine("PrintBuffer10[" + BufferIndex + "] :=" + bajt + "; // " + String.Format(@"0x{0:x2}", (ushort)bajt) + " " + MyCharacter);
}
if (BufferIndex >= 2000 && BufferIndex < 2200)
{
BufferIndex = BufferIndex - 2000;
sw.WriteLine("PrintBuffer11[" + BufferIndex + "] :=" + bajt + "; // " + String.Format(@"0x{0:x2}", (ushort)bajt) + " " + MyCharacter);
}
if (BufferIndex >= 2200 && BufferIndex < 2400)
{
BufferIndex = BufferIndex - 2200;
sw.WriteLine("PrintBuffer12[" + BufferIndex + "] :=" + bajt + "; // " + String.Format(@"0x{0:x2}", (ushort)bajt) + " " + MyCharacter);
}
}
don't repeat yourself.. whyy we don't have PrintBufeer[i] ?
public showOrHideLegends(seriesList: any[]) {
if (seriesList.length === 0)
return false;
else
return true;
}
more code lines => more money; that's how our contractor company thinks
if (baza[mCurrentIndex] == Boolean.TRUE) {
if (mCurrentIndex != baza.length-1) {
up();
nextQuestion();
}
if (mCurrentIndex == baza.length) {
WypiszWynik();
}
}
so you have an array of booleans and you're comparing it to Boolean.TRUE why
public class SentCon3 {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
double input;
char choice;
System.out.println("**** Menu-Driven Temperature Converter*****");
System.out.println("only lowwer case is vaild");
System.out.print("Enter the value to beconverted==> ");
input = scan.nextDouble();
System.out.println("What is your choice?");
System.out.println("a)Fahrenheit to Celsius");
System.out.println("b)Celsius to Fahrenheit");
System.out.println("c)Kelvin to Celsius");
System.out.println("d)Celsius to Kelvin");
System.out.println("e)Kelvin to Fahrenheit");
System.out.println("f)Fahrenheit to Kelvin.");
System.out.print("Please enter your choice ==>");
choice = scan.next().charAt(0);
while (choice == 'a') {
System.out.println((input / 5) * 9 + 32);
break;
}
while (choice == 'b') {
System.out.println((input - 32) * 5 / 9);
break;
}
while (choice == 'c') {
System.out.println(input - 273.15);
break;
}
while (choice == 'd') {
System.out.println(input + 273.15);
break;
}
while (choice == 'e') {
System.out.println((input - 273.5) * 9 / 5 + 32);
break;
}
while (choice == 'f') {
System.out.println((input + 459.67) * 5 / 9);
break;
}
}
}
use while as if!!!!
let arr = []
if(arr[record.id]) {
arr[record.id] = false
} else {
arr[record.id] = false
}
this.setState({a: arr})
arr = []