RewriteCond %{REQUEST_URI} ^/catalog/id/ [NC]
RewriteRule ^(.*)$ /catalog/#SECTION_CODE_PATH#/$1 [R=301,L]
ErrorDocument 404 /404.php
val imageView: ImageView = findViewById(R.id.imageView)
val bitmap = BitmapFactory.decodeByteArray(buffer, 0, image)
if (bitmap != null) {
imageView.minimumWidth = bitmap.width
imageView.minimumHeight = bitmap.height
val params: ViewGroup.LayoutParams = ViewGroup.LayoutParams(bitmap.width, bitmap.height)
imageView.layoutParams = params
imageView.setImageBitmap(bitmap)
}
function onTouched(Part)
if Part.Parent:FindFirstChild('Humanoid') then
local Gui = game:GetService('StarterGui'):WaitForChild('MainGui'):WaitForChild('MainFrame')
local Label = Gui:FindFirstChild('StagePlayer')
if Label then -- Добавленная проверка
Label.Text = 'Hi!'
print('Test')
end
end
end
script.Parent.Touched:Connect(onTouched)
function onTouched(Part)
if Part.Parent:FindFirstChild('Humanoid') then
local Gui = game:GetService('StarterGui'):WaitForChild('MainGui'):WaitForChild('MainFrame')
local Label = Gui:FindFirstChild('StagePlayer')
if Label then
Label.Text = 'Hi!'
print('Test')
else
warn('Label not found')
print(Gui:GetFullName())
for _, child in ipairs(Gui:GetChildren()) do
print(child.Name)
end
end
end
end
script.Parent.Touched:Connect(onTouched)
{
test: /\.s[ac]ss$/i,
use: [
{
loader: 'style-loader',
options: {
sourceMap: true,
},
},
{
loader: 'css-loader',
options: {
sourceMap: true,
modules: {
exportLocalsConvention: 'camelCase',
},
},
},
{
loader: 'sass-loader',
options: {
sourceMap: true,
},
},
{
loader: 'postcss-loader',
options: {
postcssOptions: {
parser: 'postcss-js',
},
execute: true,
},
},
],
},
public class MyService extends Service {
private int counter = 0;
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
Log.i("MyService", "onStartCommand() called. counter = " + counter);
// Увеличиваем значение счетчика
counter++;
// Возвращаем значение START_STICKY
return Service.START_STICKY;
}
@Override
public void onDestroy() {
super.onDestroy();
Log.i("MyService", "onDestroy() called.");
}
@Nullable
@Override
public IBinder onBind(Intent intent) {
return null;
}
}
createVar(name, line.slice(4).join(" ").replace(/[\[\]"']/gm, "").split(","));
createVar(name, JSON.parse(line.slice(4).join(" ")));
<div class="col-8">
<Microsoft.AspNetCore.Components.Forms.InputFile OnChange="HandleSelection"></Microsoft.AspNetCore.Components.Forms.InputFile>
</div>
$url = get_url($url, $value, $name, $inBlock, $req, $hideLabel, $template);
$url = get_url(str_replace('/year/', '/', $url), $value, $name, $inBlock, $req, $hideLabel, $template);
endpoint.SetTimeout(TimeSpan.FromMinutes(5));
<C-r>= float(@l) / float(@h)
@Override
protected void onPostExecute(String s) {
try {
JSONObject jsonObject = new JSONObject(s);
JSONArray parsedArray = jsonObject.getJSONArray("parsed");
for (int i = 0; i < parsedArray.length(); i++) {
JSONObject parsedObject = parsedArray.getJSONObject(i);
JSONObject foodObject = parsedObject.getJSONObject("food");
FoodModels model = new FoodModels();
model.setName(foodObject.getString("label"));
model.setImg(foodObject.getString("image"));
model.setKcal(foodObject.getJSONObject("nutrients").getString("ENERC_KCAL"));
model.setProcent(foodObject.getJSONObject("nutrients").getString("PROCNT"));
model.setFat(foodObject.getJSONObject("nutrients").getString("FAT"));
model.setChocdf(foodObject.getJSONObject("nutrients").getString("CHOCDF"));
model.setFidtg(foodObject.getJSONObject("nutrients").getString("FIBTG"));
foodModelsList.add(model);
}
} catch (JSONException e) {
e.printStackTrace();
}
PutDataIntoRecyclerView(foodModelsList);
}
const product = await prisma.product.create({
data: {
title: productName,
slug: slugify(productName, { locale: 'ru', lower: true }),
description: faker.commerce.productDescription(),
price: +faker.commerce.price(350, 9900, 0),
images: Array.from({
length: faker.datatype.number({ min: 2, max: 7 }),
}).map(() => faker.image.imageUrl()),
category: {
create: {
title: categoryName,
slug: slugify(categoryName, { locale: 'ru', lower: true }),
// Добавьте slug в качестве аргумента для CategoryCreateInput
},
},
reviews: {
create: [
{
rating: faker.datatype.number({ min: 1, max: 5 }),
text: faker.lorem.paragraph(),
user: {
connect: { id: 1 },
},
},
{
rating: faker.datatype.number({ min: 1, max: 5 }),
text: faker.lorem.paragraph(),
user: {
connect: { id: 1 },
},
},
],
},
},
});
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<div class="w-[calc(theme('width.1/4')-theme('spacing.4'))]">Lorem ipsum</div>
<div class="w-[calc(theme('width.1/4')*100/theme('width.container')-theme('spacing.4'))]">Lorem ipsum</div>
add_action( 'woocommerce_before_shop_loop_item_title', 'maudern_remove_product_badges_wrapper', 5 );
function maudern_remove_product_badges_wrapper() {
remove_action( 'woocommerce_before_shop_loop_item_title', 'maudern_product_badges_wrapper_open', 5 );
remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_show_product_loop_sale_flash', 6 );
remove_action( 'woocommerce_before_shop_loop_item_title', 'maudern_product_badges_wrapper_close', 8 );
add_action( 'woocommerce_before_shop_loop_item_title', 'maudern_add_product_badges_wrapper', 5 );
}
function maudern_add_product_badges_wrapper() {
echo '<div class="wrap">';
maudern_product_badges_wrapper_open();
woocommerce_show_product_loop_sale_flash();
maudern_product_badges_wrapper_close();
echo '</div>';
}
async getCommentsChildren(kids: number[], id: number, children: IComment[]) {
const data: IComment[] = [];
if (kids === undefined) return;
for (const item of kids) {
const response = await api.get<IComment>(
`https://hacker-news.firebaseio.com/v0/item/${item}.json`
);
data.push(response);
}
const recursFunc = (comments: IComment[]) => {
if (!comments) return;
for (let i = 0; i < comments.length; i++) {
comments[i].children = data;
if (comments[i].kids.length) {
recursFunc(comments[i].children);
}
}
return comments;
};
runInAction(() => {
this.comments = recursFunc(children);
});
}
const RecursiveComponent: FC<IRecursiveProps> = observer(({ data, getChildren }) => {
if (!Array.isArray(data)) {
return null; // or any fallback component or message
}
return (
<div>
{data.map((parent: any) => {
return <Comment parent={parent} getChildren={getChildren} data={data} />;
})}
</div>
);
});
# service.py
def create_dish(dish: schemas.DishCreate, submenu_title: str, db: Session):
submenu = db_requests.get_submenu_by_title(submenu_title, db)
if not submenu:
raise HTTPException(status_code=404, detail="Submenu not found.")
dish_in_db = db_requests.get_dish_by_title(dish.title, db)
if dish_in_db:
raise HTTPException(status_code=409, detail="Dish already exists.")
return db_requests.create_dish(dish, submenu.id, db)
# db_requests.py
def create_dish(dish: schemas.DishCreate, submenu_id: uuid.UUID, db: Session):
new_dish = models.Dish(title=dish.title,
description=dish.description,
price=dish.price,
submenu_id=submenu_id)
db.add(new_dish)
db.flush()
add_one_dish_to_the_quantity(submenu_id, db)
db.commit()
return new_dish
def get_submenu_by_title(submenu_title: str, db: Session):
return db.query(models.Submenu).filter(models.Submenu.title == submenu_title).first()
def get_dish_by_title(dish_title: str, db: Session):
return db.query(models.Dish).filter(models.Dish.title == dish_title).first()
def add_one_dish_to_the_quantity(submenu_id: uuid.UUID, db: Session):
db.query(models.Submenu) \
.filter(models.Submenu.id == submenu_id) \
.update({"dishes_count": models.Submenu.dishes_count + 1})
# router.py
@dish_router.post("/", response_model=schemas.Dish,
status_code=status.HTTP_201_CREATED)
def create_dish(
dish: schemas.DishCreate,
submenu_title: str,
db: Session = Depends(get_db)):
new_dish = service.create_dish(dish, submenu_title, db)
return new_dish
# forms.py
self.helper.form_action = reverse('games_detail', kwargs={'currency_pk': submenu_id})
@bot.message_handler(content_types=['text', 'photo'])
def send(message):
if message.content_type == 'text':
bot.send_message(chat_id=channel_1_id, text=message.text)
elif message.content_type == 'photo':
photo_file_id = message.photo[-1].file_id
bot.send_photo(chat_id=channel_1_id, photo=photo_file_id)
from django.urls import reverse
class MyForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.form_method = 'post'
self.helper.form_action = reverse('games_detail', kwargs={'currency_pk': self.instance.pk})
class Meta:
model = MyModel
fields = '__all__'
public static void main(String[] args) throws MessagingException {
// Подключаемся к почтовому ящику
Store store = Session.getDefaultInstance(new Properties()).getStore("имя_протокола");
store.connect("хост", "логин", "пароль");
// Получаем папку
Folder folder = store.getFolder("inbox");
// Устанавливаем слушателя
folder.addMessageCountListener(new MessageCountListener() {
@Override
public void messagesAdded(MessageCountEvent messageCountEvent) {
Message[] messages = messageCountEvent.getMessages();
if(messages.length!=0){
for (Message s :
messages) {
try {
//System.out.println(messages.length);
new Downloader().download(s);
} catch (MessagingException e) {
throw new RuntimeException(e); //todo
} catch (IOException e) {
throw new RuntimeException(e); //todo
}
}
}
}
});
// Бесконечный цикл для ожидания событий
while (true) {
try {
Thread.sleep(1000); // Приостанавливаем выполнение на 1 секунду
} catch (InterruptedException e) {
// Обработка ошибок
}
}
}