function ComponentB(props) {
let [state, setState] = useState({ title: "ТАЙТЛ" });
return <div>{props.children({ state, setState, props })}</div>;
}
function ComponentA() {
return (
<ComponentB url="asd">
{(a) => (
<header>
{a.state.title}
{a.props.url}
</header>
)}
</ComponentB>
);
}
class CourseViewSet(viewsets.ModelViewSet):
queryset = Course.objects.filter(is_deleted=False)
serializer_class = CourseSerializer
swagger_tags = ["Course"]
def create(self, request, *args, **kwargs):
data = request.data
course = Course.objects.create(
name=data["name"],
description=data["description"],
information=data["information"],
author_id=data["author"]
)
course.save()
tags = set(data["tags"])
for tag in tags:
created_tag = Tags.objects.get_or_create(name=tag)[0]
course.tags.add(created_tag.id)
return Response(status=status.HTTP_201_CREATED)
def partial_update(self, request, *args, **kwargs):
course = Course.objects.get(id=int(kwargs["pk"]))
if request.user.id == course.author.id:
return super().partial_update(request, *args, **kwargs)
return Response(status=status.HTTP_403_FORBIDDEN)
authentication_classes = [JWTAuthentication]
class CourseViewSet(viewsets.ModelViewSet):
queryset = Course.objects.filter(is_deleted=False)
serializer_class = CourseSerializer
authentication_classes = [JWTAuthentication]
swagger_tags = ["Course"]
...
// Ждём, пока не будет элемента с name = q
WebElement foo = new WebDriverWait(driver, Duration.ofSeconds(3))
.until(driver -> driver.findElement(By.name("q")));
%include "io.inc"
section .data
arr db "genius" ; основная строка
len equ $-arr ; длина этой строки
section .bss
str2 resb 64 ; резирвирую память для развёрнутой строки
section .text
global CMAIN
CMAIN:
mov ebp, esp; for correct debugging
mov ebx, len
dec ebx
mov esi, 0
cycle:
cmp ebx, 0
jl end
mov al, byte[arr+ebx]
mov [str2+esi], al
inc esi
dec ebx
jmp cycle
end:
PRINT_STRING str2
xor eax, eax
ret
For Spring MVC 5, the Spring MVC DispatcherServlet has a dependency on the javax.servlet.* package namespace. This is using the Java EE 8 javax package naming. Since Tomcat 10 is based on Jakarta EE 9, the packages for javax naming are not supported. This explains why Spring MVC 5 does not work on Tomcat 10.
#!/usr/bin/bash
name=$1
nest generate module "$name"
nest generate controller "$name"
nest generate service "$name"
echo "import {Entity, PrimaryGeneratedColumn, Column} from \"typeorm\";
@Entity()
export class ${name^} {
@PrimaryGeneratedColumn()
id: number;
}" > "src/$name/$name.entity.ts"
<a href="{% url "check_resume" resume.client_id %}">Посмотреть</a>
<a href="{% url "check_resume" resume.pk %}">Посмотреть</a>
path('resumes/<slug:pk>', views.ResumesDetail.as_view(), name="check_resume"),
def get_form_kwargs(self):
kwargs = super().get_form_kwargs()
if self.request.method == "POST" and hasattr(self, 'object'):
data = kwargs["data"].dict()
data.update({"client_id": self.request.user.id})
kwargs["data"] = data
return kwargs
$("#root").on("click", (e) => {
console.log(e.target.tagName)
if (e.target.tagName === "DIV") {
let rng = document.createRange()
let sel = window.getSelection()
rng.selectNodeContents($(e.target)[0])
sel.removeAllRanges()
sel.addRange(rng)
}
})
function selectData() {
tName = $("#selectTabName").val()
$.getJSON(
"/select_data",
{"tableName": tName},
function(data) {
console.log(data)
}
)
}
@staticmethod
def paint_normal_distribution(mexp, otkl):
"""
Строит график кривой нормального распределения
"""
head = 0.4 / otkl
left = mexp - 3 * otkl
right = mexp + 3 * otkl
arr = np.arange(left, right, 0.001)
plt.plot(arr, norm.pdf(arr, mexp, otkl))
print("Левая граница = {}, правая граница = {}, высота = {}".format(left, right, head))
plt.show()
def read_csv(data):
with open("data.csv", "r") as csvfile:
file = csv.reader(csvfile, delimiter=";")
for row in file:
data.append(row)
print_data(data)
def write_csv(data):
with open("data.csv", "w") as csvfile:
wrt = csv.writer(csvfile, delimiter=";", quotechar="|", lineterminator="\r")
wrt.writerows(data)
struct s
{
string name;
int balli;
};
bool cmp(s a, s b) {
if (a.balli > b.balli)
return true;
else
if (a.balli == b.balli && a.name < b.name)
return true;
else
return false;
}