@app.route('/add_comment/<int:id>', methods=['GET', 'POST'])
def add_comment(id):
if request.method == 'POST':
author_com = current_user.id
post_com = Cards.query.get(id)
text = request.form['text']
comment = Comments(text_comment=text, user_id=author_com, card_id=id) # Здесь указывается card_id=id
try:
db.session.add(comment)
db.session.commit()
flash("Комментарий успешно добавлен")
return redirect('index')
except:
flash("Ошибка при добавлении комментария")
return redirect('index')
else:
flash("Необходимо заполнить все поля")
return redirect('/index')
import sounddevice as sd
import numpy as np
duration = 5
fs = 44100
print("Запись...")
recording = sd.rec(int(duration * fs), samplerate=fs, channels=2)
sd.wait()
print("Запись завершена, воспроизведение...")
sd.play(recording, fs)
sd.wait()
<form action="upload.php" method="post" enctype="multipart/form-data">
<label for="file">Выберите изображение:</label>
<input type="file" name="file" id="file" required>
<button type="submit">Загрузить</button>
</form>
<?php
$target_dir = "img/";
$target_file = $target_dir . basename($_FILES["file"]["name"]);
$imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION));
$check = getimagesize($_FILES["file"]["tmp_name"]);
if($check !== false) {
if (file_exists($target_file)) {
echo "Файл уже существует.";
} else {
if ($_FILES["file"]["size"] > 2000000) {
echo "Файл слишком большой.";
} else {
$allowed_types = array('jpg', 'jpeg', 'png', 'gif');
if (in_array($imageFileType, $allowed_types)) {
move_uploaded_file($_FILES["file"]["tmp_name"], $target_file)
}
}
}
}
?>
markup = types.ReplyKeyboardRemove()
keyboard = types.InlineKeyboardMarkup()
btn = types.InlineKeyboardButton(text="btn", callback_data="btn")
keyboard.add(btn)
bot.send_message(message.from_user.id, "Клавиатура удалена", reply_markup=markup)
bot.send_message(message.from_user.id, "Выберите папку", reply_markup=keyboard)
import telebot
bot = telebot.TeleBot('7425704287:AAFLjh3xfdyJdcetwwQHuPaKkTwjD3Yo1bA')
@bot.message_handler(commands=['start'])
def start_handler(message):
bot.send_message(message.chat.id, 'Привет')
@bot.message_handler(commands=['help'])
def help_handler(message):
bot.send_message(message.chat.id, 'Help information', parse_mode='html')
bot.polling(none_stop=True)
@echo off
sui client split-coin --gas 0xadd7864f026906e79…09770cd752668e5ef0e9203b0fc81a ^
--coin-id 0xYGasCoinIdHere ^
--amounts 149996250001 ^
--gas-budget 1000000000
sui client call --package 0xfa9302fe83a1b717293ca0d4f80a9195e66ac3d401977df5b16f1aae00232ab9 ^
--module move_pump ^
--function buy ^
--type-args 0xd177f070ac9dc7ca9cf13107ff9bebc74b4606ab75dde706e9a6bfa78377de23::nsell::NSELL ^
--args 0xd746495d04a6119987c2b9334c5fefd7d8cff52a8a02a3ea4e3995b9a041ace4::3038839::true 0::0 ^
0x3f2d9f724f4a1ce5e71676448dc452be9a6243dac9c5b975a588c8c867066e92::1587827::true ^
904956798544794 ^
0x0000000000000000000000000000000000000000000000000000000000000006::1::false ^
--gas 0xadd7864f026906e79…09770cd752668e5ef0e9203b0fc81a ^
--gas-budget 1000000000
pause
import classNames from "classnames/bind";
import style from './style.module.scss'
import Image from "next/image";
import ProductItem from "@/components/product-item";
import Link from "next/link";
const cn = classNames.bind(style)
const getData = async () => {
const response = await fetch("http://localhost:9000/api/cart/qty");
if (!response.ok) {
throw new Error("Failed to fetch data");
}
return await response.json();
}
export default async function MainPage() {
const data = await getData();
return (
<div className={cn('main-page')}>
<div className={cn('title-section')}>
<div className={cn('title')}>
<p>
Уникальные изделия кубачинских мастеров
</p>
{/* Используем полученные данные */}
<p>{data.qty}</p>
</div>
</div>
<div className={cn('features')}>
<div className={cn('item')}>
<Image src={'/heart.png'} alt={'индивидуальный подход'} width={50} height={50} />
<span>Индивидуальный подход</span>
</div>
<div className={cn('item')}>
<Image src={'/hot-air-balloon.png'} alt={'индивидуальный подход'} width={50} height={50} />
<span>Доставка по всей России</span>
</div>
<div className={cn('item')}>
<Image src={'/diamond-ring.png'} alt={'индивидуальный подход'} width={50} height={50} />
<span>300+ изделий</span>
</div>
<div className={cn('item')}>
<Image src={'/shopping-store.png'} alt={'индивидуальный подход'} width={50} height={50} />
<span>Наш магазин открыт с 2003 года</span>
</div>
</div>
<div className={cn('products-catalog')}>
{[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12].map((el) => (
<Link className={cn('product-item-link')} href={`/jewellery-catalog/${el}`} key={el}>
<ProductItem />
</Link>
))}
</div>
</div>
)
}
const express = require('express');
const session = require('express-session');
const app = express();
app.use(session({
secret: 'your_secret_key',
resave: false,
saveUninitialized: true,
cookie: { secure: true }
}));
при переключении, например, правой стрелки, слайды двигаются слева направо, а пагинация (точки под слайдами), переключается справо налево. Можно как-то это исправить?
<Swiper
slidesPerView={4}
className={style.mySwiper}
loop={true}
allowTouchMove={false}
autoplay={{
delay: 0,
disableOnInteraction: false,
}}
speed={2000}
modules={[Autoplay, Loop]}
>
{partners.map((partner) => (
<SwiperSlide key={partner.id}>
<img
className={style.partnerImage}
src={partner.photo}
alt={`Partner ${partner.id}`}
/>
</SwiperSlide>
))}
</Swiper>
import os
import sys
import tkinter as tk
def resource_path(relative_path):
try:
base_path = sys._MEIPASS
except Exception:
base_path = os.path.abspath(".")
return os.path.join(base_path, relative_path)
root = tk.Tk()
icon_path = resource_path("icon.ico")
root.iconbitmap(icon_path)
root.mainloop()
php artisan cache:clear
php artisan config:clear
php artisan view:clear
php artisan route:clear
from PIL import ImageGrab
import io
screenshot = ImageGrab.grab()
byte_io = io.BytesIO()
screenshot.save(byte_io, format='PNG')
image_bytes = byte_io.getvalue()
import { React } from "react";
import { Routes, Route } from "react-router-dom";
import { Cart } from "./components/cart/Cart";
import { Catalog } from "./components/catalog/Catalog";
import { About } from "./pages/About";
import { MainPage } from "./components/mainPage/MainPage";
import { Page404 } from "./pages/Page404";
import { ProductPage } from "./components/productPage/ProductPage";
import { Menu } from "./components/menu/Menu";
import { Contacts } from "./pages/Contacts";
import { Footer } from "./UI/Footer";
import { Banner } from "./UI/Banner.jsx";
import { useDispatch } from "react-redux";
import { resetClicks } from "./app/store/searchBarSlice";
function App() {
const dispatch = useDispatch();
const hideMenuSearchBar = () => {
dispatch(resetClicks());
};
return (
<div className="App">
<Menu />
<main className="container" onClick={hideMenuSearchBar}>
<div className="row">
<div className="col">
<Banner />
<Routes basename="/test">
<Route path="/" exact element={<MainPage />} />
<Route path="/about" element={<About />} />
<Route path="/products/:prdId" element={<ProductPage />} />
<Route path="/cart" element={<Cart />} />
<Route path="/contacts" element={<Contacts />} />
<Route path="*" element={<Page404 />} />
<Route path="/:catId" element={<MainPage />} />
<Route path="/catalog/:catId?" element={<Catalog isCatalogPage={true} />} />
</Routes>
</div>
</div>
</main>
<Footer />
</div>
);
}
export default App;