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
char * dataFunc(){
TCHAR tc[256];
LONG tc_len = sizeof(tc);
getData((LPBYTE)&tc, &tc_len);
char * data = new char[tc_len];
for(int i = 0;i < tc_len;i++)
data[i] = tc[i];
return data;
}
@EventHandler
public void onCpUse(PlayerMoveEvent e) {
Player player = e.getPlayer();
if(Main.main.state != Gamestate.JUMP) return;
if(!Main.main.alive.contains(player)) return;
Location loc = e.getPlayer().getLocation();
loc.setY(loc.getY() -1);
Block standingOnBlock = loc.getBlock();
int currentCP = Main.main.checkpointTracker.get(player);
int nextCP = currentCP+1;
if(standingOnBlock.getType() == Material.EMERALD_BLOCK) {
Main.main.lm.setLocation(Main.main.map + "x" + nextCP + "x" + player.getName(), player.getLocation());
standingOnBlock.setType(Material.BEDROCK);
giveCPEquip(player, nextCP);
Main.main.checkpointTracker.put(player, nextCP);
Main.main.scoreboard.setIngameScoreboard(player);
player.sendMessage(Main.main.pr + "�aDu hast den " + nextCP + ". Checkpoint erreicht!");
if(Main.main.particleTracker.containsKey(player)) {
player.spawnParticle(Main.main.particleTracker.get(player), player.getLocation(), 10);
}
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 10, 1);
}
}
public void giveCPEquip(Player p, int cp) {
Inventory i = p.getInventory();
ItemStack cp1Helmet = Main.main.utils.create(Material.LEATHER_HELMET, 1);
ItemStack cp1Chest = Main.main.utils.create(Material.LEATHER_CHESTPLATE, 1);
ItemStack cp1Leggings = Main.main.utils.create(Material.LEATHER_LEGGINGS, 1);
ItemStack cp1Boots = Main.main.utils.create(Material.LEATHER_BOOTS, 1);
ItemStack cp2Sword = Main.main.utils.createSharp1Item(Material.STONE_SWORD, 1);
ItemStack cp3Apples = Main.main.utils.create(Material.GOLDEN_APPLE, 3);
ItemStack cp4Chest = Main.main.utils.create(Material.CHAINMAIL_CHESTPLATE, 1);
ItemStack cp4Leggings = Main.main.utils.create(Material.CHAINMAIL_LEGGINGS, 1);
ItemStack cp5Helmet = Main.main.utils.create(Material.IRON_HELMET, 1);
ItemStack cp5Boots = Main.main.utils.create(Material.IRON_BOOTS, 1);
//6 Add extra Herzen
ItemStack cp7Sword = Main.main.utils.create(Material.DIAMOND_SWORD, 1);
ItemStack cp8Sword = Main.main.utils.create(Material.SHIELD, 1);
ItemStack cp1Helmet1 = Main.main.utils.create(Material.DIAMOND_HELMET, 1);
ItemStack cp1Chest1 = Main.main.utils.create(Material.DIAMOND_CHESTPLATE, 1);
ItemStack cp1Leggings1 = Main.main.utils.create(Material.DIAMOND_LEGGINGS, 1);
ItemStack cp1Boots1 = Main.main.utils.create(Material.DIAMOND_BOOTS, 1);
ItemStack cp2Sword1 = Main.main.utils.createSharp1Item(Material.DIAMOND_SWORD, 1);
ItemStack cp3Apples1 = Main.main.utils.create(Material.SHIELD, 1);
ItemStack cp4Leggings1 = Main.main.utils.create(Material.NETHERITE_LEGGINGS, 1);
ItemStack cp5Helmet1 = Main.main.utils.create(Material.NETHERITE_HELMET, 1);
ItemStack cp5Boots1 = Main.main.utils.create(Material.NETHERITE_BOOTS, 1);
//6 Add extra Herzen
ItemStack cp7Sword1 = Main.main.utils.create(Material.NETHERITE_CHESTPLATE, 1);
ItemStack cp8Sword1 = Main.main.utils.createSharp1Item(Material.NETHERITE_SWORD, 1);
ItemStack cp1Helmet2 = Main.main.utils.create(Material.GOLDEN_HELMET, 1);
ItemStack cp1Chest2 = Main.main.utils.create(Material.GOLDEN_CHESTPLATE, 1);
ItemStack cp1Leggings2 = Main.main.utils.create(Material.GOLDEN_LEGGINGS, 1);
ItemStack cp1Boots2 = Main.main.utils.create(Material.GOLDEN_BOOTS, 1);
ItemStack cp2Sword2 = Main.main.utils.createSharp1Item(Material.STONE_SWORD, 1);
ItemStack cp3Apples2 = Main.main.utils.create(Material.GOLDEN_APPLE, 3);
ItemStack cp3Apple2 = Main.main.utils.create(Material.SHIELD, 1);
ItemStack cp4Leggings2 = Main.main.utils.create(Material.IRON_LEGGINGS, 1);
ItemStack cp5Helmet2 = Main.main.utils.create(Material.IRON_HELMET, 1);
ItemStack cp5Boots2 = Main.main.utils.create(Material.IRON_BOOTS, 1);
//6 Add extra Herzen
ItemStack cp7Sword2 = Main.main.utils.create(Material.IRON_CHESTPLATE, 1);
ItemStack cp8Sword2 = Main.main.utils.createSharp1Item(Material.IRON_SWORD, 1);
if(!Main.main.random) {
if(Main.main.rn ==0) {
if(cp == 1) {
i.addItem(cp1Helmet);
i.addItem(cp1Chest);
i.addItem(cp1Leggings);
i.addItem(cp1Boots);
}else if(cp == 2) {
i.addItem(cp2Sword);
}else if(cp == 3) {
i.addItem(cp3Apples);
}else if(cp == 4) {
i.addItem(cp4Chest);
i.addItem(cp4Leggings);
}else if(cp == 5) {
i.addItem(cp5Helmet);
i.addItem(cp5Boots);
}else if(cp == 6) {
p.setMaxHealth(24);
p.sendMessage(Main.main.pr + "�aDu hast zwei Extraherzen erhalten!");
}else if(cp == 7) {
i.addItem(cp7Sword);
}else if(cp == 8) {
i.addItem(cp8Sword);
if(Main.main.fallTracker.get(p) == 0) {
p.sendMessage(Main.main.pr + "Du hast das Ziel ohne JumpFail erreicht!");
p.getInventory().addItem(Main.main.utils.create(Material.DIAMOND_HELMET, 1));
}
Bukkit.broadcastMessage(Main.main.pr + "�5" + p.getName() + " �a hat das Ziel erreicht!");
Main.main.cd.cancelIngameTask();
Main.main.cd.startDeathmatchCD();
}
}else if(Main.main.rn == 1) {
if(cp == 1) {
i.addItem(cp1Helmet1);
i.addItem(cp1Chest1);
i.addItem(cp1Leggings1);
i.addItem(cp1Boots1);
}else if(cp == 2) {
i.addItem(cp2Sword1);
}else if(cp == 3) {
i.addItem(cp3Apples1);
}else if(cp == 4) {
i.addItem(cp4Leggings1);
}else if(cp == 5) {
i.addItem(cp5Helmet1);
i.addItem(cp5Boots1);
}else if(cp == 6) {
p.setMaxHealth(24);
p.sendMessage(Main.main.pr + "�aDu hast zwei Extraherzen erhalten!");
}else if(cp == 7) {
i.addItem(cp7Sword1);
}else if(cp == 8) {
i.addItem(cp8Sword1);
if(Main.main.fallTracker.get(p) == 0) {
p.sendMessage(Main.main.pr + "Du hast das Ziel ohne JumpFail erreicht!");
p.getInventory().addItem(Main.main.utils.create(Material.GOLDEN_APPLE, 10));
}
Bukkit.broadcastMessage(Main.main.pr + "�5" + p.getName() + " �a hat das Ziel erreicht!");
Main.main.cd.cancelIngameTask();
Main.main.cd.startDeathmatchCD();
}
}else if(Main.main.rn == 2) {
if(cp == 1) {
i.addItem(cp1Helmet2);
i.addItem(cp1Chest2);
i.addItem(cp1Leggings2);
i.addItem(cp1Boots2);
}else if(cp == 2) {
i.addItem(cp2Sword2);
}else if(cp == 3) {
i.addItem(cp3Apples2);
i.addItem(cp3Apple2);
}else if(cp == 4) {
i.addItem(cp4Leggings2);
}else if(cp == 5) {
i.addItem(cp5Helmet2);
i.addItem(cp5Boots2);
}else if(cp == 6) {
p.setMaxHealth(24);
p.sendMessage(Main.main.pr + "�aDu hast zwei Extraherzen erhalten!");
}else if(cp == 7) {
i.addItem(cp7Sword2);
}else if(cp == 8) {
i.addItem(cp8Sword2);
if(Main.main.fallTracker.get(p) == 0) {
p.sendMessage(Main.main.pr + "Du hast das Ziel ohne JumpFail erreicht!");
p.getInventory().addItem(Main.main.utils.create(Material.GOLDEN_APPLE, 10));
}
Bukkit.broadcastMessage(Main.main.pr + "�5" + p.getName() + " �a hat das Ziel erreicht!");
Main.main.cd.cancelIngameTask();
Main.main.cd.startDeathmatchCD();
}
}
}else {
Random random = new Random();
List<Material> materials = Arrays.asList(Material.values());
int size = materials.size()-1;
Material ran = materials.get(random.nextInt(size));
p.getInventory().addItem(new ItemStack(ran, 1));
if(cp == 8) {
if(Main.main.fallTracker.get(p) == 0) {
p.sendMessage(Main.main.pr + "Du hast das Ziel ohne JumpFail erreicht!");
p.getInventory().addItem(Main.main.utils.create(Material.DIAMOND_HELMET, 1));
}
Bukkit.broadcastMessage(Main.main.pr + "�5" + p.getName() + " �a hat das Ziel erreicht!");
Main.main.cd.cancelIngameTask();
Main.main.cd.startDeathmatchCD();
}
}
}
This beautiful code snippet was found in one of the repositories of people who sell their products on Fiverr. As you may have noticed only the functionally of code is beautiful but also the formatting style.
function uploadimg(file) {
var ext = file.value.split('.').pop().toLowerCase();
var size = document.getElementById("uploadpic").files.item(0).size;
if (size > 3145728) {
$.messager.alert({
title: "Error",
msg: " image to large",
icon: "error"
});
return true;
}
return false;
}
var reader = new FileReader();
$("#uploadpic").change(function() {
var pdfcheck = this;
var ext = pdfcheck.value.split('.').pop().toLowerCase();
if (!($.inArray(ext, ['pdf']) == -1)) {
console.log('upload pdf start');
if (uploadPdf(pdfcheck)) {
$("#preview_img").attr("src", "");
$("#preview_img2").attr("src", "");
$("#uploadpic").prop("file", "");
$("#uploadpic").val("");
}
} else {
if (uploadimg(pdfcheck)) {//dude, I think the image you upload to check is your dick, only small enough you would rather keep going producing shitcode.
return false;
}
var upload_file = $("#uploadpic")[0].files[0];
if (upload_file != null) {
var chimgarr = ["image/png", "image/PNG", "image/jpg", "image/JPG", "image/jpeg", "image/JPEG", "image/gif", "image/GIF", "image/bmp", "image/BMP"];
if (chimgarr.indexOf(upload_file.type) != "-1") {
reader.readAsDataURL(upload_file);
reader.onload = function(e) {
$("#preview_img").attr("src", e.target.result);
$("#preview_img2").attr("src", e.target.result);
$("#pdf-contents").hide();
$("#pdf_name").val("");
$("#btn_pdf_view").hide();
$("#pic_name").val("");
}
} else {
$.messager.alert("Image format does not match");
$("#preview_img").attr("src", "");
$("#preview_img2").attr("src", "");
$("#uploadpic").prop("file", "");
$("#uploadpic").val("");
}
} else {
$("#preview_img").attr("src", "");
$("#preview_img2").attr("src", "");
}
}
});
The moment an important image ready to be uploaded It's really important that should be checked again and again.
$('#userCheck').not(this).prop('checked', false);
def divide(a, b):
try:
return a / b
except:
x = 17
My smart exception handling before meeting "pass" :))
/// <summary>
/// Method that checks if an object is not null
/// </summary>
/// <param name="obj">extend type of <see cref="Object"/></param>
/// <returns>true if object is not null</returns>
public static bool NotNull(this Object obj)
{
return obj != null;
}
[TestMethod]
public void Test_Something()
{
// test
var result = DoSomething();
// assert
Assert.IsTrue(result.NotNull());
}
try {
User.ClaimToken();
}
catch {
User.ClaimToken();
}
else if result !== true && result === false { return result !== true }
should I keep this in our project or nah
<div ng-repeat="recipient in $ctrl.resource.invoiceRecipients track by $index">
<div>
{{$ctrl.resource.invoiceRecipients[$index]}}
</div>
</div>
You could easily use the "recipient" variable instead of getting it again from the array, is there a reason for doing this?
#include <iostream>
#define OPEN_PARENTHESIS (
#define CLOSE_PARENTHESIS )
#define OPEN_BRACES {
#define CLOSE_BRACES }
#define INTEGER int
#define STANDARD_LIB std::
#define CONSOLE_OUT cout
#define ANGLE_BRACKETS <<
#define MESSAGE "Hello World\n"
#define SEMI ;
#define CLASS_NAME main
INTEGER CLASS_NAME OPEN_PARENTHESIS CLOSE_PARENTHESIS OPEN_BRACES
STANDARD_LIB CONSOLE_OUT ANGLE_BRACKETS MESSAGE SEMI
CLOSE_BRACES
Everything is defined
@SuppressWarnings("unchecked")
private void addEndpointsTags(JsonArray tagsArray) throws IOException {
if (registeredHandlers == null || registeredHandlers.isEmpty()) {
return;
}
TreeSet<String> handlerNamesSorted = new TreeSet<>(registeredHandlers.keySet());
handlerNamesSorted.forEach(key -> {
StringBuilder sb = new StringBuilder();
sb.append("{\"name\":\"");
sb.append(key);
sb.append("\",\"request\":{\"name\":\"");
try {
ServiceMethodHandler handler = registeredHandlers.get(key);
Class<? extends Message> requestClass = (Class<? extends Message>)
findSubClassParameterType(handler, 0);
Class<? extends Message> responseClass = (Class<? extends Message>)
findSubClassParameterType(handler, 1);
sb.append(requestClass.getSimpleName());
sb.append("\",\"type\":\"");
sb.append(requestClass.getSimpleName());
sb.append("\",\"values\":[");
sb.append(getProtobufClassFieldDescriptions(requestClass, new HashSet<>()));
sb.append("]},\"response\":{\"name\":\"");
sb.append(responseClass.getSimpleName());
sb.append("\",\"type\":\"");
sb.append(responseClass.getSimpleName());
sb.append("\",\"values\":[");
sb.append(getProtobufClassFieldDescriptions(responseClass, new HashSet<>()));
sb.append("]},\"metadata\":{\"stream\":\"false\"}}");
} catch (Exception e) {
logger.error("Error inspecting handlers", e);
return;
}
String tag = sb.toString();
tagsArray.add(new JsonPrimitive("e-" + binaryEncode(tag)));
});
}
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);
}
if ((string)filtros[0] != "-1" && (string)filtros[0] != "0")
filtros[0] = (string)filtros[0] != "" ? filtros[0] : DBNull.Value;
else
filtros[0] = DBNull.Value;
if (preg_match("/^N/",$postcode)) {
if (preg_match("/^NW/", $postcode)) {
if (!preg_match("/^NW1/", $postcode)) {
// NORTH WEST (NW2, NW3, NW4, NW5, NW6, NW7, NW8, NW9, NW10)
$property['Prop_area'] = 'NW';
} else {
// NW1 which is Central
$property['Prop_area'] = 'SW';
}
} else {
// NORTH (N1, N2, N3, N4, N5 etc)
$property['Prop_area'] = 'N';
}
} else if (preg_match("/^W/",$postcode)) {
if (
!preg_match("/^W1 /",$postcode)
&& !preg_match("/^W2 /",$postcode)
&& !preg_match("/^W8/",$postcode)
&& !preg_match("/^W11/",$postcode)
) {
// WEST includes (W3, W4, W5, W6, W7, W9, W10, W12, W13, W14)
$property['Prop_area'] = 'W';
} else {
//W1 and W2, W8, W11 which are Central
$property['Prop_area'] = 'SW';
}
} else {
if (
preg_match("/^SW/",$postcode)
|| preg_match("/^EC/",$postcode)
|| preg_match("/^WC/",$postcode)
) {
// CENTRAL includes (W1, W2, EC, WC, NW1, SW1, SW3, SW5, SW7, W8, W11)
$property['Prop_area'] = 'SW';
} else {
// OTHER includes South and East and everything else
return 'SE';
}
}