- 1
- 2
- 3
Знаете ли Вы, что ReadPrivateProfileString игнорирует закрывающую квадратную скобку в названии секции?
[ThereAreValidSectionName
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+1
Знаете ли Вы, что ReadPrivateProfileString игнорирует закрывающую квадратную скобку в названии секции?
[ThereAreValidSectionName
Куд-куд-кудат-куд-куд!
0
while True:
prev_word = next_word
if next_word.is_empty():
next_word = random.choice(words)
else:
next_word = chain.get_next_word(next_word.root, lambda: Text.Word(''))
suffix = suffix_chain.get_next_word((prev_word.suffix, next_word.root), lambda: '')
if len(suffix) == 0:
suffix = next_word.suffix
punct = punct_chain.get_next_word(next_word.root, lambda: '')
if len(output_words) == 0 or output_words[-1].is_ending_word():
res_word = Text.PunctedWord(next_word.root.capitalize(), suffix, punct)
else:
res_word = Text.PunctedWord(next_word.root, suffix, punct)
output_words += [res_word]
generated_chars += len(res_word)
if chars_max_count > 0 and generated_chars > chars_max_count:
break
if words_max_count > 0 and len(output_words) > words_max_count:
break
Вореции. Генерации. Кобенации. Теперь в энтерпрайз почти ООП-стиле!
s: https://github.com/gost-gk/vorec-enterprise
0
import java.io.File
import java.io.FileReader
fun main(args: Array<String>) {
val text = getText("Input line")
val fileName = getText("Input file name")
val mode = getInt("Input mode: 1 for rewrite, 2 for append", 1, 2)
doAction(mode, text, fileName)
}
fun doAction(mode: Int, text : String, fileName : String) {
val file = File(fileName)
when(mode) {
1 -> file.writeText(text)
2 -> file.appendText(text)
}
}
fun getInt(message: String, min : Int, max: Int) : Int {
var buffer : Int?
do {
print(message)
buffer = readLine()?.toIntOrNull()
}
while (buffer == null || buffer !in min..max)
return buffer
}
fun getText(message : String) : String {
print(message)
return readLine() ?: ""
}
Решил добавить немного говнокода на Kotlin
+2
СообщениеСМС = Перечисления.СостоянияСообщенияSMS.Исходящее;
Для каждого СообщениеСМС Из СообщениеSMS.Услуги Цикл
СообщениеСМС.СостояниеСообщения = Перечисления.СостоянияСообщенияSMS.Исходящее;
КонецЦикла;
1С:Медицина. Поликлинка
+2
ТекЧас = Строка(Час(Дата2));
ТекЧас = Прав("00" + ТекЧас, 2);
ТекМин = Строка(Минута(Дата2));
ТекМин = Прав("00" + ТекМин, 2);
ТекВремя = ТекЧас + ":" + ТекМин;
Это способ получить время в формате "чч:мм" из даты и времени (переменная Дата2).
Заменяется этим:
ТекВремя = Формат(Дата2, "ДФ=hh:mm");
0
https://www.theverge.com/2018/12/4/18125238/microsoft-chrome-browser-windows-10-edge-chromium
Chromium победил
+1
// HooksList.h
#define PPCAT_NX(A, B) A ## B
#define PPCAT(A, B) PPCAT_NX(A, B)
#ifdef HOOKS_DEFS
using namespace NtStructs;
#define API_HOOK_DEF(module_name, hook_name, return_type, enabled, ...) \
typedef return_type(WINAPI *PPCAT(hook_name, _ptr))(__VA_ARGS__); \
return_type WINAPI PPCAT(hook_name, _hook)(__VA_ARGS__); \
extern PPCAT(hook_name, _ptr) PPCAT(hook_name, _orig);
#elif defined(HOOKS_LIST)
#define API_HOOK_DEF(module_name, hook_name, return_type, enabled, ...) \
{module_name, #hook_name, (LPVOID)PPCAT(hook_name, _hook), (LPVOID*)&PPCAT(hook_name, _orig), enabled},
#elif defined(HOOKS_TYPES_DEF)
using namespace NtStructs;
#define API_HOOK_DEF(module_name, hook_name, return_type, enabled, ...) \
typedef return_type(WINAPI *PPCAT(hook_name, _ptr))(__VA_ARGS__); \
return_type WINAPI PPCAT(hook_name, _hook)(__VA_ARGS__);
#elif defined(ORIGINAL_FUNCTIONS_TABLE_DEF)
#define API_HOOK_DEF(module_name, hook_name, return_type, enabled, ...) \
PPCAT(hook_name, _ptr) hook_name;
#elif defined(ORIGINAL_FUNCTIONS_TABLE_FILL)
#define API_HOOK_DEF(module_name, hook_name, return_type, enabled, ...) \
(ORIGINAL_FUNCTIONS_TABLE_NAME).hook_name = PPCAT(hook_name, _orig);
#else
#define API_HOOK_DEF(...)
#endif
// NtCreateFile
API_HOOK_DEF(L"ntdll", NtCreateFile, NTSTATUS, true,
PHANDLE FileHandle,
ACCESS_MASK DesiredAccess,
POBJECT_ATTRIBUTES ObjectAttributes,
PIO_STATUS_BLOCK IoStatusBlock,
PLARGE_INTEGER AllocationSize,
ULONG FileAttributes,
ULONG ShareAccess,
ULONG CreateDisposition,
ULONG CreateOptions,
PVOID EaBuffer,
ULONG EaLength)
// NtDeleteFile
API_HOOK_DEF(L"ntdll", NtDeleteFile, NTSTATUS, true,
POBJECT_ATTRIBUTES ObjectAttributes)
// И так далее
// В .cpp:
static HookEntry hookEntries[] = {
#define HOOKS_LIST
#include "HooksList.h"
#undef HOOKS_LIST
};
// ...
static OriginalFunctions originalFuncsTable;
#define ORIGINAL_FUNCTIONS_TABLE_FILL 1
#define ORIGINAL_FUNCTIONS_TABLE_NAME originalFuncsTable
#include "HooksList.h"
#undef ORIGINAL_FUNCTIONS_TABLE_NAME
#undef ORIGINAL_FUNCTIONS_TABLE_FILL
Мокросы!..
−4
начало пхп прог уннамед
подключить "пхп модуль 1.0"
доллар целое а = 4
доллар целое б = 2
печать сум доллар а + доллар б 2
помолиться perl
конец пхп прог уннамед
0
#include "pch.h"
#include <iostream>
using namespace std;
void p(int a[], int &h )
{
int i = 0;
int max = 0;
int counter = 1;
while (counter < h)
{
if (a[counter] > a[max])
{
max = counter;
}
counter = counter + 1;
}
int min = 0;
int counter2 = 1;
while (counter < h)
{
if (a[counter] < a[min])
{
min = counter;
}
counter = counter + 1;
}
int kol, kol2;
if (max > min)
{
if (max != min)
{
kol = max - min - 1;
i = min + 1;
cout << "Kolichestvo elementov mezdu imin i imax: " << kol << endl;
}
else
{
cout << "Kolichestvo elementov mezdu imin i imax: 0" << endl;
}
}
else
{
if (max != min)
{
kol2 = min - max - 1;
i = max + 1;
cout << "Kolichestvo elementov mezdu imin i imax: " << kol2 << endl;
}
else
{
cout << "Kolichestvo elementov mezdu imin i imax: 0" << endl;
}
}
int sum = 0;
while (i < max)
{
sum = sum + a[i];
i++;
}
cout << "Summa elementov mezdu imin i imax: " << sum << endl;
}
int main()
{
int h;
cout << "Vvedite razmer massiva: ";
cin >> h;
int *a = new int[h];
for (int i = 0; i < h; i++)
cin >> a[i];
p(a, h);
delete[] a;
return 0;
}
Увековеченный Говнокод Нама, моего друга из Вьетнама (УГК)
+1
export function doFilters(global, value) {
let filterListGeo, filterListStatus
const timeLife = global.selectedFilters.ttl // Функция настройки параметров фильтра. По каждому полю проходит проверка: либо фильтр отсутсвует, либо его настройки соовтетсвуют пользовательским.
const timeStart = global.selectedFilters.tts
const rate = global.selectedFilters.startRate
const shippingDate = new Date(formatDate(value.dateFrom, 'MM.DD.YYYY'))
const unloadDate = new Date(formatDate(value.dateTo, 'MM.DD.YYYY'))
const shippingDateFrom = new Date(global.dateFromInterval[0])
const shippingDateTo = new Date(global.dateFromInterval[1])
const unloadDateFrom = new Date(global.dateToInterval[0])
const unloadDateTo = new Date(global.dateToInterval[1])
if (global.strainer) {
filterListGeo = global.strainer.geozoneFrom
filterListStatus = global.strainer.status
}
return ((!global.selectedFilters) || (!timeLife) || (!timeLife.from && !timeLife.to) || (value.ttl >= timeLife.from && value.ttl < timeLife.to) || (!timeLife.to && value.ttl > timeLife.from)) &&
((!global.selectedFilters) || (!timeStart) || (!timeStart.from && !timeStart.to) || (value.ttl >= timeStart.from && value.ttl < timeStart.to) || (!timeStart.to && value.ttl > timeStart.from)) &&
((!global.orderId) || (!global.orderId.length || String(value.orderId).substr(0, global.orderId.length) === global.orderId)) &&
((!rate.from && !rate.to) || (value.startRate >= rate.from && value.startRate <= rate.to)) &&
((!filterListGeo) || (filterListGeo.every(item => !item.checked)) || (filterListGeo.find(item => item.name === value.geozoneFrom).checked)) &&
((!filterListStatus) || (filterListStatus.every(item => !item.checked)) || (filterListStatus.find(item => item.name === value.status).checked)) &&
((!global.dateFromInterval.length) || (shippingDate >= shippingDateFrom && shippingDate <= shippingDateTo)) &&
((!global.dateToInterval.length) || (unloadDate >= unloadDateFrom && unloadDate <= unloadDateTo))
}
Функция настройки параметров фильтра. По каждому полю проходит проверка: либо фильтр отсутсвует, либо его настройки соовтетсвуют пользовательским.