бухгалтерия отмазывается на нехватку денег
enum Operation {
PLUS("+") {
double apply(double x, double y) { return x + y; }
},
MINUS("-") {
double apply(double x, double y) { return x - y; }
},
TIMES("*") {
double apply(double x, double y) { return x * y; }
},
DIVIDE("/") {
double apply(double x, double y) { return x / y; }
};
private final String symbol;
Operation(String symbol) {
this.symbol = symbol;
}
@Overrided
public String toString() {
return symbol;
}
abstract double apply(double x, double y);
}
public class Example {
public static void main(String[] args) {
double x = Double.parseDouble(args[0]);
double y = Double.parseDouble(args[1]);
for (Operation op : Operation.values())
System.out.printf("%f %s %f = %f%n", x, op, y, op.apply(x, y));
}
}
}
.section .data
hello_str:
.ascii "Hello, world!\n"
.set hello_str_length, . - hello_str
.section .text
.global main
.type main, @function
main:
movq $4, %rax
movq $1, %rbx
movq $hello_str, %rcx
movq $hello_str_length, %rdx
int $0x80
movq $1, %rax
movq $0, %rbx
int $0x80
.size main, . - main
.file "test.c"
.section .rodata
.LC0:
.string "Hello, World!"
.text
.globl main
.type main, @function
main:
.LFB0:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
subq $16, %rsp
movl %edi, -4(%rbp)
movq %rsi, -16(%rbp)
leaq .LC0(%rip), %rdi
call puts@PLT
movl $0, %eax
leave
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE0:
.size main, .-main
.ident "GCC: (Debian 6.3.0-18) 6.3.0 20170516"
.section .note.GNU-stack,"",@progbits
const unsigned int MAX_LENGTH = 1 * 1024 * 1024; // Не выделять больше мегабайта памяти
const unsigned int CHUNK_SIZE = 1024; // Выделять блоками по килобайту
int main() {
unsigned int str_len = CHUNK_SIZE;
char *str_ptr = malloc(CHUNK_SIZE); // Выделяем первый килобайтный блок
if (str_ptr == NULL)
err(EXIT_FAILURE, "Не удалось выделить память!\n");
int c;
unsigned int i;
for (i = 0, c = EOF; (c = getchar()) != '\n' && c != EOF; i++) {
str_ptr[i] = c;
if (i == MAX_LENGTH) {
free(str_ptr);
err(EXIT_FAILURE, "Слишком много входных данных!\n");
}
if (i == str_len) { // Блок заполнен
str_len = i + CHUNK_SIZE;
str_ptr = realloc(str_ptr, str_len); // Расширяем блок на ещё один килобайт
}
}
str_ptr[i] = '\0'; // Признак конца строки
printf("%s\n", str_ptr);
free(str_ptr);
str_ptr = NULL;
return EXIT_SUCCESS;
}
from django.utils.encoding import escape_uri_path
response['Content-Disposition'] = "attachment; filename=*=UTF-8''"+ escape_uri_path(myfile)