- 1
- 2
- 3
- 4
- 5
- 6
if($response == null){
echo "<pre>";
var_dump($response);
echo "</pre>";
die();
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+2
if($response == null){
echo "<pre>";
var_dump($response);
echo "</pre>";
die();
}
Таким способом выводится на экран надпись NULL
+1
private void LoadControlFile()
{
this.OFD2.Title = "Open an ORYZA Run Control File";
this.OFD2.Filter = "Text Files|*.*";
this.OFD2.ShowDialog();
string path = this.OFD2.FileName.Trim();
if (Path.GetExtension(path).ToUpper() != ".EXE")
{
this.TextBox2.Text = path;
}
else
{
string text = "Loading file is not a text file, RETRY!";
MessageBox.Show(text, "Important Note", MessageBoxButtons.OK);
}
}
Филипинская прога на Win Forms. Проверка на то что входной файл не исполняемый, а текстовый.
+2
(* https://coq.inria.fr/library/Coq.Init.Datatypes.html *)
(* Basic boolean operators *)
Definition andb (b1 b2:bool) : bool := if b1 then b2 else false.
Definition orb (b1 b2:bool) : bool := if b1 then true else b2.
Definition implb (b1 b2:bool) : bool := if b1 then b2 else true.
Definition xorb (b1 b2:bool) : bool :=
match b1, b2 with
| true, true => false
| true, false => true
| false, true => true
| false, false => false
end.
Definition negb (b:bool) := if b then false else true.
Infix "||" := orb : bool_scope.
Infix "&&" := andb : bool_scope.
На первый взгляд этот ваш Coq (питух) выглядит как очередной ML-язычок.
0
type int = 1;
function main() {
print("try/catch");
let t = 1;
try {
throw 1;
} catch (v: int) {
print("Hello ", v);
v = t;
}
assert(v == t);
print("done.");
}
Ура ура.. новый говнокод подоспел... это гавно теперь параметры в тело "catch"-а передает
0
let randomNum = Math.floor(Math.random() * 10) + 1;
let inputNum
do {
inputNum = prompt('Угадай циферку!')
if (inputNum < randomNum) {
alert('Недобор');
} else if (inputNum > randomNum) {
alert('Перебор');
} else if (typeof inputNum === "string") {
alert('ну не, циферку же!');
} else if (inputNum == null || inputNum == '') {
alert('Покасики!');
} else if (inputNum === randomNum) {
alert('Угадал!!!'); break;
}
} while (inputNum != randomNum);
Оно сначала совсем не работало. Потом вдруг заработало. Потом я ему дал полежать, настояться, и оно работать перестало опять О_о моя нипанимать
0
IT Оффтоп #115
#85: https://govnokod.ru/27381 https://govnokod.xyz/_27381
#86: https://govnokod.ru/27405 https://govnokod.xyz/_27405
#87: https://govnokod.ru/27429 https://govnokod.xyz/_27429
#88: https://govnokod.ru/27432 https://govnokod.xyz/_27432
#89: https://govnokod.ru/27435 https://govnokod.xyz/_27435
#90: https://govnokod.ru/27439 https://govnokod.xyz/_27439
#91: https://govnokod.ru/27449 https://govnokod.xyz/_27449
#92: https://govnokod.ru/27460 https://govnokod.xyz/_27460
#93: https://govnokod.ru/27463 https://govnokod.xyz/_27463
#94: https://govnokod.ru/27466 https://govnokod.xyz/_27466
#95: https://govnokod.ru/27473 https://govnokod.xyz/_27473
#96: https://govnokod.ru/27478 https://govnokod.xyz/_27478
#97: https://govnokod.ru/27484 https://govnokod.xyz/_27484
#98: https://govnokod.ru/27495 https://govnokod.xyz/_27495
#99: https://govnokod.ru/27504 https://govnokod.xyz/_27504
#100: https://govnokod.ru/27508 https://govnokod.xyz/_27508
#101: https://govnokod.ru/27511 https://govnokod.xyz/_27511
#102: https://govnokod.ru/27518 https://govnokod.xyz/_27518
#103: https://govnokod.ru/27526 https://govnokod.xyz/_27526
#104: https://govnokod.ru/27534 https://govnokod.xyz/_27534
#105: https://govnokod.ru/27544 https://govnokod.xyz/_27544
#106: https://govnokod.ru/27552 https://govnokod.xyz/_27552
#107: https://govnokod.ru/27554 https://govnokod.xyz/_27554
#108: https://govnokod.ru/27557 https://govnokod.xyz/_27557
#109: https://govnokod.ru/27581 https://govnokod.xyz/_27581
#110: https://govnokod.ru/27610 https://govnokod.xyz/_27610
#111: https://govnokod.ru/27644 https://govnokod.xyz/_27644
#112: https://govnokod.ru/27648 https://govnokod.xyz/_27648
#113: https://govnokod.ru/27652 https://govnokod.xyz/_27652
#114: https://govnokod.ru/27659 https://govnokod.xyz/_27659
0
import java.util.Arrays;
import java.util.Optional;
public class AntiVirus{
private int scanIntensity = 0;
//this method is ready for you.
public void setScanIntensity(int level){
scanIntensity = level;
}
//write this method.
public String scanFile(File file,VirusDB database){
String[] signature = database.getSignatures(scanIntensity);
String fileData = file.getData().toLowerCase();
Optional<String> res = Arrays.stream(signature)
.map(s -> s.toLowerCase())
.filter(fileData::contains).findAny();
String scan = " is safe";
if(res.isPresent()) {
System.out.println(res.get());
System.out.println("scan: " + scan);
scan = " is not safe";
System.out.println("scan after: " + scan);
}
return file.getName() + scan;
}
}
Не понимаю, почему не работает.
Задача
https://www.codewars.com/kata/5b13027eedd62c5216000001
Test Results:
AVTest
checkRandomFiles
Log
dos
scan: is safe
scan after: is not safe
dos
scan: is safe
scan after: is not safe
dos
scan: is safe
scan after: is not safe
dos
scan: is safe
scan after: is not safe
dos
scan: is safe
scan after: is not safe
dos
scan: is safe
scan after: is not safe
dos
scan: is safe
scan after: is not safe
dos
scan: is safe
scan after: is not safe
dos
scan: is safe
scan after: is not safe
expected:<f4wpzFoQD is [not ]safe> but was:<f4wpzFoQD is []safe>
Stack Trace
Completed in 476ms
checkSameFilesWithDifferentIntensitySett ings
Log
virus
scan: is safe
scan after: is not safe
expected:<file1 is [not ]safe> but was:<file1 is []safe>
Stack Trace
Completed in 1ms
Completed in 496ms
0
private static final Map<Integer, FieldInfo> HEAD_FIELDS = new ImmutableMap.Builder<Integer, FieldInfo>()
.put(5, new FieldInfo("DOC.CODEOKATO", FieldInfoType.STRING))
// .put(7, new FieldInfo("DOC.NAMECMO", FieldInfoType.STRING))
.put(8, new FieldInfo("DOC.CODECMO", FieldInfoType.STRING))
// .put(9, new FieldInfo("DOC.NAMEMEDORG", FieldInfoType.STRING))
.put(10, new FieldInfo("DOC.CODEMO", FieldInfoType.STRING))
.put(14, new FieldInfo("DOC.INFINSPERSON_BIRTHDAY", FieldInfoType.DATE))
.put(12, new FieldInfo("DOC.INFINSPERSON_NUMHEALINS", FieldInfoType.STRING))
.put(15, new FieldInfo("DOC.INFINSPERSON_GENDER", FieldInfoType.STRING))
.put(16, new FieldInfo("DOC.INFINSPERSON_DATESTRMED", FieldInfoType.DATE))
.put(17, new FieldInfo("DOC.INFINSPERSON_DATEFINMED", FieldInfoType.DATE))
.put(13, new FieldInfo("DOC.INFINSPERSON_NMEDICCARD", FieldInfoType.STRING))
.put(18, new FieldInfo("DOC.INFINSPERSON_CODEMKB", FieldInfoType.STRING))
.put(23 - 1, new FieldInfo("DOC.INFINSPERSON_SEVCOVID19", FieldInfoType.STRING))
.put(24 - 1, new FieldInfo("DOC.INFINSPERSON_SEVCOVID191", FieldInfoType.STRING))
.put(25 - 1, new FieldInfo("DOC.INFINSPERSON_SEVCOVID192", FieldInfoType.STRING))
.build();
Коллега изменил мой код, пока я болел.
+2
(format t "~A~%" (*) )
https://ideone.com/oO7f4I
+2
https://codeforwin.org/2018/05/10-cool-bitwise-operator-hacks-and-tricks.html
10 cool bitwise operator hacks and tricks every programmer must know
Right shift (>>) operator is equivalent to division by 2
Want to divide a number by 2 quicky. Here you go, use bitwise right shift operator to divide an integer by 2. Each right shift operation reduces the number (operand) to its half.
Просто напомню, что Jawa-петушки вручную заменяют деление/умножение на 2 на сдвиг, потому что анскильный компилятор так не умеет.