row_id
int64
0
48.4k
init_message
stringlengths
1
342k
conversation_hash
stringlengths
32
32
scores
dict
12,756
As a Python developer, this code is a telegram bot based on Python-telegram-bot version 3.17. Please find fix the issue: error is:
4494a582a043a5c969973adc83aed487
{ "intermediate": 0.39298802614212036, "beginner": 0.3178977370262146, "expert": 0.28911417722702026 }
12,757
Produce code for a function in Python, taking a list of contracts as input (contracts each have a name, a start, a duration, and a value), returning two results: a path (as a list of contract names) describing the selection of highest value, in order, of contracts that do not overlap ; and how much value this path accumulates. The function should have linear complexity, if possible.
e41ba82558bdb0b1274225d1d1803b74
{ "intermediate": 0.3719262480735779, "beginner": 0.17537921667099, "expert": 0.45269453525543213 }
12,758
Can you provide an implementation of bisect_right in python ?
2b9698dfd781887e4644ebc771558718
{ "intermediate": 0.5348352789878845, "beginner": 0.06058374419808388, "expert": 0.4045810103416443 }
12,759
How to read first byte from a bytearray
e3f0191e8668941f36d26e89f6060ba8
{ "intermediate": 0.3207409083843231, "beginner": 0.19181141257286072, "expert": 0.48744767904281616 }
12,760
Produce linear complexity code for a function in Python, taking a list of contracts as input (a contract is a TypedDict with a "name", a "start" time, a "duration", and a "price" integer), returning two results: a path (as a list of contract names in start order) describing the selection of contracts which sum to the highest possible price out of all possible selections of contracts ; and how much value this optimal path accumulates.
05907945bf705b9cf8e6db465d4e52bc
{ "intermediate": 0.3203073740005493, "beginner": 0.16480280458927155, "expert": 0.5148898363113403 }
12,761
async findAll(queryParams: IItemQueryParams): Promise<ItemEntity[]> { const query: FindManyOptions<ItemEntity> = { where: { status: ItemStatus.REMOVED, }, relations: ['category', 'events', 'location'], order: { cost: queryParams.sortByCost }, }; if (queryParams.eventId) { query.where['events.id'] = queryParams.eventId; } if (queryParams.regoNumber) { query.where.regoNumber = queryParams.regoNumber; } if (queryParams.name) { query.where.name = queryParams.name; } if (queryParams.charityList) { query.where.charityList = queryParams.charityList; } if (queryParams.notes) { query.where.notes = queryParams.notes; } if (queryParams.provenance) { query.where.provenance = queryParams.provenance; } if (queryParams.category) { query.where['category.name'] = queryParams.category; } if (queryParams.subcategory) { query.where['category.subCategories'] = queryParams.subcategory; } if (queryParams.status) { query.where.status = queryParams.status; } if (queryParams.costFrom) { query.where.cost = query.where.cost || {}; query.where.cost.$gte = queryParams.costFrom; } if (queryParams.costTo) { query.where.cost = query.where.cost || {}; query.where.cost.$lte = queryParams.costTo; } if (queryParams.locationId) { query.where['location.id'] = queryParams.locationId; } return this.itemRepository.find(query); } i keep getting the following errors when i run the above code ^ TSError: ⨯ Unable to compile TypeScript: src/modules/items/item.service.ts:166:25 - error TS2339: Property 'regoNumber' does not exist on type 'FindOptionsWhere<ItemEntity> | FindOptionsWhere<ItemEntity>[]'. Property 'regoNumber' does not exist on type 'FindOptionsWhere<ItemEntity>[]'. 166 query.where.regoNumber = queryParams.regoNumber; ~~~~~~~~~~ src/modules/items/item.service.ts:170:25 - error TS2339: Property 'name' does not exist on type 'FindOptionsWhere<ItemEntity> | FindOptionsWhere<ItemEntity>[]'. Property 'name' does not exist on type 'FindOptionsWhere<ItemEntity>[]'. 170 query.where.name = queryParams.name; ~~~~ src/modules/items/item.service.ts:174:25 - error TS2339: Property 'charityList' does not exist on type 'FindOptionsWhere<ItemEntity> | FindOptionsWhere<ItemEntity>[]'. Property 'charityList' does not exist on type 'FindOptionsWhere<ItemEntity>[]'. 174 query.where.charityList = queryParams.charityList; ~~~~~~~~~~~ src/modules/items/item.service.ts:178:25 - error TS2339: Property 'notes' does not exist on type 'FindOptionsWhere<ItemEntity> | FindOptionsWhere<ItemEntity>[]'. Property 'notes' does not exist on type 'FindOptionsWhere<ItemEntity>[]'. 178 query.where.notes = queryParams.notes; ~~~~~ src/modules/items/item.service.ts:182:25 - error TS2339: Property 'provenance' does not exist on type 'FindOptionsWhere<ItemEntity> | FindOptionsWhere<ItemEntity>[]'. Property 'provenance' does not exist on type 'FindOptionsWhere<ItemEntity>[]'. 182 query.where.provenance = queryParams.provenance; ~~~~~~~~~~ src/modules/items/item.service.ts:194:25 - error TS2339: Property 'status' does not exist on type 'FindOptionsWhere<ItemEntity> | FindOptionsWhere<ItemEntity>[]'. Property 'status' does not exist on type 'FindOptionsWhere<ItemEntity>[]'. 194 query.where.status = queryParams.status; ~~~~~~ src/modules/items/item.service.ts:198:25 - error TS2339: Property 'cost' does not exist on type 'FindOptionsWhere<ItemEntity> | FindOptionsWhere<ItemEntity>[]'. Property 'cost' does not exist on type 'FindOptionsWhere<ItemEntity>[]'. 198 query.where.cost = query.where.cost || {}; ~~~~ src/modules/items/item.service.ts:198:44 - error TS2339: Property 'cost' does not exist on type 'FindOptionsWhere<ItemEntity> | FindOptionsWhere<ItemEntity>[]'. Property 'cost' does not exist on type 'FindOptionsWhere<ItemEntity>[]'. 198 query.where.cost = query.where.cost || {}; ~~~~ src/modules/items/item.service.ts:199:25 - error TS2339: Property 'cost' does not exist on type 'FindOptionsWhere<ItemEntity> | FindOptionsWhere<ItemEntity>[]'. Property 'cost' does not exist on type 'FindOptionsWhere<ItemEntity>[]'. 199 query.where.cost.$gte = queryParams.costFrom; ~~~~ src/modules/items/item.service.ts:203:25 - error TS2339: Property 'cost' does not exist on type 'FindOptionsWhere<ItemEntity> | FindOptionsWhere<ItemEntity>[]'. Property 'cost' does not exist on type 'FindOptionsWhere<ItemEntity>[]'. 203 query.where.cost = query.where.cost || {}; ~~~~ src/modules/items/item.service.ts:203:44 - error TS2339: Property 'cost' does not exist on type 'FindOptionsWhere<ItemEntity> | FindOptionsWhere<ItemEntity>[]'. Property 'cost' does not exist on type 'FindOptionsWhere<ItemEntity>[]'. 203 query.where.cost = query.where.cost || {}; ~~~~ src/modules/items/item.service.ts:204:25 - error TS2339: Property 'cost' does not exist on type 'FindOptionsWhere<ItemEntity> | FindOptionsWhere<ItemEntity>[]'. Property 'cost' does not exist on type 'FindOptionsWhere<ItemEntity>[]'. 204 query.where.cost.$lte = queryParams.costTo; here is me interface import { ItemStatus } from '../entities/item.entity'; export interface IItemQueryParams { eventId?: number; regoNumber?: string; name?: string; charityList?: string; notes?: string; provenance?: string; category?: string; subcategory?: string; status?: ItemStatus; costFrom?: number; costTo?: number; locationId?: number; sortByCost?: 'ASC' | 'DESC'; } and entity import { Column, Entity, JoinTable, ManyToMany, ManyToOne } from 'typeorm'; import { AbstractIdEntity } from '../../../common/abstract.id.entity'; import { CategoryEntity } from '../../categories/entities/category.entity'; import { EventEntity } from '../../event/entities/event.entity'; import { LocationEntity } from '../../location/entities/location.entity'; import { ItemDto } from '../dto/item.dto'; export enum ItemStatus { NEW = 'NEW', ALLOCATED = 'ALLOCATED', SENT_TO_EVENT = 'SENT_TO_EVENT', SOLD = 'SOLD', SENT_TO_CLIENT = 'SENT_TO_CLIENT', DAMAGED = 'DAMAGED', REMOVED = 'REMOVED', } @Entity({ name: 'item' }) export class ItemEntity extends AbstractIdEntity<ItemDto> { @Column({ nullable: false }) name: string; @ManyToOne(() => LocationEntity, { nullable: false }) location: LocationEntity; @ManyToOne(() => CategoryEntity, { nullable: false }) category: CategoryEntity; @Column({ nullable: true }) charityList: string; @Column({ nullable: true }) cost: number; @Column({ nullable: true }) reserveCost: number; @Column({ nullable: true }) framingCost: number; @Column({ nullable: true }) provenance: string; @Column({ nullable: true }) wrc: number; @Column({ nullable: true }) regoNumber: string; @Column({ nullable: true }) notes: string; @Column({ nullable: false, default: 'NEW' }) status: ItemStatus; @ManyToMany(() => EventEntity, (event) => event.items, { nullable: true, cascade: true, }) @JoinTable({ name: 'item_events', joinColumn: { name: 'item_id', referencedColumnName: 'id' }, inverseJoinColumn: { name: 'event_id', referencedColumnName: 'id' }, }) events: EventEntity[]; @Column({ nullable: true }) eventId: number; dtoClass = ItemDto; }
5d111ab295f0f5263d7eb37dc244e573
{ "intermediate": 0.29075881838798523, "beginner": 0.5124825835227966, "expert": 0.19675861299037933 }
12,762
Produce linear complexity code for a function in Python, taking a list of possibly overlapping contracts as input (a contract is a TypedDict with a “name”, a “start” time, a “duration”, and a “price” integer), returning two results: a path (as a list of contract names in start order) describing the selection of non-overlapping contracts which sum to the highest possible price out of all possible selections of non-overlapping contracts ; and how much value this optimal path accumulates.
19fb19cf152584a41cf2340e56e146f8
{ "intermediate": 0.3256393074989319, "beginner": 0.13930152356624603, "expert": 0.5350592136383057 }
12,763
how do you know when to pronounce 'the' with a short or long 'e'?
fc501dc601253ff74e35dd3b38a422a7
{ "intermediate": 0.30267149209976196, "beginner": 0.40093207359313965, "expert": 0.296396404504776 }
12,764
I ask questions about Rugby Union, ready?
d5e6eb7734cfe8b253b8f083d9697785
{ "intermediate": 0.3782109022140503, "beginner": 0.35773199796676636, "expert": 0.26405712962150574 }
12,765
Produce linear complexity code for a function in Python, taking a list of possibly overlapping contracts as input (a contract is a TypedDict with a “name”, a “start” time, a “duration”, and a “price” integer), returning two results: a path (as a list of contract names in start order) describing the selection of non-overlapping contracts which sum to the highest possible price out of all possible selections of non-overlapping contracts ; and how much value this optimal path accumulates.
1d5a5bb3c9e83ff4c5ea8b39e51abec3
{ "intermediate": 0.3256393074989319, "beginner": 0.13930152356624603, "expert": 0.5350592136383057 }
12,766
hi
64a241c10465386ec100d393b5840fdf
{ "intermediate": 0.3246487081050873, "beginner": 0.27135494351387024, "expert": 0.40399640798568726 }
12,767
Does the NSA spy on webcams without user consent?
59a4bb07af2a30f0c04ab13bf4bcbaa9
{ "intermediate": 0.36965158581733704, "beginner": 0.3145366907119751, "expert": 0.31581172347068787 }
12,768
collections in hospital
8c257713214673876e95c1f433be99ca
{ "intermediate": 0.3843187391757965, "beginner": 0.3558942377567291, "expert": 0.25978702306747437 }
12,769
hi
e97b7ba2b5a9f61342b160cce2aad21c
{ "intermediate": 0.3246487081050873, "beginner": 0.27135494351387024, "expert": 0.40399640798568726 }
12,770
what is the best weapon in escape of tarkov?
51413cd932cc027f6b6edc258874b9eb
{ "intermediate": 0.29753655195236206, "beginner": 0.37061741948127747, "expert": 0.3318459987640381 }
12,771
Can you provide a code implementation in Nim of rollback based netcode for a game, assuming a deterministic game simulation that allows using only inputs for synchronization (similar to GGPO). This implementation can assume some functions to be already provided elsewhere: a game state serialization function, a game state deserialization function, and a frame advancing function.
69cb5dcf8eb0ae5b0278813c9a567a02
{ "intermediate": 0.27034318447113037, "beginner": 0.12482912838459015, "expert": 0.6048277020454407 }
12,772
i wanna use a !curl -Lo but with archive from google drive and if isnt possible what site i could use to do it
22e24cb37f88c2472e8ca769fddb76a6
{ "intermediate": 0.4030681252479553, "beginner": 0.3485713303089142, "expert": 0.2483605444431305 }
12,773
Write a C program that searches for processes in the process tree (rooted at a specified process) and outputs the requested information based on the input parameters. Synopsis : prcinfo [root_process] [process_id1] [process_id2]... [process_id(n)] [OPTION] - 1>=n<=5 - Lists the PID and PPID of each process_id(n) if process_id(n) belongs to the process tree rooted at root_process - root_process is the PID of a process that is a descendant of the current bash process. - process_id(n) is the PID of a process that is a descendant of the current bash process. OPTION -nd additionally lists the PIDs of all the non-direct descendants of process_id1(only) -dd additionally lists the PIDs of all the immediate descendants of process_id1 -sb additionally lists the PIDs of all the sibling processes of process_id1 -sz additionally Lists the PIDs of all sibling processes of process_id1 that are defunct -gc additionally lists the PIDs of all the grandchildren of process_id1 - zz additionally prints the status of process_id1 (Defunct/ Not Defunct) - zc additionally lists the PIDs of all the direct descendants of process_id1 that are currently in the defunct state
4e21ffb120f5f540368551f8b4861891
{ "intermediate": 0.3214094638824463, "beginner": 0.4050624668598175, "expert": 0.27352800965309143 }
12,774
Write a code that, when entering the address of a token contract, will display its listing date. The token is on the BSC network. Use APIKey. To determine the date of the start of trading, be guided by the following transaction methods at the address of the creator of the contract: "0xe8e33700": "Add Liquidity", "0xf305d719": "Add Liquidity ETH", "0xeaaed442": "Add Liquidity BNB", "0x4bb278f3": "finalize", "0x8a8c523c": "Enable Trading", "0xc9567bf9": "Open Trading"
650fd389a83bf72f9388099fb95a5c08
{ "intermediate": 0.49083223938941956, "beginner": 0.2783525288105011, "expert": 0.23081523180007935 }
12,775
Can you provide the Nim code implementation of a time synchronization function between multiple computers, assuming you only have access to a local timestamp function and functions to send reliably over UDP?
3438b7e4a7a8f06a47e9ceb593876b3f
{ "intermediate": 0.4944479465484619, "beginner": 0.12813794612884521, "expert": 0.37741416692733765 }
12,776
write code to gp tp Y:\XL_Data\INV GRADE TEAM\Monthly Commentary\Monthly Data Tracker
3ef28e17044c21dc2362b0fb51781498
{ "intermediate": 0.3547557592391968, "beginner": 0.24000754952430725, "expert": 0.4052366614341736 }
12,777
import requests import json import datetime APIKey = 'CXTB4IUT31N836G93ZI3YQBEWBQEGGH5QS' contract_address = input("Enter the token contract address: ") bsc_api_base_url = 'https://api.bscscan.com/api' def get_creator_address(contract_address): params = { 'module': 'contract', 'action': 'getsourcecode', 'address': contract_address, 'apikey': APIKey } response = requests.get(bsc_api_base_url, params=params) if response.status_code == 200: content = json.loads(response.text) if content['status'] == '1': return content['result'][0]['ContractCreator'] return None def get_listing_date(creator_address): params = { 'module': 'account', 'action': 'txlist', 'address': creator_address, 'sort': 'asc', 'apikey': APIKey } response = requests.get(bsc_api_base_url, params=params) if response.status_code == 200: content = json.loads(response.text) if content['status'] == '1': transactions = content['result'] for tx in transactions: if tx['input'][:10] in ['0xe8e33700', '0xf305d719', '0xeaaed442', '0x4bb278f3', '0x8a8c523c', '0xc9567bf9']: timestamp = int(tx['timeStamp']) listing_date = datetime.datetime.fromtimestamp( timestamp).strftime(' %Y - %m - % d % H: % M: %S') return listing_date return None creator_address = get_creator_address(contract_address) if creator_address: listing_date = get_listing_date(creator_address) if listing_date: print("Token listing date:", listing_date) else: print("Error: Listing date not found") else: print("Error: Creator address not found") The code above gives an error C:\Users\AshotxXx\PycharmProjects\TokenAge\TokenAgeTrading\venv\Scripts\python.exe C:\Users\AshotxXx\PycharmProjects\TokenAge\TokenAgeTrading\main.py Enter the token contract address: 0x0a45eBdF0ba2Bd005C32AbeEf1BB534c563c146A Traceback (most recent call last): File "C:\Users\AshotxXx\PycharmProjects\TokenAge\TokenAgeTrading\main.py", line 48, in <module> creator_address = get_creator_address(contract_address) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\AshotxXx\PycharmProjects\TokenAge\TokenAgeTrading\main.py", line 21, in get_creator_address return content['result'][0]['ContractCreator'] ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^ KeyError: 'ContractCreator' Process finished with exit code 1 Fix it
aa8bab4a865596ecc9afb05c7e70baba
{ "intermediate": 0.3501255512237549, "beginner": 0.4471161961555481, "expert": 0.20275820791721344 }
12,778
I’m building a video game engine using C++ as the coding language and Vulkan for graphics. I am trying to set up a generic renderer using Vulkan that is flexible and will render objects based on a vector that is supplied to it. The renderer will also handle the creation of the window using GLFW and use GLM for all relevant math calls. I am using the ASSIMP library to load 3d models and animations. I am in the process of converting the codebase from using vulkan.h to vulkan.hpp, as well as utilising RAII. Here is the new header for the BufferUtils class: BufferUtils.h: #pragma once #include <vulkan/vulkan.hpp> namespace BufferUtils { void CreateBuffer( vk::Device device, vk::PhysicalDevice physicalDevice, vk::DeviceSize size, vk::BufferUsageFlags usage, vk::MemoryPropertyFlags properties, vk::Buffer& buffer, vk::DeviceMemory& bufferMemory); uint32_t FindMemoryType(vk::PhysicalDevice physicalDevice, uint32_t typeFilter, vk::MemoryPropertyFlags properties); void CopyBuffer( vk::Device device, vk::CommandPool commandPool, vk::Queue graphicsQueue, vk::Buffer srcBuffer, vk::Buffer dstBuffer, vk::DeviceSize size); } Can you update the following code of the Texture class to utilise vulkan.hpp, RAII and align with the BufferUtils class? Texture.h: #pragma once #include <vulkan/vulkan.h> #include "stb_image.h" // Include the stb_image header #include "BufferUtils.h" #include <string> class Texture { public: Texture(); ~Texture(); void LoadFromFile(const std::string& filename, VkDevice device, VkPhysicalDevice physicalDevice, VkCommandPool commandPool, VkQueue graphicsQueue); VkImageView GetImageView() const; VkSampler GetSampler() const; void Cleanup(); private: VkDevice device; VkImage image; VkDeviceMemory imageMemory; VkImageView imageView; VkSampler sampler; VkPhysicalDevice physicalDevice; VkCommandPool commandPool; VkQueue graphicsQueue; bool initialized = false; void CreateImage(uint32_t width, uint32_t height, uint32_t mipLevels, VkSampleCountFlagBits numSamples, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage, VkMemoryPropertyFlags properties); void TransitionImageLayout(VkImageLayout oldLayout, VkImageLayout newLayout, uint32_t mipLevels, VkSampleCountFlagBits numSamples); void CopyBufferToImage(VkBuffer buffer, uint32_t width, uint32_t height); void CreateImageView(VkFormat format, VkImageAspectFlags aspectFlags, uint32_t mipLevels); void CreateSampler(uint32_t mipLevels); void GenerateMipmaps(uint32_t width, uint32_t height, uint32_t mipLevels); VkCommandBuffer BeginSingleTimeCommands(VkCommandPool commandPool, VkDevice device); void EndSingleTimeCommands(VkCommandPool commandPool, VkQueue graphicsQueue, VkDevice device, VkCommandBuffer commandBuffer); }; A portion of Texture.cpp: #include "Texture.h" #include "BufferUtils.h" #include <iostream> Texture::Texture() : device(VK_NULL_HANDLE), image(VK_NULL_HANDLE), imageMemory(VK_NULL_HANDLE), imageView(VK_NULL_HANDLE), sampler(VK_NULL_HANDLE) { } Texture::~Texture() { Cleanup(); } void Texture::LoadFromFile(const std::string& filename, VkDevice device, VkPhysicalDevice physicalDevice, VkCommandPool commandPool, VkQueue graphicsQueue) { this->device = device; this->physicalDevice = physicalDevice; this->commandPool = commandPool; this->graphicsQueue = graphicsQueue; this->initialized = true; // Load image from file using stb_image int width, height, channels; stbi_uc* pixels = stbi_load(filename.c_str(), &width, &height, &channels, STBI_rgb_alpha); if (!pixels) { throw std::runtime_error("Failed to load texture image!"); } // Calculate the number of mip levels uint32_t mipLevels = static_cast<uint32_t>(std::floor(std::log2(std::max(width, height)))) + 1; VkDeviceSize imageSize = width * height * 4; VkBuffer stagingBuffer; VkDeviceMemory stagingBufferMemory; // Create the staging buffer for transferring image data BufferUtils::CreateBuffer(device, physicalDevice, imageSize, VK_BUFFER_USAGE_TRANSFER_SRC_BIT, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT, stagingBuffer, stagingBufferMemory); // Copy image data to the buffer void* bufferData; vkMapMemory(device, stagingBufferMemory, 0, imageSize, 0, &bufferData); memcpy(bufferData, pixels, static_cast<size_t>(imageSize)); vkUnmapMemory(device, stagingBufferMemory); stbi_image_free(pixels); // Free the stb_image buffer // Create vkImage, copy buffer to image, and create imageView and sampler CreateImage(width, height, mipLevels, VK_SAMPLE_COUNT_1_BIT, VK_FORMAT_R8G8B8A8_SRGB, VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT); CreateImageView(VK_FORMAT_R8G8B8A8_SRGB, VK_IMAGE_ASPECT_COLOR_BIT, mipLevels); CreateSampler(mipLevels); TransitionImageLayout(VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, mipLevels, VK_SAMPLE_COUNT_1_BIT); CopyBufferToImage(stagingBuffer, width, height); GenerateMipmaps(width, height, mipLevels); // Cleanup the staging buffer and staging buffer memory vkDestroyBuffer(device, stagingBuffer, nullptr); vkFreeMemory(device, stagingBufferMemory, nullptr); } void Texture::Cleanup() { if (!initialized) { return; } if (sampler != VK_NULL_HANDLE) { vkDestroySampler(device, sampler, nullptr); sampler = VK_NULL_HANDLE; } if (imageView != VK_NULL_HANDLE) { vkDestroyImageView(device, imageView, nullptr); imageView = VK_NULL_HANDLE; } if (image != VK_NULL_HANDLE) { vkDestroyImage(device, image, nullptr); image = VK_NULL_HANDLE; } if (imageMemory != VK_NULL_HANDLE) { vkFreeMemory(device, imageMemory, nullptr); imageMemory = VK_NULL_HANDLE; } initialized = false; } VkImageView Texture::GetImageView() const { return imageView; } VkSampler Texture::GetSampler() const { return sampler; } void Texture::CreateImage(uint32_t width, uint32_t height, uint32_t mipLevels, VkSampleCountFlagBits numSamples, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage, VkMemoryPropertyFlags properties) { VkImageCreateInfo imageInfo{}; imageInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO; imageInfo.imageType = VK_IMAGE_TYPE_2D; imageInfo.extent.width = width; imageInfo.extent.height = height; imageInfo.extent.depth = 1; imageInfo.mipLevels = mipLevels; imageInfo.arrayLayers = 1; imageInfo.format = format; imageInfo.tiling = tiling; imageInfo.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; imageInfo.usage = usage; imageInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE; imageInfo.samples = numSamples; imageInfo.flags = 0; if (vkCreateImage(device, &imageInfo, nullptr, &image) != VK_SUCCESS) { throw std::runtime_error("Failed to create image!"); } VkMemoryRequirements memRequirements; vkGetImageMemoryRequirements(device, image, &memRequirements); VkMemoryAllocateInfo allocInfo{}; allocInfo.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO; allocInfo.allocationSize = memRequirements.size; allocInfo.memoryTypeIndex = BufferUtils::FindMemoryType(physicalDevice, memRequirements.memoryTypeBits, properties); if (vkAllocateMemory(device, &allocInfo, nullptr, &imageMemory) != VK_SUCCESS) { throw std::runtime_error("Failed to allocate image memory!"); } vkBindImageMemory(device, image, imageMemory, 0); } void Texture::TransitionImageLayout(VkImageLayout oldLayout, VkImageLayout newLayout, uint32_t mipLevels, VkSampleCountFlagBits numSamples) { // Create a one-time-use command buffer VkCommandBufferAllocateInfo allocInfo{}; allocInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO; allocInfo.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY; allocInfo.commandPool = commandPool; allocInfo.commandBufferCount = 1; VkCommandBuffer commandBuffer; vkAllocateCommandBuffers(device, &allocInfo, &commandBuffer); VkCommandBufferBeginInfo beginInfo{}; beginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO; beginInfo.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT; vkBeginCommandBuffer(commandBuffer, &beginInfo); VkImageMemoryBarrier barrier{}; barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; barrier.oldLayout = oldLayout; barrier.newLayout = newLayout; barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; barrier.image = image; barrier.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; barrier.subresourceRange.baseMipLevel = 0; barrier.subresourceRange.levelCount = mipLevels; barrier.subresourceRange.baseArrayLayer = 0; barrier.subresourceRange.layerCount = 1; VkPipelineStageFlags sourceStage; VkPipelineStageFlags destinationStage; if (oldLayout == VK_IMAGE_LAYOUT_UNDEFINED && newLayout == VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL) { barrier.srcAccessMask = 0; barrier.dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; sourceStage = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT; destinationStage = VK_PIPELINE_STAGE_TRANSFER_BIT; } else if (oldLayout == VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL && newLayout == VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL) { barrier.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; barrier.dstAccessMask = VK_ACCESS_SHADER_READ_BIT; sourceStage = VK_PIPELINE_STAGE_TRANSFER_BIT; destinationStage = VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT; } else { throw std::invalid_argument("Unsupported layout transition!"); } vkCmdPipelineBarrier( commandBuffer, sourceStage, destinationStage, 0, 0, nullptr, 0, nullptr, 1, &barrier ); // End command buffer recording vkEndCommandBuffer(commandBuffer); // Submit command buffer VkSubmitInfo submitInfo{}; submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO; submitInfo.commandBufferCount = 1; submitInfo.pCommandBuffers = &commandBuffer; vkQueueSubmit(graphicsQueue, 1, &submitInfo, VK_NULL_HANDLE); vkQueueWaitIdle(graphicsQueue); // Free command buffer vkFreeCommandBuffers(device, commandPool, 1, &commandBuffer); }
2ccb08301cc06b2dbd99c3741926f70f
{ "intermediate": 0.44066715240478516, "beginner": 0.3269985616207123, "expert": 0.23233434557914734 }
12,779
Write a code that, when entering the address of a contract, will display the address of the creator of this contract. Contract in the BSC network. Use APIKey
530500be89dddbbf1437fa6ff98042b1
{ "intermediate": 0.6269084215164185, "beginner": 0.10665776580572128, "expert": 0.2664338946342468 }
12,780
You are an AI programming assistant. - Follow the user's requirements carefully and to the letter. - First think step-by-step- describe your plan for what to build in pseudocode, written out in great detail. - Then output the code in a single code block. - Minimize any other prose. -Wait for the users instruction. -Respond in multiple responses/messages so your responses aren't cutoff. I want you to act as a stack overflow post. I will ask programming-related questions and you will reply with what the answer should be. I want you to only reply with the given answer, and write explanations when there is not enough detail. do not write explanations. When I need to tell you something in English, I will do so by putting text inside curly brackets {like this}. I would like you to create a python code/script that uses the computer screen for you to look at the screen and locate the watch video button but make use it does not have a timer in the right side. I want you to create a python automation app using "make image recognition bots as fast as possible using Python. I will cover the basics of Pyautogui, Python, win32api, opencv" where is looks for an image and text on the screen and use mouse clicks in order to automate the process and be able to watch video ads automatically so that I am able to receive credits for watching the video. You click the button, the video is played and you must use AI to find the next, X, >>, or -> arrow button in order to go back to the original screen and continue to wait until the timer is done so that you can watch the next video and repeat the process. Here is the simplified process of what needs accomplished: look on the screen for a watch video button, click that button, an ad is played wait until you see a icon in a form of a X, >>, or ->, usually found in the top right or left of the screen, click that button when it appears, see if the ad is still playing, if yes click again, if brought to the google play store click another button which is the back button, the end result will be be brought back to the home screen where you repeat the process to see if there is a timer on the button and wait until you are able to click it to repeat again. give me step by step instructions throughout the whole process. act as if i am new to coding and explain it to me like i am five. for example when using Pyautogui when the code asks for the image in question, tell me to take a screenshot of the image on screen and enter it into the code. when it comes to click the “X” button or similar after the ad has finished, use a form of AI to detect if there is X available or if it should wait until the ad has finished playing in order to click it. The AI should also keep in mind if it is redirected to another screen, app, or google play store it should be able to get back to the ad screen and proceed to hit the “X” and return to the home screen to repeat the process over again. use opencv and pyautogui during this development process.
20e21b927a6babac11e261c8ff3164e7
{ "intermediate": 0.35716214776039124, "beginner": 0.37151217460632324, "expert": 0.27132561802864075 }
12,781
in unreal engine 5.2 using editor utility widget there is a function called set start frame for sequencer. I want the same function but using sequencer timecode than using frames
bee9265dbfe196bbe909dd08368f7c06
{ "intermediate": 0.5057191848754883, "beginner": 0.23371535539627075, "expert": 0.26056545972824097 }
12,782
can you code me a shift to run function for roblox where i can toggle the speed
acfaab8fc4bcb9ea0fa71283e5391bc5
{ "intermediate": 0.43957313895225525, "beginner": 0.1671946793794632, "expert": 0.39323216676712036 }
12,783
Here is the form for the shipment, create me a function to send the data to our shipment controller <div class="needs-validation position-relative" novalidate> <!-- start contact--> <div class="d-flex justify-content-s flex-wrap mb-4"> <div class="d-flex align-items-center"> <input id="contract-value" type="text" class="form-control" placeholder="Contract ID" value="" required disabled /> <div class="form-check form-check-inline"> <!-- Button trigger modal --> <button type="button" class="btn btn-outline-danger btn-sm" data-bs-toggle="modal" data-bs-target="#contractModal" > Search </button> <!-- Modal --> <div class="modal fade" id="contractModal" tabindex="-1" aria-labelledby="contract-id" aria-hidden="true" > <div class="modal-dialog modal-lg"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="contract-id"> Contract Search </h5> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close" ></button> </div> <div class="modal-body"> <div class="table-responsive"> <table class="table"> <thead> <tr> <th>Contract ID</th> <th>Select</th> </tr> </thead> <tbody> <tr> <td>41a2144f-3fee-ed11-8981-005056b358ac</td> <td class="select-checkbox"> <input class="form-check-input" type="checkbox" value="41a2144f-3fee-ed11-8981-005056b358ac" name="contract-id" /> </td> </tr> <tr> <td>eb91c2d9-edef-ed11-8981-005056b358ac</td> <td class="select-checkbox"> <input class="form-check-input" type="checkbox" value="eb91c2d9-edef-ed11-8981-005056b358ac" name="contract-id" /> </td> </tr> <tr> <td>459e7281-2405-ee11-8985-005056b358ac</td> <td class="select-checkbox"> <input class="form-check-input" type="checkbox" value="459e7281-2405-ee11-8985-005056b358ac" name="contract-id" /> </td> </tr> </tbody> </table> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-bs-dismiss="modal" > Close </button> </div> </div> </div> </div> </div> </div> </div> <!-- End contract--> <div class="form-overlay"></div> <div class="d-flex justify-content-between flex-wrap mb-4"> <div class="d-flex align-items-center gap-4"> <div class="light-box"> <p>Receiver</p> </div> <div class="form-check form-check-inline"> <input class="form-check-input" type="radio" name="receiver" id="internal" value="internal" checked required /> <label class="form-check-label" for="internal" >Internal</label > </div> <div class="form-check form-check-inline"> <input class="form-check-input" type="radio" name="receiver" id="external" value="external" required /> <label class="form-check-label" for="external" >External</label > </div> </div> <div class="form-check form-check-inline"> <div class="row"> <div class="col-auto"> <input class="form-check-input" type="checkbox" id="save" value="save" /> <label class="form-check-label" for="save" >Keep customer data after save</label > </div> <div class="col"> <div class="me-2"> <button type="reset" class="btn btn-danger btn-sm"> Clear All Fields </button> </div> </div> </div> </div> </div> <div class="general-box mb-4"> <div class="row justify-content-end mb-2"> <div class="col-auto"> <div class="mt-2 mb-2"> <button type="button" class="btn btn-secondary btn-sm m-0" style="width: 15rem; font-size: 14px" data-bs-toggle="modal" data-bs-target="#exampleModal5" > <img src="imgs/search-icon-light.svg" style="width: 14px" /> Search existing customers </button> <!-- Modal --> <div class="modal fade" id="exampleModal5" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true" > <div class="modal-dialog modal-lg"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalLabel"> Search existing customers </h5> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close" ></button> </div> <div class="modal-body"> <div class="row"> <div class="col-md-6"> <label for="name_1" class="mb-2" >Name of the corporate/person</label > <input id="name_1" type="text" class="form-control" placeholder="Name" value="" required /> </div> <div class="col-md-6"> <label for="mobile_1" class="mb-2" >Mobile number</label > <input id="mobile_1" type="text" class="form-control" placeholder="Ex. 966XXXXXX" value="" required /> </div> </div> <button type="button" class="btn btn-primary mt-3" style="margin: 0; width: 4.5rem" > Search </button> <hr class="my-4" /> <div class="table-responsive"> <table class="table"> <thead> <tr> <th>Name of the corporate/person</th> <th>Mobile number</th> <th>Select</th> </tr> </thead> </table> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-bs-dismiss="modal" > Close </button> </div> </div> </div> </div> </div> </div> </div> <div class="row"> <div data-group="internal" class="col-md-6 col-lg-4"> <div class="form-group"> <label for="customer-type">Customer type</label> <select id="customer-type" class="form-select form-control" data-placeholder="Please Select" required > <option></option> <option value="individual"> Individual- institutions and companies </option> <option value="governmental">Governmental Entity</option> </select> <div class="invalid-feedback"> Please select a valid state. </div> </div> </div> <div class="col-md-6 col-lg-4"> <div class="form-group"> <label for="receiver-name">Receiver name</label> <input id="receiver-name" type="text" class="form-control" placeholder="Enter receiver name" value="" required /> <div class="invalid-feedback"> Please enter receiver name. </div> </div> </div> <div class="col-md-6 col-lg-4"> <div class="form-group"> <label for="receiver-mobile">Receiver mobile number</label> <input id="receiver-mobile" type="text" class="form-control" placeholder="Enter receiver mobile number" value="" required /> <div class="invalid-feedback"> Please enter receiver mobile number. </div> </div> </div> <div data-group="external" class="col-md-6 col-lg-4"> <div class="form-group"> <label for="identity-type">Identity type</label> <select id="identity-type" class="form-select form-control" data-placeholder="Please Select" required > <option></option> <option value="Mandate (delivery order)"> Mandate (delivery order) </option> <option value="Proforma Invoice">Proforma Invoice</option> <option value="Identity Card">Identity Card</option> <option value="Commercial Invoice"> Commercial Invoice </option> <option value="Passport">Passport</option> <option value="Driving License">Driving License</option> <option value="Export License">Export License</option> <option value="Certificate of origin"> Certificate of origin </option> <option value="Preference certificate of origin"> Preference certificate of origin </option> <option value="Import License">Import License</option> <option value="Related document">Related document</option> <option value="Certificate">Certificate</option> <option value="Invoice">Invoice</option> <option value="License">License</option> </select> <div class="invalid-feedback"> Please select a valid state. </div> </div> </div> <div data-group="external" data-input="optional" class="col-md-6 col-lg-4" > <div class="form-group"> <label for="document-number">Document Number</label> <input id="document-number" type="text" class="form-control" placeholder="Enter Document Number" value="" /> <div class="invalid-feedback"> Please enter Document Number. </div> </div> </div> <div data-group="external" class="col-md-6 col-lg-4"> <div class="form-group"> <label for="country">Country</label> <select id="country" class="form-select form-control" data-placeholder="Please Select" required > <option></option> <option value="country1">country</option> <option value="country2">country</option> </select> <div class="invalid-feedback"> Please select a valid state. </div> </div> </div> <div data-group="external" class="col-md-6 col-lg-4"> <div class="form-group"> <label for="external-city">City</label> <select id="external-city" class="form-select form-control" data-placeholder="Please Select" required > <option></option> <option value="City1">City</option> <option value="City2">City</option> </select> <div class="invalid-feedback"> Please select a valid state. </div> </div> </div> <div data-group="external" data-input="optional" class="col-md-6 col-lg-4" > <div class="form-group"> <label for="external-address">Address</label> <input id="external-address" type="text" class="form-control" placeholder="Address" value="" /> </div> </div> <div data-group="external" data-input="optional" class="col-md-6 col-lg-4" > <div class="form-group"> <label for="external-zipcode">Zip Code</label> <input id="external-zipcode" type="text" class="form-control" placeholder="Zip Code" value="" /> </div> </div> <div data-group="external" data-input="optional" class="col-md-6 col-lg-4" > <div class="form-group"> <label for="external-mailbox">Mailbox</label> <input id="external-mailbox" type="email" class="form-control" placeholder="Mailbox" value="" /> </div> </div> </div> <div data-group="internal" class="mb-4 form-group"> <label class="d-block mb-2">Choose address type</label> <div class="d-flex justify-content-between flex-wrap"> <div class="form-check form-check-inline"> <input class="form-check-input" type="radio" name="address-type" id="national" value="national" required /> <label class="form-check-label" for="national" >National ID</label > </div> <div class="form-check form-check-inline"> <input class="form-check-input" type="radio" name="address-type" id="mailbox" value="mailbox" required /> <label class="form-check-label" for="mailbox" >Mailbox</label > </div> <div class="form-check form-check-inline"> <input class="form-check-input" type="radio" name="address-type" id="parcel" value="parcel" required /> <label class="form-check-label" for="parcel" >Parcel station</label > </div> <div class="form-check form-check-inline"> <input class="form-check-input" type="radio" name="address-type" id="delivery" value="delivery" required /> <label class="form-check-label" for="delivery" >Office delivery</label > </div> <div class="form-check form-check-inline"> <input class="form-check-input" type="radio" name="address-type" id="descriptive" value="descriptive" required /> <label class="form-check-label" for="descriptive" >Descriptive Address</label > </div> </div> </div> <div class="row" data-group="national"> <div class="col-auto"> <div class="form-group"> <button type="button" class="btn btn-primary btn-sm text-white m-0" style="width: 15rem; font-size: 14px" data-bs-toggle="modal" data-bs-target="#exampleModal1" > <img src="imgs/search-icon-light.svg" style="width: 14px" /> Search by mobile number </button> <!-- Modal --> <div class="modal fade" id="exampleModal1" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true" > <div class="modal-dialog modal-lg"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalLabel"> Search by mobile number </h5> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close" ></button> </div> <div class="modal-body"> <div class="row"> <div class="col-md-6"> <label for="mobile_1" class="mb-2" >Mobile number</label > <input id="mobile_1" type="text" class="form-control" placeholder="Ex. 966XXXXXX" value="" required /> </div> </div> <button type="button" class="btn btn-primary mt-3" style="margin: 0; width: 4.5rem" > Search </button> <hr class="my-4" /> <div class="table-responsive"> <table class="table"> <thead> <tr> <th>Name of the corporate/person</th> <th>Mobile number</th> <th>Select</th> </tr> </thead> </table> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-bs-dismiss="modal" > Close </button> </div> </div> </div> </div> </div> </div> <div class="col-auto"> <div class="form-group"> <button type="button" class="btn btn-primary btn-sm text-white m-0" style="width: 15rem; font-size: 14px" data-bs-toggle="modal" data-bs-target="#exampleModal2" > <img src="imgs/search-icon-light.svg" style="width: 14px" /> Search by identity number </button> <!-- Modal --> <div class="modal fade" id="exampleModal2" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true" > <div class="modal-dialog modal-lg"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalLabel"> Search by identity number </h5> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close" ></button> </div> <div class="modal-body"> <div class="row"> <div class="col-md-6"> <label for="name_1" class="mb-2" >Identity number</label > <input id="name_1" type="text" class="form-control" placeholder="National ID" value="" required /> </div> </div> <button type="button" class="btn btn-primary mt-3" style="margin: 0; width: 4.5rem" > Search </button> <hr class="my-4" /> <div class="table-responsive"> <table class="table"> <thead> <tr> <th>Name of the corporate/person</th> <th>Mobile number</th> <th>Select</th> </tr> </thead> </table> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-bs-dismiss="modal" > Close </button> </div> </div> </div> </div> </div> </div> </div> <div class="row"> <div data-group="mailbox national" class="col-md-6 col-lg-4"> <div class="form-group"> <label for="zip-code">ZIP code</label> <input id="zip-code" type="text" class="form-control" placeholder="Enter ZIP code" value="" /> <div class="invalid-feedback">Please enter ZIP code.</div> </div> </div> <div data-group="mailbox parcel delivery descriptive" class="col-md-6 col-lg-4" > <div class="form-group"> <label for="city">City</label> <select id="city" class="form-select form-control" data-placeholder="Please Select" required > <option></option> <option value="City1">City</option> <option value="City2">City</option> </select> <div class="invalid-feedback"> Please select a valid state. </div> </div> </div> <div data-group="mailbox" class="col-md-6 col-lg-4"> <div class="form-group"> <label for="mailbox-data">MailBox</label> <input id="mailbox-data" type="text" class="form-control" placeholder="Enter Mailbox" value="" /> <div class="invalid-feedback">Please enter Mailbox.</div> </div> </div> <div data-group="national" class="col-md-6 col-lg-4"> <div class="form-group"> <label for="address">Short address</label> <input id="address" type="text" class="form-control" placeholder="Short address" value="" required /> <div class="invalid-feedback"> Please enter short address. </div> </div> </div> <div data-group="national" class="col-md-6 col-lg-4"> <div class="form-group"> <label for="building-number">Building number</label> <input id="building-number" type="text" class="form-control" placeholder="Enter building number" value="" required /> <div class="invalid-feedback"> Please enter building number. </div> </div> </div> <div data-group="national" class="col-md-6 col-lg-4"> <div class="form-group"> <label for="additional-number">Additional number</label> <input id="additional-number" type="text" class="form-control" placeholder="Enter additional number" value="" required /> <div class="invalid-feedback"> Please enter additional number. </div> </div> </div> <div data-group="national" data-input="optional" class="col-md-6 col-lg-4" > <div class="form-group"> <label for="unit-number">Unit number</label> <input id="unit-number" type="text" class="form-control" placeholder="Enter unit number" value="" required /> <div class="invalid-feedback"> Please enter unit number. </div> </div> </div> <div data-group="parcel" class="col-md-6 col-lg-4"> <div class="form-group"> <label for="parcel-station">Parcel Station</label> <select id="parcel-station" class="form-select form-control" data-placeholder="Please Select" required > <option></option> <option value="station1">Station 1</option> <option value="station2">Station 2</option> </select> <div class="invalid-feedback"> Please select a valid state. </div> </div> </div> <div data-group="delivery" class="col-md-6 col-lg-4"> <div class="form-group"> <label for="office">Office</label> <select id="office" class="form-select form-control" data-placeholder="Please Select" required > <option></option> <option value="office1">Office 1</option> <option value="office2">Office 2</option> </select> <div class="invalid-feedback"> Please select a valid state. </div> </div> </div> <div data-group="descriptive" class="col-md-6 col-lg-4"> <div class="form-group"> <label for="district">District</label> <select id="district" class="form-select form-control" data-placeholder="Please Select" required > <option></option> <option value="district1">District 1</option> <option value="district2">District 2</option> </select> <div class="invalid-feedback"> Please select a valid state. </div> </div> </div> <div data-group="descriptive" class="col-md-6 col-lg-4"> <div class="form-group"> <label for="street-name">Street Name</label> <input id="street-name" type="text" class="form-control" placeholder="Enter Street Name" value="" required /> <div class="invalid-feedback"> Please enter Street Name. </div> </div> </div> <div data-group="descriptive" data-input="optional" class="col-md-6 col-lg-4" > <div class="form-group"> <label for="nearest-landmark">Nearest Landmark</label> <input id="nearest-landmark" type="text" class="form-control" placeholder="Enter Nearest Landmark" value="" /> <div class="invalid-feedback"> Please enter Nearest Landmark. </div> </div> </div> </div> </div> <div data-group="internal" class="d-flex justify-content-between flex-wrap mb-4" > <div class="d-flex align-items-center gap-4"> <div class="light-box"> <p>Shipment</p> </div> <div class="form-check form-check-inline"> <input class="form-check-input" type="radio" name="shipment" id="normal" value="Parcel Information" required /> <label class="form-check-label" for="normal" >Parcel Information</label > </div> </div> <div data-input="optional" class="form-check form-check-inline"> <input class="form-check-input" type="checkbox" id="save_shipment" value="save shipment" /> <label class="form-check-label" for="save_shipment" >Keep shipment data after save</label > </div> </div> <div class="general-box"> <div class="row"> <div class="col-md-12 col-lg-6"> <div class="row"> <div class="col-md-6 col-lg-6"> <div class="form-group"> <label for="shipment-type">Shipment type</label> <select id="shipment-type" class="form-select form-control" data-placeholder="Please Select" > <option></option> <option value="Shipment less than 5 kilos"> Shipment less than 5 kilos </option> <option value="Shipment more than 5 kilos"> Shipment more than 5 kilos </option> </select> <div class="invalid-feedback"> Please select shipment type. </div> </div> </div> <div class="col-md-6 col-lg-6"> <div class="form-group"> <label for="shipment-weight" >Shipment weight / gm</label > <input id="shipment-weight" type="text" class="form-control" placeholder="Enter shipment weight / gm" value="" required /> <div class="invalid-feedback"> Please enter shipment weight / gm. </div> </div> </div> <div class="col-md-6 col-lg-6"> <div class="form-group"> <label for="reference-id">Reference ID</label> <input id="reference-id" type="text" class="form-control" placeholder="Enter reference ID" value="" /> <div class="invalid-feedback"> Please enter reference ID. </div> </div> </div> <div class="col-md-6 col-lg-6"> <div class="form-group"> <label for="shipment-content" >Shipment content type</label > <select id="shipment-content" class="form-select form-control" data-placeholder="Please Select" required > <option></option> <option value="Food">Food</option> <option value="Clothes">Clothes</option> <option value="Electric Devices"> Electric Devices </option> <option value="Electronic Devices"> Electronic Devices </option> <option value="Medicine">Medicine</option> <option value="Children Toys">Children Toys</option> <option value="Paper and Documents"> Paper and Documents </option> <option value="Other">Other</option> </select> <div class="invalid-feedback"> Please select shipment content type. </div> </div> </div> </div> </div> <div class="col-md-12 col-lg-6"> <div class="form-group h-75"> <label for="shipment-description" >Shipment Content Description</label > <textarea id="shipment-description" class="form-control h-100" rows="5" placeholder="Enter Shipment Content Description" ></textarea> <div class="invalid-feedback"> Please enter shipment description. </div> </div> </div> </div> <div data-group="external" class="row"> <div class="col-md-6 col-lg-4"> <div class="form-group"> <label for="origin-country">Origin Country</label> <select id="origin-country" class="form-select form-control" data-placeholder="Please Select" required > <option></option> <option value="country1">country</option> <option value="country2">country</option> </select> <div class="invalid-feedback"> Please select a valid state. </div> </div> </div> <div class="col-md-6 col-lg-4"> <div class="form-group"> <label for="content-price">Content Price</label> <input id="content-price" type="number" class="form-control" min="0" oninput="this.value = Math.abs(this.value)" placeholder="Content Price" value="" /> <div class="invalid-feedback"> Please enter Content Price. </div> </div> </div> </div> <div data-group="internal" class="row"> <div class="col-md-6 col-lg-4 form-group"> <label class="mb-2">Cash On Delivery</label> <div class="form-check mb-2"> <input class="form-check-input" type="radio" name="cash-on-delivery" id="cash-yes" value="Yes" required /> <label class="form-check-label" for="cash-yes">Yes</label> </div> <div class="form-check mb-2"> <input class="form-check-input" type="radio" name="cash-on-delivery" id="cash-no" value="No" required /> <label class="form-check-label" for="cash-no">No</label> </div> </div> <div class="col-md-6 col-lg-4 form-group"> <label class="mb-2">Refrigerated</label> <div class="form-check mb-2"> <input class="form-check-input" type="radio" name="refrigerated" id="refrigerated-yes" value="Yes" required /> <label class="form-check-label" for="refrigerated-yes" >Yes</label > </div> <div class="form-check mb-2"> <input class="form-check-input" type="radio" name="refrigerated" id="refrigerated-no" value="No" required /> <label class="form-check-label" for="refrigerated-no" >No</label > </div> </div> <div class="col-md-6 col-lg-4 form-group"> <label class="mb-2">Delivery Type</label> <div class="form-check mb-2"> <input class="form-check-input" type="radio" name="delivery-type" id="regular-delivery" value="Regular delivery" required /> <label class="form-check-label" for="regular-delivery" >Regular delivery</label > </div> <div class="form-check mb-2"> <input class="form-check-input" type="radio" name="delivery-type" id="express-delivery" value="Express delivery" required /> <label class="form-check-label" for="express-delivery" >Express delivery</label > </div> </div> <div id="amount-field" class="col-md-6 col-lg-4 d-none"> <div class="form-group"> <label for="amount">Amount</label> <input id="amount" type="number" class="form-control" placeholder="Enter Amount" value="" /> <div class="invalid-feedback">Please enter Amount.</div> </div> </div> </div> </div> <div class="d-flex justify-content-end"> <button onclick="CreateShipment()" class="btn btn-primary w-auto my-3 mx-0" > Create shipment </button> </div> </div>
bbf6d9011fe269b53e56ff02e5b3962a
{ "intermediate": 0.4023260176181793, "beginner": 0.44656383991241455, "expert": 0.15111014246940613 }
12,784
how can i use stable difussion servers for a web aapplication
ad04c723593596d6a550b9afb317a08c
{ "intermediate": 0.3966085612773895, "beginner": 0.213194340467453, "expert": 0.39019709825515747 }
12,785
<w:tbl> <w:tblPr> <w:tblStyle w:val="TableGrid"/> <w:tblW w:w="0" w:type="auto"/> <w:tblLook w:val="04A0" w:firstRow="1" w:lastRow="0" w:firstColumn="1" w:lastColumn="0" w:noHBand="0" w:noVBand="1"/> </w:tblPr> <w:tblGrid> <w:gridCol w:w="4509"/> <w:gridCol w:w="4510"/> </w:tblGrid> <w:tr w:rsidR="0081301F" w14:paraId="53794934" w14:textId="77777777" w:rsidTr="006C24B5"> <w:tc> <w:tcPr> <w:tcW w:w="4509" w:type="dxa"/> </w:tcPr> <w:p w14:paraId="67567BFF" w14:textId="7EE2B7F9" w:rsidR="0081301F" w:rsidRPr="006C24B5" w:rsidRDefault="0081301F" w:rsidP="0081301F"> <w:pPr> <w:rPr> <w:rFonts w:ascii="Times New Roman" w:eastAsia="Roboto" w:hAnsi="Times New Roman" w:cs="Times New Roman"/> <w:lang w:val="en-US"/> </w:rPr> </w:pPr> <w:r> <w:rPr> <w:rFonts w:ascii="Times New Roman" w:eastAsia="Roboto" w:hAnsi="Times New Roman" w:cs="Times New Roman"/> <w:lang w:val="en-US"/> </w:rPr> <w:t>1</w:t> .... </w:tbl> i want get elemet w:t like get w:t underline below in Flutter: final underlineElements = _document.findAllElements('w:r').where( (element) => element .getElement('w:rPr') ?.getElement('w:u') ?.getAttribute('w:val') == 'single' || element .getElement('w:rPr') ?.getElement('w:u') ?.getAttribute('w:val') == 'double'); final texts = underlineElements .map((element) => element.getElement('w:t')?.innerText ?? '') .toList();
f983e1fbaadee386fc749a92985422a6
{ "intermediate": 0.10020817816257477, "beginner": 0.6110641360282898, "expert": 0.28872764110565186 }
12,786
can you code me a script in html that will keep opening up a set link?
cce5f583f889d1de2e378f252343eaa7
{ "intermediate": 0.5059507489204407, "beginner": 0.19314564764499664, "expert": 0.3009035587310791 }
12,787
import datetime from datetime import date def add_year(date_obj): try: new_date_obj = date_obj.replace(year = date_obj.year + 1) except ValueError: # This gets executed when the above method fails, # which means that we're making a Leap Year calculation new_date_obj = date_obj.replace(year = date_obj.year + 4) return new_date_obj def next_date(date_string): # Convert the argument from string to date object date_obj = datetime.datetime.strptime(date_string, r"%Y-%m-%d") next_date_obj = add_year(date_obj) # Convert the datetime object to string, # in the format of "yyyy-mm-dd" next_date_string = next_date_obj.strftime("yyyy-mm-dd") return next_date_string today = date.today() # Get today's date print(next_date(str(today))) # Should return a year from today, unless today is Leap Day print(next_date("2021-01-01")) # Should return 2022-01-01 print(next_date("2020-02-29")) # Should return 2024-02-29
ab8fc9041bd1065e88fdc486a31a852a
{ "intermediate": 0.291038453578949, "beginner": 0.5438507795333862, "expert": 0.1651107519865036 }
12,788
can you give me html code that will open up youtube.com as soon as my website is loaded?
af83d99fef87185e748fb6f49383712f
{ "intermediate": 0.4789411127567291, "beginner": 0.24695472419261932, "expert": 0.2741040885448456 }
12,789
in importing modules, which comes first, python puts a module into sys.module and python execute the module itself?
e67da501ad43e0e13868644da4f2fb7b
{ "intermediate": 0.45816609263420105, "beginner": 0.20029614865779877, "expert": 0.34153780341148376 }
12,790
How to remove a folder in linux
4e0a14e731f187e83bb34375a0965615
{ "intermediate": 0.36594220995903015, "beginner": 0.32988929748535156, "expert": 0.3041684925556183 }
12,791
I’m building a video game engine using C++ as the coding language and Vulkan for graphics. I am trying to set up a generic renderer using Vulkan that is flexible and will render objects based on a vector that is supplied to it. The renderer will also handle the creation of the window using GLFW and use GLM for all relevant math calls. I am using the ASSIMP library to load 3d models and animations. I am in the process of converting the codebase from using vulkan.h to vulkan.hpp, as well as utilising RAII. Here is the new header for the BufferUtils class: BufferUtils.h: #pragma once #include <vulkan/vulkan.hpp> namespace BufferUtils { void CreateBuffer( vk::Device device, vk::PhysicalDevice physicalDevice, vk::DeviceSize size, vk::BufferUsageFlags usage, vk::MemoryPropertyFlags properties, vk::Buffer& buffer, vk::DeviceMemory& bufferMemory); uint32_t FindMemoryType(vk::PhysicalDevice physicalDevice, uint32_t typeFilter, vk::MemoryPropertyFlags properties); void CopyBuffer( vk::Device device, vk::CommandPool commandPool, vk::Queue graphicsQueue, vk::Buffer srcBuffer, vk::Buffer dstBuffer, vk::DeviceSize size); } Can you update the following code of the Texture class to utilise vulkan.hpp, RAII and align with the BufferUtils class? Texture.h: #pragma once #include <vulkan/vulkan.h> #include "stb_image.h" // Include the stb_image header #include "BufferUtils.h" #include <string> class Texture { public: Texture(); ~Texture(); void LoadFromFile(const std::string& filename, VkDevice device, VkPhysicalDevice physicalDevice, VkCommandPool commandPool, VkQueue graphicsQueue); VkImageView GetImageView() const; VkSampler GetSampler() const; void Cleanup(); private: VkDevice device; VkImage image; VkDeviceMemory imageMemory; VkImageView imageView; VkSampler sampler; VkPhysicalDevice physicalDevice; VkCommandPool commandPool; VkQueue graphicsQueue; bool initialized = false; void CreateImage(uint32_t width, uint32_t height, uint32_t mipLevels, VkSampleCountFlagBits numSamples, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage, VkMemoryPropertyFlags properties); void TransitionImageLayout(VkImageLayout oldLayout, VkImageLayout newLayout, uint32_t mipLevels, VkSampleCountFlagBits numSamples); void CopyBufferToImage(VkBuffer buffer, uint32_t width, uint32_t height); void CreateImageView(VkFormat format, VkImageAspectFlags aspectFlags, uint32_t mipLevels); void CreateSampler(uint32_t mipLevels); void GenerateMipmaps(uint32_t width, uint32_t height, uint32_t mipLevels); VkCommandBuffer BeginSingleTimeCommands(VkCommandPool commandPool, VkDevice device); void EndSingleTimeCommands(VkCommandPool commandPool, VkQueue graphicsQueue, VkDevice device, VkCommandBuffer commandBuffer); }; A portion of Texture.cpp: #include "Texture.h" #include "BufferUtils.h" #include <iostream> Texture::Texture() : device(VK_NULL_HANDLE), image(VK_NULL_HANDLE), imageMemory(VK_NULL_HANDLE), imageView(VK_NULL_HANDLE), sampler(VK_NULL_HANDLE) { } Texture::~Texture() { Cleanup(); } void Texture::LoadFromFile(const std::string& filename, VkDevice device, VkPhysicalDevice physicalDevice, VkCommandPool commandPool, VkQueue graphicsQueue) { this->device = device; this->physicalDevice = physicalDevice; this->commandPool = commandPool; this->graphicsQueue = graphicsQueue; this->initialized = true; // Load image from file using stb_image int width, height, channels; stbi_uc* pixels = stbi_load(filename.c_str(), &width, &height, &channels, STBI_rgb_alpha); if (!pixels) { throw std::runtime_error("Failed to load texture image!"); } // Calculate the number of mip levels uint32_t mipLevels = static_cast<uint32_t>(std::floor(std::log2(std::max(width, height)))) + 1; VkDeviceSize imageSize = width * height * 4; VkBuffer stagingBuffer; VkDeviceMemory stagingBufferMemory; // Create the staging buffer for transferring image data BufferUtils::CreateBuffer(device, physicalDevice, imageSize, VK_BUFFER_USAGE_TRANSFER_SRC_BIT, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT, stagingBuffer, stagingBufferMemory); // Copy image data to the buffer void* bufferData; vkMapMemory(device, stagingBufferMemory, 0, imageSize, 0, &bufferData); memcpy(bufferData, pixels, static_cast<size_t>(imageSize)); vkUnmapMemory(device, stagingBufferMemory); stbi_image_free(pixels); // Free the stb_image buffer // Create vkImage, copy buffer to image, and create imageView and sampler CreateImage(width, height, mipLevels, VK_SAMPLE_COUNT_1_BIT, VK_FORMAT_R8G8B8A8_SRGB, VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT); CreateImageView(VK_FORMAT_R8G8B8A8_SRGB, VK_IMAGE_ASPECT_COLOR_BIT, mipLevels); CreateSampler(mipLevels); TransitionImageLayout(VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, mipLevels, VK_SAMPLE_COUNT_1_BIT); CopyBufferToImage(stagingBuffer, width, height); GenerateMipmaps(width, height, mipLevels); // Cleanup the staging buffer and staging buffer memory vkDestroyBuffer(device, stagingBuffer, nullptr); vkFreeMemory(device, stagingBufferMemory, nullptr); } void Texture::Cleanup() { if (!initialized) { return; } if (sampler != VK_NULL_HANDLE) { vkDestroySampler(device, sampler, nullptr); sampler = VK_NULL_HANDLE; } if (imageView != VK_NULL_HANDLE) { vkDestroyImageView(device, imageView, nullptr); imageView = VK_NULL_HANDLE; } if (image != VK_NULL_HANDLE) { vkDestroyImage(device, image, nullptr); image = VK_NULL_HANDLE; } if (imageMemory != VK_NULL_HANDLE) { vkFreeMemory(device, imageMemory, nullptr); imageMemory = VK_NULL_HANDLE; } initialized = false; } VkImageView Texture::GetImageView() const { return imageView; } VkSampler Texture::GetSampler() const { return sampler; } void Texture::CreateImage(uint32_t width, uint32_t height, uint32_t mipLevels, VkSampleCountFlagBits numSamples, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage, VkMemoryPropertyFlags properties) { VkImageCreateInfo imageInfo{}; imageInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO; imageInfo.imageType = VK_IMAGE_TYPE_2D; imageInfo.extent.width = width; imageInfo.extent.height = height; imageInfo.extent.depth = 1; imageInfo.mipLevels = mipLevels; imageInfo.arrayLayers = 1; imageInfo.format = format; imageInfo.tiling = tiling; imageInfo.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; imageInfo.usage = usage; imageInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE; imageInfo.samples = numSamples; imageInfo.flags = 0; if (vkCreateImage(device, &imageInfo, nullptr, &image) != VK_SUCCESS) { throw std::runtime_error("Failed to create image!"); } VkMemoryRequirements memRequirements; vkGetImageMemoryRequirements(device, image, &memRequirements); VkMemoryAllocateInfo allocInfo{}; allocInfo.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO; allocInfo.allocationSize = memRequirements.size; allocInfo.memoryTypeIndex = BufferUtils::FindMemoryType(physicalDevice, memRequirements.memoryTypeBits, properties); if (vkAllocateMemory(device, &allocInfo, nullptr, &imageMemory) != VK_SUCCESS) { throw std::runtime_error("Failed to allocate image memory!"); } vkBindImageMemory(device, image, imageMemory, 0); } void Texture::TransitionImageLayout(VkImageLayout oldLayout, VkImageLayout newLayout, uint32_t mipLevels, VkSampleCountFlagBits numSamples) { // Create a one-time-use command buffer VkCommandBufferAllocateInfo allocInfo{}; allocInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO; allocInfo.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY; allocInfo.commandPool = commandPool; allocInfo.commandBufferCount = 1; VkCommandBuffer commandBuffer; vkAllocateCommandBuffers(device, &allocInfo, &commandBuffer); VkCommandBufferBeginInfo beginInfo{}; beginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO; beginInfo.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT; vkBeginCommandBuffer(commandBuffer, &beginInfo); VkImageMemoryBarrier barrier{}; barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; barrier.oldLayout = oldLayout; barrier.newLayout = newLayout; barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; barrier.image = image; barrier.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; barrier.subresourceRange.baseMipLevel = 0; barrier.subresourceRange.levelCount = mipLevels; barrier.subresourceRange.baseArrayLayer = 0; barrier.subresourceRange.layerCount = 1; VkPipelineStageFlags sourceStage; VkPipelineStageFlags destinationStage; if (oldLayout == VK_IMAGE_LAYOUT_UNDEFINED && newLayout == VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL) { barrier.srcAccessMask = 0; barrier.dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; sourceStage = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT; destinationStage = VK_PIPELINE_STAGE_TRANSFER_BIT; } else if (oldLayout == VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL && newLayout == VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL) { barrier.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; barrier.dstAccessMask = VK_ACCESS_SHADER_READ_BIT; sourceStage = VK_PIPELINE_STAGE_TRANSFER_BIT; destinationStage = VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT; } else { throw std::invalid_argument("Unsupported layout transition!"); } vkCmdPipelineBarrier( commandBuffer, sourceStage, destinationStage, 0, 0, nullptr, 0, nullptr, 1, &barrier ); // End command buffer recording vkEndCommandBuffer(commandBuffer); // Submit command buffer VkSubmitInfo submitInfo{}; submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO; submitInfo.commandBufferCount = 1; submitInfo.pCommandBuffers = &commandBuffer; vkQueueSubmit(graphicsQueue, 1, &submitInfo, VK_NULL_HANDLE); vkQueueWaitIdle(graphicsQueue); // Free command buffer vkFreeCommandBuffers(device, commandPool, 1, &commandBuffer); }
bd6f74857751c4a6c96746bec90e4baa
{ "intermediate": 0.44066715240478516, "beginner": 0.3269985616207123, "expert": 0.23233434557914734 }
12,792
for np.where in numpy, what if I have two conditions?
5ef893825fe166166d748ef814f85667
{ "intermediate": 0.4025660753250122, "beginner": 0.28706714510917664, "expert": 0.31036680936813354 }
12,793
const doLogOut = async () => { await API.logOut(); setLoggedIn(false); setUser(undefined); setAdmin(false); <Navigate to="/" /> } Why could <Navigate to="/" /> not be executed?
732653d91ef75b562d2601af70cf86ba
{ "intermediate": 0.5522927045822144, "beginner": 0.28377488255500793, "expert": 0.1639324426651001 }
12,794
javascript how to wait 2 seconds
7ec547141430fe1493814f306c6b7cfe
{ "intermediate": 0.3702824115753174, "beginner": 0.2565683424472809, "expert": 0.3731492757797241 }
12,795
Net Core Elastic Search 查询
9f9b5355cb86fe9ed26a035e4dc33ebf
{ "intermediate": 0.26006045937538147, "beginner": 0.16113266348838806, "expert": 0.5788068771362305 }
12,796
/grpc-js/src/server.ts:411 callback(new Error(errorString), 0); ^ Error: No address added out of total 1 resolved Lỗi ở trên trong nestjs fix như nào
cb0c8c80269e325d3d9ef484efb02756
{ "intermediate": 0.38080212473869324, "beginner": 0.3819997310638428, "expert": 0.23719818890094757 }
12,797
ModuleNotFoundError: No module named 'torch'
a25ca9ba2c84b9e4b599b03a1a2d158b
{ "intermediate": 0.38894081115722656, "beginner": 0.2790135145187378, "expert": 0.33204564452171326 }
12,798
module 'cv2' has no attribute 'ximgproc'
47e7da871085f7a3230f36b1ec47f94a
{ "intermediate": 0.3140740692615509, "beginner": 0.2130497843027115, "expert": 0.4728761911392212 }
12,799
How to clear input from linux terminal
85b18abec6370db3d5d3724e464d2d54
{ "intermediate": 0.3209451138973236, "beginner": 0.3139813244342804, "expert": 0.365073561668396 }
12,800
I’m building a video game engine using C++ as the coding language and Vulkan for graphics. I am trying to set up a generic renderer using Vulkan that is flexible and will render objects based on a vector that is supplied to it. The renderer will also handle the creation of the window using GLFW and use GLM for all relevant math calls. I am using the ASSIMP library to load 3d models and animations. I am in the process of converting the codebase from using vulkan.h to vulkan.hpp, as well as utilising RAII. Here is the new header for the BufferUtils class: BufferUtils.h: #pragma once #include <vulkan/vulkan.hpp> namespace BufferUtils { void CreateBuffer( vk::Device device, vk::PhysicalDevice physicalDevice, vk::DeviceSize size, vk::BufferUsageFlags usage, vk::MemoryPropertyFlags properties, vk::Buffer& buffer, vk::DeviceMemory& bufferMemory); uint32_t FindMemoryType(vk::PhysicalDevice physicalDevice, uint32_t typeFilter, vk::MemoryPropertyFlags properties); void CopyBuffer( vk::Device device, vk::CommandPool commandPool, vk::Queue graphicsQueue, vk::Buffer srcBuffer, vk::Buffer dstBuffer, vk::DeviceSize size); } Can you update the following code of the Texture class to utilise vulkan.hpp, RAII and align with the BufferUtils class? Also be sure to update an methods to accommodate and changes to the header file. Texture.h: #pragma once #include <vulkan/vulkan.h> #include "stb_image.h" // Include the stb_image header #include "BufferUtils.h" #include <string> class Texture { public: Texture(); ~Texture(); void LoadFromFile(const std::string& filename, VkDevice device, VkPhysicalDevice physicalDevice, VkCommandPool commandPool, VkQueue graphicsQueue); VkImageView GetImageView() const; VkSampler GetSampler() const; void Cleanup(); private: VkDevice device; VkImage image; VkDeviceMemory imageMemory; VkImageView imageView; VkSampler sampler; VkPhysicalDevice physicalDevice; VkCommandPool commandPool; VkQueue graphicsQueue; bool initialized = false; void CreateImage(uint32_t width, uint32_t height, uint32_t mipLevels, VkSampleCountFlagBits numSamples, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage, VkMemoryPropertyFlags properties); void TransitionImageLayout(VkImageLayout oldLayout, VkImageLayout newLayout, uint32_t mipLevels, VkSampleCountFlagBits numSamples); void CopyBufferToImage(VkBuffer buffer, uint32_t width, uint32_t height); void CreateImageView(VkFormat format, VkImageAspectFlags aspectFlags, uint32_t mipLevels); void CreateSampler(uint32_t mipLevels); void GenerateMipmaps(uint32_t width, uint32_t height, uint32_t mipLevels); VkCommandBuffer BeginSingleTimeCommands(VkCommandPool commandPool, VkDevice device); void EndSingleTimeCommands(VkCommandPool commandPool, VkQueue graphicsQueue, VkDevice device, VkCommandBuffer commandBuffer); }; A portion of Texture.cpp: #include "Texture.h" #include "BufferUtils.h" #include <iostream> Texture::Texture() : device(VK_NULL_HANDLE), image(VK_NULL_HANDLE), imageMemory(VK_NULL_HANDLE), imageView(VK_NULL_HANDLE), sampler(VK_NULL_HANDLE) { } Texture::~Texture() { Cleanup(); } void Texture::LoadFromFile(const std::string& filename, VkDevice device, VkPhysicalDevice physicalDevice, VkCommandPool commandPool, VkQueue graphicsQueue) { this->device = device; this->physicalDevice = physicalDevice; this->commandPool = commandPool; this->graphicsQueue = graphicsQueue; this->initialized = true; // Load image from file using stb_image int width, height, channels; stbi_uc* pixels = stbi_load(filename.c_str(), &width, &height, &channels, STBI_rgb_alpha); if (!pixels) { throw std::runtime_error("Failed to load texture image!"); } // Calculate the number of mip levels uint32_t mipLevels = static_cast<uint32_t>(std::floor(std::log2(std::max(width, height)))) + 1; VkDeviceSize imageSize = width * height * 4; VkBuffer stagingBuffer; VkDeviceMemory stagingBufferMemory; // Create the staging buffer for transferring image data BufferUtils::CreateBuffer(device, physicalDevice, imageSize, VK_BUFFER_USAGE_TRANSFER_SRC_BIT, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT, stagingBuffer, stagingBufferMemory); // Copy image data to the buffer void* bufferData; vkMapMemory(device, stagingBufferMemory, 0, imageSize, 0, &bufferData); memcpy(bufferData, pixels, static_cast<size_t>(imageSize)); vkUnmapMemory(device, stagingBufferMemory); stbi_image_free(pixels); // Free the stb_image buffer // Create vkImage, copy buffer to image, and create imageView and sampler CreateImage(width, height, mipLevels, VK_SAMPLE_COUNT_1_BIT, VK_FORMAT_R8G8B8A8_SRGB, VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT); CreateImageView(VK_FORMAT_R8G8B8A8_SRGB, VK_IMAGE_ASPECT_COLOR_BIT, mipLevels); CreateSampler(mipLevels); TransitionImageLayout(VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, mipLevels, VK_SAMPLE_COUNT_1_BIT); CopyBufferToImage(stagingBuffer, width, height); GenerateMipmaps(width, height, mipLevels); // Cleanup the staging buffer and staging buffer memory vkDestroyBuffer(device, stagingBuffer, nullptr); vkFreeMemory(device, stagingBufferMemory, nullptr); } void Texture::Cleanup() { if (!initialized) { return; } if (sampler != VK_NULL_HANDLE) { vkDestroySampler(device, sampler, nullptr); sampler = VK_NULL_HANDLE; } if (imageView != VK_NULL_HANDLE) { vkDestroyImageView(device, imageView, nullptr); imageView = VK_NULL_HANDLE; } if (image != VK_NULL_HANDLE) { vkDestroyImage(device, image, nullptr); image = VK_NULL_HANDLE; } if (imageMemory != VK_NULL_HANDLE) { vkFreeMemory(device, imageMemory, nullptr); imageMemory = VK_NULL_HANDLE; } initialized = false; } VkImageView Texture::GetImageView() const { return imageView; } VkSampler Texture::GetSampler() const { return sampler; } void Texture::CreateImage(uint32_t width, uint32_t height, uint32_t mipLevels, VkSampleCountFlagBits numSamples, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage, VkMemoryPropertyFlags properties) { VkImageCreateInfo imageInfo{}; imageInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO; imageInfo.imageType = VK_IMAGE_TYPE_2D; imageInfo.extent.width = width; imageInfo.extent.height = height; imageInfo.extent.depth = 1; imageInfo.mipLevels = mipLevels; imageInfo.arrayLayers = 1; imageInfo.format = format; imageInfo.tiling = tiling; imageInfo.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; imageInfo.usage = usage; imageInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE; imageInfo.samples = numSamples; imageInfo.flags = 0; if (vkCreateImage(device, &imageInfo, nullptr, &image) != VK_SUCCESS) { throw std::runtime_error("Failed to create image!"); } VkMemoryRequirements memRequirements; vkGetImageMemoryRequirements(device, image, &memRequirements); VkMemoryAllocateInfo allocInfo{}; allocInfo.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO; allocInfo.allocationSize = memRequirements.size; allocInfo.memoryTypeIndex = BufferUtils::FindMemoryType(physicalDevice, memRequirements.memoryTypeBits, properties); if (vkAllocateMemory(device, &allocInfo, nullptr, &imageMemory) != VK_SUCCESS) { throw std::runtime_error("Failed to allocate image memory!"); } vkBindImageMemory(device, image, imageMemory, 0); } void Texture::TransitionImageLayout(VkImageLayout oldLayout, VkImageLayout newLayout, uint32_t mipLevels, VkSampleCountFlagBits numSamples) { // Create a one-time-use command buffer VkCommandBufferAllocateInfo allocInfo{}; allocInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO; allocInfo.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY; allocInfo.commandPool = commandPool; allocInfo.commandBufferCount = 1; VkCommandBuffer commandBuffer; vkAllocateCommandBuffers(device, &allocInfo, &commandBuffer); VkCommandBufferBeginInfo beginInfo{}; beginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO; beginInfo.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT; vkBeginCommandBuffer(commandBuffer, &beginInfo); VkImageMemoryBarrier barrier{}; barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; barrier.oldLayout = oldLayout; barrier.newLayout = newLayout; barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; barrier.image = image; barrier.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; barrier.subresourceRange.baseMipLevel = 0; barrier.subresourceRange.levelCount = mipLevels; barrier.subresourceRange.baseArrayLayer = 0; barrier.subresourceRange.layerCount = 1; VkPipelineStageFlags sourceStage; VkPipelineStageFlags destinationStage; if (oldLayout == VK_IMAGE_LAYOUT_UNDEFINED && newLayout == VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL) { barrier.srcAccessMask = 0; barrier.dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; sourceStage = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT; destinationStage = VK_PIPELINE_STAGE_TRANSFER_BIT; } else if (oldLayout == VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL && newLayout == VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL) { barrier.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; barrier.dstAccessMask = VK_ACCESS_SHADER_READ_BIT; sourceStage = VK_PIPELINE_STAGE_TRANSFER_BIT; destinationStage = VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT; } else { throw std::invalid_argument("Unsupported layout transition!"); } vkCmdPipelineBarrier( commandBuffer, sourceStage, destinationStage, 0, 0, nullptr, 0, nullptr, 1, &barrier ); // End command buffer recording vkEndCommandBuffer(commandBuffer); // Submit command buffer VkSubmitInfo submitInfo{}; submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO; submitInfo.commandBufferCount = 1; submitInfo.pCommandBuffers = &commandBuffer; vkQueueSubmit(graphicsQueue, 1, &submitInfo, VK_NULL_HANDLE); vkQueueWaitIdle(graphicsQueue); // Free command buffer vkFreeCommandBuffers(device, commandPool, 1, &commandBuffer); } void Texture::CreateImageView(VkFormat format, VkImageAspectFlags aspectFlags, uint32_t mipLevels) { VkImageViewCreateInfo viewInfo{}; viewInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO; viewInfo.image = image; viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D; viewInfo.format = format; viewInfo.subresourceRange.aspectMask = aspectFlags; viewInfo.subresourceRange.baseMipLevel = 0; viewInfo.subresourceRange.levelCount = mipLevels; viewInfo.subresourceRange.baseArrayLayer = 0; viewInfo.subresourceRange.layerCount = 1; if (vkCreateImageView(device, &viewInfo, nullptr, &imageView) != VK_SUCCESS) { throw std::runtime_error("Failed to create texture image view!"); } } void Texture::CreateSampler(uint32_t mipLevels) { VkSamplerCreateInfo samplerInfo{}; samplerInfo.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO; samplerInfo.magFilter = VK_FILTER_LINEAR; samplerInfo.minFilter = VK_FILTER_LINEAR; samplerInfo.addressModeU = VK_SAMPLER_ADDRESS_MODE_REPEAT; samplerInfo.addressModeV = VK_SAMPLER_ADDRESS_MODE_REPEAT; samplerInfo.addressModeW = VK_SAMPLER_ADDRESS_MODE_REPEAT; samplerInfo.anisotropyEnable = VK_TRUE; samplerInfo.maxAnisotropy = 16; samplerInfo.borderColor = VK_BORDER_COLOR_INT_OPAQUE_BLACK; samplerInfo.unnormalizedCoordinates = VK_FALSE; samplerInfo.compareEnable = VK_FALSE; samplerInfo.compareOp = VK_COMPARE_OP_ALWAYS; samplerInfo.mipmapMode = VK_SAMPLER_MIPMAP_MODE_LINEAR; samplerInfo.mipLodBias = 0.0f; samplerInfo.minLod = 0.0f; samplerInfo.maxLod = static_cast<float>(mipLevels); if (vkCreateSampler(device, &samplerInfo, nullptr, &sampler) != VK_SUCCESS) { throw std::runtime_error("Failed to create texture sampler!"); } } void Texture::CopyBufferToImage(VkBuffer buffer, uint32_t width, uint32_t height) { // Create a one-time-use command buffer VkCommandBufferAllocateInfo allocInfo{}; allocInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO; allocInfo.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY; allocInfo.commandPool = commandPool; allocInfo.commandBufferCount = 1; VkCommandBuffer commandBuffer; vkAllocateCommandBuffers(device, &allocInfo, &commandBuffer); VkCommandBufferBeginInfo beginInfo{}; beginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO; beginInfo.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT; // Record buffer to image copy command in the command buffer vkBeginCommandBuffer(commandBuffer, &beginInfo); VkBufferImageCopy region{}; region.bufferOffset = 0; region.bufferRowLength = 0; region.bufferImageHeight = 0; region.imageSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; region.imageSubresource.mipLevel = 0; region.imageSubresource.baseArrayLayer = 0; region.imageSubresource.layerCount = 1; region.imageOffset = { 0, 0, 0 }; region.imageExtent = { width, height, 1 }; vkCmdCopyBufferToImage( commandBuffer, buffer, image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &region ); // End command buffer recording vkEndCommandBuffer(commandBuffer); // Submit command buffer VkSubmitInfo submitInfo{}; submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO; submitInfo.commandBufferCount = 1; submitInfo.pCommandBuffers = &commandBuffer; vkQueueSubmit(graphicsQueue, 1, &submitInfo, VK_NULL_HANDLE); vkQueueWaitIdle(graphicsQueue); // Free command buffer vkFreeCommandBuffers(device, commandPool, 1, &commandBuffer); } void Texture::GenerateMipmaps(uint32_t width, uint32_t height, uint32_t mipLevels) { VkFormatProperties formatProperties; vkGetPhysicalDeviceFormatProperties(physicalDevice, VK_FORMAT_R8G8B8A8_SRGB, &formatProperties); if (!(formatProperties.optimalTilingFeatures & VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT)) { throw std::runtime_error("Texture image format does not support linear filtering!"); } VkCommandBuffer commandBuffer = BeginSingleTimeCommands(commandPool, device); VkImageMemoryBarrier barrier{}; barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; barrier.image = image; barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; barrier.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; barrier.subresourceRange.baseArrayLayer = 0; barrier.subresourceRange.layerCount = 1; barrier.subresourceRange.levelCount = 1; int32_t mipWidth = width; int32_t mipHeight = height; for (uint32_t i = 1; i < mipLevels; i++) { barrier.subresourceRange.baseMipLevel = i - 1; barrier.oldLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; barrier.newLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL; barrier.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; barrier.dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT; vkCmdPipelineBarrier(commandBuffer, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, nullptr, 0, nullptr, 1, &barrier); VkImageBlit blit{}; blit.srcOffsets[0] = { 0, 0, 0 }; blit.srcOffsets[1] = { mipWidth, mipHeight, 1 }; blit.srcSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; blit.srcSubresource.mipLevel = i - 1; blit.srcSubresource.baseArrayLayer = 0; blit.srcSubresource.layerCount = 1; blit.dstOffsets[0] = { 0, 0, 0 }; blit.dstOffsets[1] = { mipWidth / 2, mipHeight / 2, 1 }; blit.dstSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; blit.dstSubresource.mipLevel = i; blit.dstSubresource.baseArrayLayer = 0; blit.dstSubresource.layerCount = 1; vkCmdBlitImage(commandBuffer, image, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &blit, VK_FILTER_LINEAR); barrier.oldLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL; barrier.newLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; barrier.srcAccessMask = VK_ACCESS_TRANSFER_READ_BIT; barrier.dstAccessMask = VK_ACCESS_SHADER_READ_BIT; vkCmdPipelineBarrier(commandBuffer, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, 0, 0, nullptr, 0, nullptr, 1, &barrier); mipWidth /= 2; mipHeight /= 2; } barrier.subresourceRange.baseMipLevel = mipLevels - 1; barrier.oldLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; barrier.newLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; barrier.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; barrier.dstAccessMask = VK_ACCESS_SHADER_READ_BIT; vkCmdPipelineBarrier(commandBuffer, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, 0, 0, nullptr, 0, nullptr, 1, &barrier); EndSingleTimeCommands(commandPool, graphicsQueue, device, commandBuffer); } VkCommandBuffer Texture::BeginSingleTimeCommands(VkCommandPool commandPool, VkDevice device) { VkCommandBufferAllocateInfo allocInfo{}; allocInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO; allocInfo.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY; allocInfo.commandPool = commandPool; allocInfo.commandBufferCount = 1; VkCommandBuffer commandBuffer; vkAllocateCommandBuffers(device, &allocInfo, &commandBuffer); VkCommandBufferBeginInfo beginInfo{}; beginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO; beginInfo.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT; vkBeginCommandBuffer(commandBuffer, &beginInfo); return commandBuffer; } void Texture::EndSingleTimeCommands(VkCommandPool commandPool, VkQueue graphicsQueue, VkDevice device, VkCommandBuffer commandBuffer) { vkEndCommandBuffer(commandBuffer); VkSubmitInfo submitInfo{}; submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO; submitInfo.commandBufferCount = 1; submitInfo.pCommandBuffers = &commandBuffer; vkQueueSubmit(graphicsQueue, 1, &submitInfo, VK_NULL_HANDLE); vkQueueWaitIdle(graphicsQueue); vkFreeCommandBuffers(device, commandPool, 1, &commandBuffer); }
71b44dad06a3ced97a8d4cb4e9b90c61
{ "intermediate": 0.45070502161979675, "beginner": 0.36646410822868347, "expert": 0.18283088505268097 }
12,801
Teach me break and continue
c22f691083794a7f2734af9996f93c1a
{ "intermediate": 0.36170053482055664, "beginner": 0.4249536991119385, "expert": 0.2133456915616989 }
12,802
hi
1312bea1d572a5c8c28be16540bf1d65
{ "intermediate": 0.3246487081050873, "beginner": 0.27135494351387024, "expert": 0.40399640798568726 }
12,803
protected async void OnActivePlanChange(ShovelPlan plan) { _activePlanLocal = null; _activePlanGlobal = null; if (plan is null) Logger.Information($"Active plan changed to null", LogType.Plan); else Logger.Information($"Active plan changed to plan with id: {plan.Id}, name: {plan.Name}", LogType.Plan); ActivePlanChanged?.Invoke(this, plan); if (plan is not null) await _hub.Clients.All.ReceiveActivePlanState(new InPlanState(plan.Id)); else await _hub.Clients.All.ReceiveActivePlanState(new InPlanState(null)); } У меня есть такой метод и событие, заблокирует ли вызов ActivePlanChanged?.Invoke(this, plan); дальнейшее выполнение метода до выполнения всех методов-подписчиков??
97bc8a852be706a47e6f428987f3b0f6
{ "intermediate": 0.4322371482849121, "beginner": 0.3425234854221344, "expert": 0.22523938119411469 }
12,804
i have flask jinja template <div class="absolute bottom-2 right-4 p-2 bg-black bg-opacity-50 text-white text-xl"> {{ video['duration'] }} </div> that shows me duration in seconds and i want to see duration in minute and seconds so can you help me
c744787d591e3872a0f912052b739aeb
{ "intermediate": 0.510840117931366, "beginner": 0.20404326915740967, "expert": 0.28511661291122437 }
12,805
怎么解决:INFO: pip is looking at multiple versions of transformers to determine which version is compatible with other requirements. This could take a while. ERROR: Cannot install -r requirements_4bit.txt (line 20), -r requirements_4bit.txt (line 4), -r requirements_4bit.txt (line 6) and huggingface-hub==0.13.3 because these package versions have conflicting dependencies. The conflict is caused by: The user requested huggingface-hub==0.13.3 datasets 2.8.0 depends on huggingface-hub<1.0.0 and >=0.2.0 evaluate 0.4.0 depends on huggingface-hub>=0.7.0 transformers 4.30.0.dev0 depends on huggingface-hub<1.0 and >=0.14.1 To fix this you could try to: 1. loosen the range of package versions you've specified 2. remove package versions to allow pip attempt to solve the dependency conflict ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts
50b1b1dee04ff36325d4e556ee3c43d0
{ "intermediate": 0.2838697135448456, "beginner": 0.3531425893306732, "expert": 0.3629877269268036 }
12,806
in python how to clean all files under one folder
344cec4e2435a6286840831d9fe8f9c8
{ "intermediate": 0.3809972107410431, "beginner": 0.27055880427360535, "expert": 0.34844401478767395 }
12,807
write python program to shows given number in k, millions(m) or if smaller number than k than shows real number
eb97630e74c5cec59d3995c7e45f30d3
{ "intermediate": 0.3535133898258209, "beginner": 0.1644010692834854, "expert": 0.48208555579185486 }
12,808
Need Slicer to be applied only to the Active Tab not other Tabs
3674e2bb7950305f8a711ac1a29fead6
{ "intermediate": 0.3402767479419708, "beginner": 0.15645572543144226, "expert": 0.5032674670219421 }
12,809
pop out a file selection window
8f4f2ac2eaa137ecfabf5bef6fb263c0
{ "intermediate": 0.3598976135253906, "beginner": 0.1779305338859558, "expert": 0.46217188239097595 }
12,810
unity camera RT
0a3175aab0e376da726f9d7b785bc99d
{ "intermediate": 0.389456570148468, "beginner": 0.294108122587204, "expert": 0.3164353370666504 }
12,811
I’m building a video game engine using C++ as the coding language and Vulkan for graphics. I am trying to set up a generic renderer using Vulkan that is flexible and will render objects based on a vector that is supplied to it. The renderer will also handle the creation of the window using GLFW and use GLM for all relevant math calls. I am using the ASSIMP library to load 3d models and animations. I am in the process of converting the codebase from using vulkan.h to vulkan.hpp, as well as utilising RAII. I have updated the BufferUtils class and Texture class header to incorporate these elements. However I still need to update the Texture class source based on these updates. Here is some of the code: BufferUtils.h: #pragma once #include <vulkan/vulkan.hpp> namespace BufferUtils { void CreateBuffer( vk::Device device, vk::PhysicalDevice physicalDevice, vk::DeviceSize size, vk::BufferUsageFlags usage, vk::MemoryPropertyFlags properties, vk::Buffer& buffer, vk::DeviceMemory& bufferMemory); uint32_t FindMemoryType(vk::PhysicalDevice physicalDevice, uint32_t typeFilter, vk::MemoryPropertyFlags properties); void CopyBuffer( vk::Device device, vk::CommandPool commandPool, vk::Queue graphicsQueue, vk::Buffer srcBuffer, vk::Buffer dstBuffer, vk::DeviceSize size); } Old Texture.h: #pragma once #include <vulkan/vulkan.h> #include "stb_image.h" // Include the stb_image header #include "BufferUtils.h" #include <string> class Texture { public: Texture(); ~Texture(); void LoadFromFile(const std::string& filename, VkDevice device, VkPhysicalDevice physicalDevice, VkCommandPool commandPool, VkQueue graphicsQueue); VkImageView GetImageView() const; VkSampler GetSampler() const; void Cleanup(); private: VkDevice device; VkImage image; VkDeviceMemory imageMemory; VkImageView imageView; VkSampler sampler; VkPhysicalDevice physicalDevice; VkCommandPool commandPool; VkQueue graphicsQueue; bool initialized = false; void CreateImage(uint32_t width, uint32_t height, uint32_t mipLevels, VkSampleCountFlagBits numSamples, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage, VkMemoryPropertyFlags properties); void TransitionImageLayout(VkImageLayout oldLayout, VkImageLayout newLayout, uint32_t mipLevels, VkSampleCountFlagBits numSamples); void CopyBufferToImage(VkBuffer buffer, uint32_t width, uint32_t height); void CreateImageView(VkFormat format, VkImageAspectFlags aspectFlags, uint32_t mipLevels); void CreateSampler(uint32_t mipLevels); void GenerateMipmaps(uint32_t width, uint32_t height, uint32_t mipLevels); VkCommandBuffer BeginSingleTimeCommands(VkCommandPool commandPool, VkDevice device); void EndSingleTimeCommands(VkCommandPool commandPool, VkQueue graphicsQueue, VkDevice device, VkCommandBuffer commandBuffer); }; New Texture.h: #pragma once #include <vulkan/vulkan.hpp> #include "stb_image.h" // Include the stb_image header #include "BufferUtils.h" #include <string> class Texture { public: Texture(); ~Texture(); void LoadFromFile(const std::string& filename, vk::Device device, vk::PhysicalDevice physicalDevice, vk::CommandPool commandPool, vk::Queue graphicsQueue); vk::ImageView GetImageView() const; vk::Sampler GetSampler() const; void Cleanup(); private: vk::Device device; vk::Image image; vk::DeviceMemory imageMemory; vk::ImageView imageView; vk::Sampler sampler; vk::PhysicalDevice physicalDevice; vk::CommandPool commandPool; vk::Queue graphicsQueue; bool initialized = false; void CreateImage(uint32_t width, uint32_t height, uint32_t mipLevels, vk::SampleCountFlagBits numSamples, vk::Format format, vk::ImageTiling tiling, vk::ImageUsageFlags usage, vk::MemoryPropertyFlags properties); void TransitionImageLayout(vk::ImageLayout oldLayout, vk::ImageLayout newLayout, uint32_t mipLevels, vk::SampleCountFlagBits numSamples); void CopyBufferToImage(vk::Buffer buffer, uint32_t width, uint32_t height); void CreateImageView(vk::Format format, vk::ImageAspectFlags aspectFlags, uint32_t mipLevels); void CreateSampler(uint32_t mipLevels); void GenerateMipmaps(uint32_t width, uint32_t height, uint32_t mipLevels); vk::CommandBuffer BeginSingleTimeCommands(vk::CommandPool commandPool, vk::Device device); void EndSingleTimeCommands(vk::CommandPool commandPool, vk::Queue graphicsQueue, vk::Device device, vk::CommandBuffer commandBuffer); }; A portion of Texture.cpp: void Texture::CreateImage(uint32_t width, uint32_t height, uint32_t mipLevels, VkSampleCountFlagBits numSamples, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage, VkMemoryPropertyFlags properties) { VkImageCreateInfo imageInfo{}; imageInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO; imageInfo.imageType = VK_IMAGE_TYPE_2D; imageInfo.extent.width = width; imageInfo.extent.height = height; imageInfo.extent.depth = 1; imageInfo.mipLevels = mipLevels; imageInfo.arrayLayers = 1; imageInfo.format = format; imageInfo.tiling = tiling; imageInfo.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; imageInfo.usage = usage; imageInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE; imageInfo.samples = numSamples; imageInfo.flags = 0; if (vkCreateImage(device, &imageInfo, nullptr, &image) != VK_SUCCESS) { throw std::runtime_error("Failed to create image!"); } VkMemoryRequirements memRequirements; vkGetImageMemoryRequirements(device, image, &memRequirements); VkMemoryAllocateInfo allocInfo{}; allocInfo.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO; allocInfo.allocationSize = memRequirements.size; allocInfo.memoryTypeIndex = BufferUtils::FindMemoryType(physicalDevice, memRequirements.memoryTypeBits, properties); if (vkAllocateMemory(device, &allocInfo, nullptr, &imageMemory) != VK_SUCCESS) { throw std::runtime_error("Failed to allocate image memory!"); } vkBindImageMemory(device, image, imageMemory, 0); } void Texture::TransitionImageLayout(VkImageLayout oldLayout, VkImageLayout newLayout, uint32_t mipLevels, VkSampleCountFlagBits numSamples) { // Create a one-time-use command buffer VkCommandBufferAllocateInfo allocInfo{}; allocInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO; allocInfo.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY; allocInfo.commandPool = commandPool; allocInfo.commandBufferCount = 1; VkCommandBuffer commandBuffer; vkAllocateCommandBuffers(device, &allocInfo, &commandBuffer); VkCommandBufferBeginInfo beginInfo{}; beginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO; beginInfo.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT; vkBeginCommandBuffer(commandBuffer, &beginInfo); VkImageMemoryBarrier barrier{}; barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; barrier.oldLayout = oldLayout; barrier.newLayout = newLayout; barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; barrier.image = image; barrier.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; barrier.subresourceRange.baseMipLevel = 0; barrier.subresourceRange.levelCount = mipLevels; barrier.subresourceRange.baseArrayLayer = 0; barrier.subresourceRange.layerCount = 1; VkPipelineStageFlags sourceStage; VkPipelineStageFlags destinationStage; if (oldLayout == VK_IMAGE_LAYOUT_UNDEFINED && newLayout == VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL) { barrier.srcAccessMask = 0; barrier.dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; sourceStage = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT; destinationStage = VK_PIPELINE_STAGE_TRANSFER_BIT; } else if (oldLayout == VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL && newLayout == VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL) { barrier.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; barrier.dstAccessMask = VK_ACCESS_SHADER_READ_BIT; sourceStage = VK_PIPELINE_STAGE_TRANSFER_BIT; destinationStage = VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT; } else { throw std::invalid_argument("Unsupported layout transition!"); } vkCmdPipelineBarrier( commandBuffer, sourceStage, destinationStage, 0, 0, nullptr, 0, nullptr, 1, &barrier ); // End command buffer recording vkEndCommandBuffer(commandBuffer); // Submit command buffer VkSubmitInfo submitInfo{}; submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO; submitInfo.commandBufferCount = 1; submitInfo.pCommandBuffers = &commandBuffer; vkQueueSubmit(graphicsQueue, 1, &submitInfo, VK_NULL_HANDLE); vkQueueWaitIdle(graphicsQueue); // Free command buffer vkFreeCommandBuffers(device, commandPool, 1, &commandBuffer); } Can you please align update the code from Texture.cpp to align to the BufferUtils class and the new Texture header code?
b7b0c182c2765098fc3e1c053e91ba23
{ "intermediate": 0.44436630606651306, "beginner": 0.4074360430240631, "expert": 0.14819762110710144 }
12,812
can you tell me what is mulesoft
3c1b994c3823ff661f30aa241ecc0259
{ "intermediate": 0.4346941411495209, "beginner": 0.17997288703918457, "expert": 0.3853329122066498 }
12,813
Write me a C++ code using while loop, it would have spin-flip process, each spin-flip would consume different times, and there is an time interval in 1 minute, after each time interval, the field strength would increase by 0.5, so the total spin-flip time should be less than 1 minute time interval, if it is checked for more than 1 minute, it would move to the next loop for time interval
eb305dcc8d2b7a432457da13b3f3a14c
{ "intermediate": 0.27794545888900757, "beginner": 0.2745329439640045, "expert": 0.4475215673446655 }
12,814
<vxe-table show-footer :scroll-y="{enabled: false}" align="center" ref="xTable" max-height="400px" auto-resize size="small" stripe highlight-current-row border highlight-hover-column :sort-config="{multiple: true, trigger: 'cell'}" :data="selectOutboundOrder"> <vxe-column field="lineNo" title="行号" width="95"></vxe-column> <vxe-column field="material.baseInfo.code" title="产品编码" width="130"></vxe-column> <vxe-column field="planAmount" title="应出" width="75"></vxe-column> <vxe-column field="doneAmount" title="实出" width="75"></vxe-column> <vxe-column field="差异" title="差异" width="95"></vxe-column> </vxe-table> 差异 显示 应出减去实出的值
6d4cb4d830f2a4d7202bd14398cdc642
{ "intermediate": 0.3057686388492584, "beginner": 0.3608211874961853, "expert": 0.33341023325920105 }
12,815
hi
edca91dada11da8e765c2fde27003d0e
{ "intermediate": 0.3246487081050873, "beginner": 0.27135494351387024, "expert": 0.40399640798568726 }
12,817
CSRF Attack burp suite prevention referer
0cdfd470a1839d8fb65fcb396c38021b
{ "intermediate": 0.2857702672481537, "beginner": 0.4222911596298218, "expert": 0.29193857312202454 }
12,818
we have an object in javascript that consists of key and values. we want to get keys that their value is not empty or "".
4e077fd8d460159f2b24b3f0ce8f5036
{ "intermediate": 0.4182695150375366, "beginner": 0.2007199227809906, "expert": 0.38101062178611755 }
12,819
十万个json文件储存在“train”文件夹中, folder_path = "train" for file_name in os.listdir(folder_path): if file_name.endswith(".json"): file_path = os.path.join(folder_path, file_name) with open(file_path, "r") as json_file: data = json.load(json_file) 每行代码的含义 print(data) 为什么只有一个json文件的内容
365dcb9080e5b78a01f1e81b22f611eb
{ "intermediate": 0.3187510669231415, "beginner": 0.3172815144062042, "expert": 0.3639673888683319 }
12,820
Optimistic locking in jooq with r2dbc driver
5f1a096ba39ad259fe59ede53161f4ab
{ "intermediate": 0.4309948682785034, "beginner": 0.173336923122406, "expert": 0.3956681787967682 }
12,821
how can I change the font here: <h1 class="display-6">Based in Little Venice in West London, we’re a family-run independent optician providing high stand
196fe789e15201992502e1dbcfc69388
{ "intermediate": 0.43376168608665466, "beginner": 0.30042698979377747, "expert": 0.2658112943172455 }
12,822
i have this array numbers: [ { label: '11223344', value: '11223344', type: 'dedicated', isDisabled: false, numberKey: '6E931G1457B8123123ASDASDASD976E9B' }, { label: '447860099319', value: '447860099319', type: 'dedicated', isDisabled: false, numberKey: '1F6E931G1457B800ASDASDASD976E9B' } ],
109d668ec5b096870ef47bf1300a9b59
{ "intermediate": 0.35680171847343445, "beginner": 0.22207681834697723, "expert": 0.42112141847610474 }
12,823
use jest create ut for this vue component <template> <div v-loading="isLoading" class="interface"> <retry v-if="isError" v-bind="errorProps" @retry="__handleRetry" /> <empty v-else-if="empty" v-bind="emptyProps" /> <slot v-else /> </div> </template> <script> import empty from 'packages/empty' import retry from 'packages/retry' export default { name: 'GdProtect', components: { empty, retry }, props: { loading: { type: Boolean, default: false }, empty: { type: Boolean, default: false }, error: { type: Boolean, default: false }, emptyProps: { type: Object, default: () => { return {} } }, errorProps: { type: Object, default: () => { return {} } } }, data() { return { isLoading: false, isError: false, loadIndex: 0 } }, watch: { error: { handler: function(newVal) { this.isError = newVal }, immediate: true }, loading: { handler: function(newVal) { this.isLoading = newVal }, immediate: true } }, created() {}, mounted() {}, methods: { __handleRetry() { this.$emit('retry') }, getData(axiosParams) { return new Promise((resolve, reject) => { this.isLoading = true this.loadIndex++ var curLoadIndex = this.loadIndex this.$axios(axiosParams).then((res) => { let data = res.data if (curLoadIndex === this.loadIndex) { this.isLoading = false this.isError = false resolve(data) } }).catch((error) => { if (curLoadIndex === this.loadIndex) { this.isLoading = false this.isError = true reject(error) } }) }) } } } </script>
ebf220c6eb7e89e330323c7a6e0a1c9c
{ "intermediate": 0.2531082034111023, "beginner": 0.5282306671142578, "expert": 0.2186611294746399 }
12,824
let age = +prompt("yoshingizni kiriting") function constructorFunction() { this.ism = "muhammad"; this.fam = "gafurov"; this.yosh = 20; this.func = function() { return `${this.fam}, ${this.ism}`; }; this.getAge = function() { if (age < 18) { alert("You are not old enough to vote."); } else { alert("You are old enough to vote."); } }; this.togri = 0 this.xato = 0 this.jadvalkarra = function(){ for (let i = 0; i < 10; i++) { let javob = +prompt("${1} + ${10} = "); if (javob == i + 10) { this.togri += 1; alert("togri"); } else { this.xato += 1; alert("xato"); } } alert("${this.togri} ta togri topdingiz ${this.xato} xato topdingizz") } } let newconstructor = new constructorFunction(); console.log(newconstructor.func()); newconstructor.getAge(); newconstructor.jadvalkarra()
d8666cdfdbc4c6ac2a904191ced9b539
{ "intermediate": 0.35833266377449036, "beginner": 0.4032750129699707, "expert": 0.23839226365089417 }
12,825
Can you write me some code?
7dff5b36e96b48d07272fcce7f1bcb5f
{ "intermediate": 0.3520940840244293, "beginner": 0.2572600245475769, "expert": 0.3906458616256714 }
12,826
13 name products for category art
11b5ccc2691f58bd071f50adfa335318
{ "intermediate": 0.3589249551296234, "beginner": 0.37805473804473877, "expert": 0.26302027702331543 }
12,827
I've a reactJS with antDesign project, this is my header.js: "import { MenuOutlined, CloseOutlined, LoginOutlined, MailOutlined, WalletOutlined, MobileOutlined, UserAddOutlined, LockOutlined, UserOutlined, } from '@ant-design/icons'; import { Button, Row, Col, Typography, Modal, Tabs, Form, Input, Checkbox } from 'antd'; import { useState } from 'react'; const Head = () => { const [collapsed, setCollapsed] = useState(true); const [size, setSize] = useState('large'); const { Title } = Typography; const TabPane = Tabs.TabPane const [open, setOpen] = useState(false); const [confirmLoading, setConfirmLoading] = useState(false); const [modalText, setModalText] = useState('Content of the modal'); const showModal = () => { setOpen(true); }; const handleOk = () => { setModalText(""); setConfirmLoading(true); setTimeout(() => { setOpen(false); setConfirmLoading(false); }, 2000); }; const handleCancel = () => { console.log('Clicked cancel button'); setOpen(false); }; return ( <> <Row style={{ display: 'flex', justifyContent: 'space-between', border: '0' }} align="middle"> <Col style={{}}> <Row style={{ flexWrap: "nowrap" }}> <Button type="text" icon={collapsed ? <MenuOutlined /> : <CloseOutlined />} onClick={() => setCollapsed(!collapsed)} style={{ fontSize: '16px', width: 64, height: 64, color: '#5E4AE3', whiteSpace: 'nowrap' }} /> <Title style={{ whiteSpace: 'nowrap', color: '#DDDCDC', paddingTop: '12px' }} level={3}>CryptoTasky</Title> </Row> </Col> <Col style={{ marginLeft: '10px', position: 'absolute', left: '0' }}> <Button style={{ color: '#f5f5f5', boxShadow: '0 5px 20px rgba(94, 74, 227, .6)' }} type="primary" shape="round" icon={<LoginOutlined />} size={size} className="hidden-sm" onClick={showModal}> تسجيل / تسجيل دخول </Button> <Button style={{ color: '#f5f5f5' }} type="primary" shape="round" icon={<LoginOutlined />} size={size} className="visible-sm" onClick={showModal}> </Button> </Col> </Row> <Modal open={open} onOk={handleOk} confirmLoading={confirmLoading} onCancel={handleCancel} footer={[null]} > <Tabs style={{ backgroundColor: '#1e1e1e', color: '#F5F5F5' }} defaultActiveKey="1" centered > <TabPane tab={ <span> <LoginOutlined style={{ padding: '0 0 0 5' }} /> تسجيل دخول </span> } key="1" > <Form name="normal_login" className="login-form" initialValues={{ remember: true, }} style={{ paddingTop: '60px;' }} > <Form.Item name="إسم المُستخدم" rules={[ { required: true, message: 'من فضلك أدخل إسم المُستخدم', }, ]} > <Input size="large" prefix={<UserOutlined className="site-form-item-icon" />} placeholder="إسم المُستخدم" /> </Form.Item> <Form.Item name="password" rules={[ { required: true, message: 'من فضلك أدخل كلمة المرور', }, ]} > <Input size="large" prefix={<LockOutlined className="site-form-item-icon" />} type="password" placeholder="كلمة المرور" /> </Form.Item> <Form.Item> <Form.Item name="remember" valuePropName="checked" noStyle> <Checkbox>تذكرني</Checkbox> </Form.Item> <a className="login-form-forgot" href=""> نسيت كلمة المرور؟ </a> </Form.Item> <Form.Item className="justify-end"> <Button style={{ width: '100%' }} size="large" shape="round" icon={<LoginOutlined />} type="primary" htmlType="submit" className="login-form-button"> تسجيل دخول </Button> </Form.Item> </Form> </TabPane> <TabPane tab={ <span> <UserAddOutlined style={{ padding: '0 0 0 5' }} /> تسجيل حساب </span> } key="2" > <Form name="normal_login" className="login-form" initialValues={{ remember: true, }} > <Form.Item name="إسم المُستخدم" rules={[ { required: true, message: 'من فضلك أدخل إسم المُستخدم', }, ]} > <Input size="large" prefix={<UserOutlined className="site-form-item-icon" />} placeholder="Username" /> </Form.Item> <Form.Item name="البريد الإلكتروني" rules={[ { required: true, message: 'من فضلك أدخل البريد الإلكتروني', }, ]} > <Input size="large" prefix={<MailOutlined className="site-form-item-icon" />} placeholder="Example@email.com" /> </Form.Item> <Form.Item name="رقم الهاتف" rules={[ { required: true, message: 'من فضلك أدخل رقم الهاتف', }, ]} > <Input size="large" type="Email" prefix={<MobileOutlined className="site-form-item-icon" />} placeholder="+X XXX XXX XXXX" /> </Form.Item> <Form.Item name="رقم المحفظة TRX" rules={[ { required: true, message: 'من فضلك أدخل رقم المحفظة', }, ]} > <Input size="large" prefix={<WalletOutlined className="site-form-item-icon" />} placeholder="TBia4uHnb3oSSZm5isP284cA7Np1v15Vhi" /> </Form.Item> <Form.Item name="password" rules={[ { required: true, message: 'من فضلك أدخل كلمة المرور', }, ]} > <Input prefix={<LockOutlined className="site-form-item-icon" />} type="password" size="large" placeholder="كلمة المرور" /> </Form.Item> <Form.Item> <Form.Item name="remember" valuePropName="checked" noStyle> <Checkbox>تذكرني</Checkbox> </Form.Item> <a className="login-form-forgot" href=""> نسيت كلمة المرور؟ </a> </Form.Item> <Form.Item> <Button style={{ width: '100%' }} size="large" shape="round" icon={<UserAddOutlined />} type="primary" htmlType="submit" className="login-form-button"> تسجيل حساب </Button> </Form.Item> </Form> </TabPane> </Tabs > </Modal> </> ); } export default Head;" I want to use onClick={showModal} on a different js file while still redirecting me to the same modal located here. what should i do to achieve that?
b50090e1973f43d35f4a3b55faa91313
{ "intermediate": 0.4917266070842743, "beginner": 0.3766458034515381, "expert": 0.13162761926651 }
12,828
use jest create ut for this component <template> <div v-loading="isLoading" class="interface"> <retry v-if="isError" v-bind="errorProps" @retry="__handleRetry" /> <empty v-else-if="empty" v-bind="emptyProps" /> <slot v-else /> </div> </template> <script> import empty from 'packages/empty' import retry from 'packages/retry' export default { name: 'GdProtect', components: { empty, retry }, props: { loading: { type: Boolean, default: false }, empty: { type: Boolean, default: false }, error: { type: Boolean, default: false }, emptyProps: { type: Object, default: () => { return {} } }, errorProps: { type: Object, default: () => { return {} } } }, data() { return { isLoading: false, isError: false, loadIndex: 0 } }, watch: { error: { handler: function(newVal) { this.isError = newVal }, immediate: true }, loading: { handler: function(newVal) { this.isLoading = newVal }, immediate: true } }, created() {}, mounted() {}, methods: { __handleRetry() { this.$emit('retry') }, getData(axiosParams) { return new Promise((resolve, reject) => { this.isLoading = true this.loadIndex++ var curLoadIndex = this.loadIndex this.$axios(axiosParams).then((res) => { let data = res.data if (curLoadIndex === this.loadIndex) { this.isLoading = false this.isError = false resolve(data) } }).catch((error) => { if (curLoadIndex === this.loadIndex) { this.isLoading = false this.isError = true reject(error) } }) }) } } } </script> <style lang="scss" scoped> </style>
22d1e897a97a05d9943f341ede3af3cc
{ "intermediate": 0.2770731747150421, "beginner": 0.4600018858909607, "expert": 0.2629249095916748 }
12,829
i am running Deforum on google colab give me settings file of Deforum stable diffusion to get pose of model from input video and output a video with same animation with different model
aed5eb2e29b1ef613114129c41378029
{ "intermediate": 0.32652536034584045, "beginner": 0.08030963689088821, "expert": 0.5931650400161743 }
12,830
i've a ReactJS, antDesign project. i've a modal.js file containing an antDesign modal: "import { LoginOutlined, MailOutlined, WalletOutlined, MobileOutlined, UserAddOutlined, LockOutlined, UserOutlined, } from '@ant-design/icons'; import { Button, Modal, Tabs, Form, Input, Checkbox } from 'antd'; import { useState } from 'react'; const Mod = () => { const TabPane = Tabs.TabPane const [open, setOpen] = useState(false); const [confirmLoading, setConfirmLoading] = useState(false); const [modalText, setModalText] = useState('Content of the modal'); const showModal = () => { setOpen(true); }; const handleOk = () => { setModalText(""); setConfirmLoading(true); setTimeout(() => { setOpen(false); setConfirmLoading(false); }, 2000); }; const handleCancel = () => { console.log('Clicked cancel button'); setOpen(false); }; return ( <Modal open={open} onOk={handleOk} confirmLoading={confirmLoading} onCancel={handleCancel} footer={[null]} > <Tabs style={{ backgroundColor: '#1e1e1e', color: '#F5F5F5' }} defaultActiveKey="1" centered > <TabPane tab={ <span> <LoginOutlined style={{ padding: '0 0 0 5' }} /> تسجيل دخول </span> } key="1" > <Form name="normal_login" className="login-form" initialValues={{ remember: true, }} style={{ paddingTop: '60px;' }} > <Form.Item name="إسم المُستخدم" rules={[ { required: true, message: 'من فضلك أدخل إسم المُستخدم', }, ]} > <Input size="large" prefix={<UserOutlined className="site-form-item-icon" />} placeholder="إسم المُستخدم" /> </Form.Item> <Form.Item name="password" rules={[ { required: true, message: 'من فضلك أدخل كلمة المرور', }, ]} > <Input size="large" prefix={<LockOutlined className="site-form-item-icon" />} type="password" placeholder="كلمة المرور" /> </Form.Item> <Form.Item> <Form.Item name="remember" valuePropName="checked" noStyle> <Checkbox>تذكرني</Checkbox> </Form.Item> <a className="login-form-forgot" href=""> نسيت كلمة المرور؟ </a> </Form.Item> <Form.Item className="justify-end"> <Button style={{ width: '100%' }} size="large" shape="round" icon={<LoginOutlined />} type="primary" htmlType="submit" className="login-form-button"> تسجيل دخول </Button> </Form.Item> </Form> </TabPane> <TabPane tab={ <span> <UserAddOutlined style={{ padding: '0 0 0 5' }} /> تسجيل حساب </span> } key="2" > <Form name="normal_login" className="login-form" initialValues={{ remember: true, }} > <Form.Item name="إسم المُستخدم" rules={[ { required: true, message: 'من فضلك أدخل إسم المُستخدم', }, ]} > <Input size="large" prefix={<UserOutlined className="site-form-item-icon" />} placeholder="Username" /> </Form.Item> <Form.Item name="البريد الإلكتروني" rules={[ { required: true, message: 'من فضلك أدخل البريد الإلكتروني', }, ]} > <Input size="large" prefix={<MailOutlined className="site-form-item-icon" />} placeholder="Example@email.com" /> </Form.Item> <Form.Item name="رقم الهاتف" rules={[ { required: true, message: 'من فضلك أدخل رقم الهاتف', }, ]} > <Input size="large" type="Email" prefix={<MobileOutlined className="site-form-item-icon" />} placeholder="+X XXX XXX XXXX" /> </Form.Item> <Form.Item name="رقم المحفظة TRX" rules={[ { required: true, message: 'من فضلك أدخل رقم المحفظة', }, ]} > <Input size="large" prefix={<WalletOutlined className="site-form-item-icon" />} placeholder="TBia4uHnb3oSSZm5isP284cA7Np1v15Vhi" /> </Form.Item> <Form.Item name="password" rules={[ { required: true, message: 'من فضلك أدخل كلمة المرور', }, ]} > <Input prefix={<LockOutlined className="site-form-item-icon" />} type="password" size="large" placeholder="كلمة المرور" /> </Form.Item> <Form.Item> <Form.Item name="remember" valuePropName="checked" noStyle> <Checkbox>تذكرني</Checkbox> </Form.Item> <a className="login-form-forgot" href=""> نسيت كلمة المرور؟ </a> </Form.Item> <Form.Item> <Button style={{ width: '100%' }} size="large" shape="round" icon={<UserAddOutlined />} type="primary" htmlType="submit" className="login-form-button"> تسجيل حساب </Button> </Form.Item> </Form> </TabPane> </Tabs > </Modal> ); } export default Mod;" How can i show that modal on other js files when i click on a button? onClick={showModal}?
c601d153e5594133854a799678cc4382
{ "intermediate": 0.4145151674747467, "beginner": 0.4404750168323517, "expert": 0.1450098305940628 }
12,831
is possible to use || in *ngIf?
4844de66e9f55112d84894a14467ead8
{ "intermediate": 0.2828269302845001, "beginner": 0.2967434525489807, "expert": 0.42042970657348633 }
12,832
write me an email to follow up on my visa case which is under administrative process
c871eb049de8f32462a4080821837913
{ "intermediate": 0.3446432054042816, "beginner": 0.3120248019695282, "expert": 0.3433319926261902 }
12,833
using matlab code draw casscaded refragration scycle on p-h
901086f501d97dad18fc8d19e77f0f3f
{ "intermediate": 0.29395872354507446, "beginner": 0.19941215217113495, "expert": 0.5066291689872742 }
12,834
explain open three-layered architecture
0d0a1b49815643707cb14a1fba3e286e
{ "intermediate": 0.5328015685081482, "beginner": 0.20055878162384033, "expert": 0.26663970947265625 }
12,835
'float' object cannot be interpreted as an integer
a5af4272ee239bb57320ce7d07227d79
{ "intermediate": 0.4113800525665283, "beginner": 0.3537018299102783, "expert": 0.23491810262203217 }
12,836
[NETSDK1031] It is not supported to build or publish a self-contained application without specifying a RuntimeIdentifier. You must either specify a RuntimeIdentifier or set SelfContained to false. at
f8b18649706d99d27acb649fe49bb20a
{ "intermediate": 0.3889056146144867, "beginner": 0.269694983959198, "expert": 0.3413994014263153 }
12,837
show me request body and response body of this route const appInsights = require("applicationinsights"); app.post('/updatequotes', function(req, res) { const client_Ai = appInsights.defaultClient; const quotename = req.body.quotename; client_Ai.trackEvent({name: `Added new receiver`, properties: { Message: `Added new receiver for quote ${quotename}`}}); // Start receiving for new create quetename startReceiver(quotename); res.send('Received POST request with quotename: ' + quotename); });
6ff4d5128065db271a3f9a97c565f6cf
{ "intermediate": 0.4141518473625183, "beginner": 0.3425559401512146, "expert": 0.2432921826839447 }
12,838
data type 'np.float32' not understood怎么改、
addf67deb6954cb8e235a688b597cd6b
{ "intermediate": 0.2819141447544098, "beginner": 0.33582615852355957, "expert": 0.3822597861289978 }
12,839
global_store_class.bcs={1:1} ^ SyntaxError: invalid syntax why this is wrong
a519cb0126e19eed3316a210265278a0
{ "intermediate": 0.19407805800437927, "beginner": 0.6840237379074097, "expert": 0.12189827114343643 }
12,840
generate a javascript function that will recreate a table structure from a ocr result that has an array of arrays, try to split the column and rows as good as possible. elements are like this: first element of the array is an array representing the text rectangle, top left, top right, bottom right and bottom left, it looks like this: [ [ [ [207.0, 0.0], [230.0, 0.0], [230.0, 35.0], [207.0, 35.0], ], [‘1’, 0.7348307371139526], ], [ [ [351.0, 0.0], [716.0, 0.0], [716.0, 35.0], [351.0, 35.0], ], [‘ENERGIE ELECTRICA’, 0.9918891787528992], ], [ [ [1377.0, 3.0], [1447.0, 3.0], [1447.0, 43.0], [1377.0, 43.0], ], [‘pers’, 0.9991182684898376], ], [ [ [1550.0, 0.0], [1640.0, 0.0], [1640.0, 40.0], [1550.0, 40.0], ], [‘1,000’, 0.9995460510253906], ], [ [ [1852.0, 3.0], [1971.0, 3.0], [1971.0, 40.0], [1852.0, 40.0], ], [‘10,4758’, 0.9997211694717407], ], [ [ [2214.0, 3.0], [2302.0, 3.0], [2302.0, 43.0], [2214.0, 43.0], ], [‘10,48’, 0.9998644590377808], ], [ [ [202.0, 37.0], [232.0, 37.0], [232.0, 75.0], [202.0, 75.0], ], [‘2’, 0.9995154142379761], ], [ [ [351.0, 40.0], [987.0, 40.0], [987.0, 75.0], [351.0, 75.0], ], [‘ENERGIE ELECTRICA CONSUM PARC’, 0.9777751564979553], ], [ [ [1373.0, 44.0], [1444.0, 36.0], [1448.0, 76.0], [1377.0, 84.0], ], [‘pers’, 0.9989522099494934], ], [ [ [1553.0, 43.0], [1640.0, 43.0], [1640.0, 80.0], [1553.0, 80.0], ], [‘1,000’, 0.9985054731369019], ], [ [ [1855.0, 43.0], [1963.0, 43.0], [1963.0, 80.0], [1855.0, 80.0], ], [‘3,4989’, 0.9985577464103699], ], [ [ [2216.0, 45.0], [2294.0, 45.0], [2294.0, 83.0], [2216.0, 83.0], ], [‘3,50’, 0.9993970394134521], ], [ [ [310.0, 75.0], [592.0, 80.0], [591.0, 118.0], [310.0, 112.0], ], [‘SERVICII PAZA’, 0.9661298394203186], ], [ [ [202.0, 120.0], [232.0, 120.0], [232.0, 158.0], [202.0, 158.0], ], [‘3’, 0.9990814924240112], ], [ [ [344.0, 117.0], [607.0, 120.0], [607.0, 158.0], [343.0, 155.0], ], [’ SERVICII PAZA’, 0.963112473487854], ], [ [ [1390.0, 128.0], [1431.0, 128.0], [1431.0, 163.0], [1390.0, 163.0], ], [‘ap’, 0.9969583749771118], ], [ [ [1550.0, 123.0], [1640.0, 123.0], [1640.0, 160.0], [1550.0, 160.0], ], [‘1,000’, 0.9995529055595398], ], [ [ [1847.0, 123.0], [1968.0, 123.0], [1968.0, 160.0], [1847.0, 160.0], ], [‘64,9621’, 0.9998608827590942], ], [ [ [2211.0, 123.0], [2302.0, 123.0], [2302.0, 163.0], [2211.0, 163.0], ], [‘64,96’, 0.9999416470527649], ], ]
68e0a780a1d60ffef23d4ddf8e259a74
{ "intermediate": 0.29250892996788025, "beginner": 0.42581021785736084, "expert": 0.28168079257011414 }
12,841
Good morning
1d2cb3ba0ca26180e605763ef7671cc3
{ "intermediate": 0.3582304120063782, "beginner": 0.24733459949493408, "expert": 0.39443498849868774 }
12,842
import { createSlice, PayloadAction } from "@reduxjs/toolkit"; interface Product { _id: string; title: string; description: string; img: string; price: number; color: string[]; quantity: number; } interface InitialState { products: Product[]; quantity: number; total: number; } const initialState: InitialState = { products: [], quantity: 0, total: 0 }; const cartSlice = createSlice({ name: "cart", initialState, reducers: { addProduct: ( state, action: PayloadAction<{ product: Product; quantity: number; }> ) => { state.quantity += 1; state.products.push(action.payload.product); state.total += action.payload.product.price * action.payload.quantity; }, }, }); export const { addProduct } = cartSlice.actions; export default cartSlice.reducer; how to change the quantitiy inside the Product?
352e569b1d4ae656b7445767b4968964
{ "intermediate": 0.6118082404136658, "beginner": 0.212549090385437, "expert": 0.17564266920089722 }
12,843
<?php $connection_link = new mysqli("localhost", "root", "","free"); if ($connection_link === false) { die("ERROR: Not connected. ".$connection_link->connect_error); } $sql_query = "insert zakazi select * from vipolnenie"; if ($connection_link->query($sql_query) === true) { echo "Data Copied Successfully."; } else { echo "ERROR: Could not able to proceed $sql_query. " .$connection_link->error; } // Close the connection $connection_link->close(); ?> как сделать, чтобы этот код срабатывал по кнопке и переносил только те данные, которые относятся к этой кнопке
9fb2918959550f19334e415652c2e8b0
{ "intermediate": 0.3789065480232239, "beginner": 0.3852197229862213, "expert": 0.23587369918823242 }
12,844
Can you write a manual on how to use better prompt commands in hugging face
65a5e877b08a2aa74b3adb8bb5e6b68d
{ "intermediate": 0.29372456669807434, "beginner": 0.19892075657844543, "expert": 0.5073546171188354 }
12,845
how to concartenate different types of files into one and this one is easily rewritable
7fe3e61a91951f5b3824ddfdd9c7c2d2
{ "intermediate": 0.33625760674476624, "beginner": 0.32641857862472534, "expert": 0.33732378482818604 }
12,846
clc clear all load iris.dat; iris; trainDate=iris(1:100,:); testDate=iris(101:150,:); save('trainDate.text', 'trainDate','-ascii') save('testDate.text', 'testDate' ,'-ascii') [f1,f2,f3,f4,class]=textread('trainDate','%f%f%f%f%f',75); [input,minI,maxI] = premnmx([f1,f2,f3,f4]'); s=length(class); output = zerors(s,3); for i = 1:s output(i,class(i)) = 1; end net = newff(minmax(input),[10 3],{'logsig''purelin'},'traingdx'); net.trainparam.show = 50; net.trainparam.ep0chs = 500; net.trainparam.goal = 0.01; net.trainparam.lr = 0.01; net = train(net,input,output'); [t1 t2 t3 t4 c]=textread('testDate.txt','%f%f%f%f%f',150); testInput = tramnmx([t1,t2,t3,t4]',minI,maxI); Y=sim(net,testInput); [s1,s2]= size(Y); hitNum = 0; for i = 1:s2 [m,Index]=max(Y(:,i)); if(Index == c(i)) hitNum = hitNum+1; end end sprint('识别率是%3.3f%%',100*hitNum/s2) iw1=net.IW{1}; b1=net.b{1}; iw2=net.IW{2}; b2=net.b{2};
42402c81fc314cdb87e1878f167dedcc
{ "intermediate": 0.3306237459182739, "beginner": 0.3129029870033264, "expert": 0.35647326707839966 }
12,847
Act as a College Associate Professor Subject: Data Structures Chapter Topics: Abstract Data Types (ADTs) – List ADT – Array-based implementation – Linked list implementation – Singly linked lists – Circularly linked lists – Doubly-linked lists – Applications of lists – Polynomial ADT – Radix Sort – Multilists. Task: Generate a question paper for internal exam. The questions should be of the below pattern for 50 marks. The questions should be testing knowledge of 20%, application of 50%, analytical of 30%. Prefer selecting questions based on importance of concepts. Pattern: 10 one marks of which Fill in the blanks - 5, Match the following - 3, True or false - 2 5 two marks 2 fifteen marks Output: Generate the question paper only. Do not add more content. TEXT BOOKS 1. Mark Allen Weiss, Data Structures and Algorithm Analysis in C, 2nd Edition, Pearson Education, 2005. 2. Kamthane, Introduction to Data Structures in C, 1st Edition, Pearson Education, 2007 REFERENCES 1. Langsam, Augenstein and Tanenbaum, Data Structures Using C and C++, 2nd Edition, Pearson Education, 2015. 2. Thomas H. Cormen, Charles E. Leiserson, Ronald L.Rivest, Clifford Stein, Introduction to Algorithms", Fourth Edition, Mcgraw Hill/ MIT Press, 2022. 3. Alfred V. Aho, Jeffrey D. Ullman,John E. Hopcroft ,Data Structures and Algorithms, 1st edition, Pearson, 2002. 4. Kruse, Data Structures and Program Design in C, 2nd Edition, Pearson Education, 2006.
965d55ef59d29b4f9bf2f427128952f5
{ "intermediate": 0.2457824945449829, "beginner": 0.29545748233795166, "expert": 0.4587600827217102 }
12,848
SELECT * FROM GiaoVien V WHERE NOT EXISTS (SELECT * FROM MonHoc M WHERE NOT EXISTS (SELECT * FROM GiangDay G WHERE G.MaGV=V.MaGV AND M.MaMH=G.MaMH )) explant this sql code
504f7c37c69e5f5531ea5dffe8e9a0d5
{ "intermediate": 0.3377610743045807, "beginner": 0.2815452218055725, "expert": 0.3806937038898468 }
12,849
INTERNAL ASSESSMENT EVALUATION - DATA STRUCTURES Time: 3 hours Maximum Marks: 100 Instructions: 1. All questions are compulsory 2. Write your answers neatly and legibly 3. Read the questions carefully before answering 4. Draw figures wherever necessary 5. Use a non-programmable calculator wherever necessary Part A Answer all 10 questions. Each question carries one mark. 1. Fill in the blanks: a. The type of data structure that lists an element with its predecessor and successor is called ____________. b. The process of inserting elements in increasing or decreasing order in a Priority Queue is called ____________. c. In a Linked List, the first node is called ____________. d. While traversing through a Stack, the element first removed is the ____________. e. The time-complexity of a binary search algorithm is ____________. 2. Match the following: a. AVL tree i. Open Addressing b. Bubble Sort ii. Balanced Binary Search Tree c. Hashing iii. O(n²) d. Dijkstra’s Algorithm iv. Shortest Path Algorithm 3. True or False: a. B-Trees have a variable number of keys per node as compared to BSTs. (True/False) b. Selection Sort is faster than Quick Sort for large data sets. (True/False) Part B Answer all 5 questions. Each question carries two marks. 4. Explain the difference between a linked list and an array. 5. Differentiate between a stack and a queue. Provide real-life examples for both. 6. What is meant by priority queue? Explain the types of priority queues. 7. Write the algorithm to convert an arithmetic expression from Infix to Postfix notation. Provide an example. 8. Describe the difference between Breadth-First Traversal and Depth-First Traversal. Explain with suitable examples. Part C Answer any 2 of the following questions. Each question carries fifteen marks. 9. Write an algorithm for Binary Search Tree Insertion and explain its implementation. 10. Write notes on: a. Radix Sort b. Red-Black Tree c. Kruskal’s Algorithm 11. a. Explain the concept of hashing in detail. Describe the open addressing collision resolution technique. b. Implement Quick Sort algorithm in C programming language and explain its performance.
d99e5365840665bc658f2e577aa6ee38
{ "intermediate": 0.24209359288215637, "beginner": 0.23801171779632568, "expert": 0.5198946595191956 }
12,850
if i get a directory of files, then i want to store all files into a database , how to do it in python?
660b59a2089a48669d1a9f05e8209bea
{ "intermediate": 0.549694299697876, "beginner": 0.12297113239765167, "expert": 0.32733458280563354 }
12,851
I sued this signal_generator code: def signal_generator(df): # Calculate EMA and MA lines df['EMA5'] = df['Close'].ewm(span=5, adjust=False).mean() df['EMA10'] = df['Close'].ewm(span=10, adjust=False).mean() df['EMA20'] = df['Close'].ewm(span=20, adjust=False).mean() df['EMA50'] = df['Close'].ewm(span=50, adjust=False).mean() df['EMA100'] = df['Close'].ewm(span=100, adjust=False).mean() df['EMA200'] = df['Close'].ewm(span=200, adjust=False).mean() df['MA10'] = df['Close'].rolling(window=10).mean() df['MA20'] = df['Close'].rolling(window=20).mean() df['MA50'] = df['Close'].rolling(window=50).mean() df['MA100'] = df['Close'].rolling(window=100).mean() open = df.Open.iloc[-1] close = df.Close.iloc[-1] previous_open = df.Open.iloc[-2] previous_close = df.Close.iloc[-2] # Calculate the last candlestick last_candle = df.iloc[-1] current_price = df.Close.iloc[-1] ema_analysis = '' candle_analysis = '' # EMA crossover - buy signal if df.EMA10.iloc[-1] > df.EMA50.iloc[-1] and current_price > last_candle[['EMA10', 'EMA50']].iloc[-1].min(): ema_analysis = 'buy' # EMA crossover - sell signal elif df.EMA10.iloc[-1] < df.EMA50.iloc[-1] and current_price < last_candle[['EMA10', 'EMA50']].iloc[-1].max(): ema_analysis = 'sell' # EMA crossover - buy signal if df.EMA20.iloc[-1] > df.EMA200.iloc[-1] and current_price > last_candle[['EMA20', 'EMA200']].iloc[-1].min(): ema_analysis = 'buy' # EMA crossover - sell signal elif df.EMA20.iloc[-1] < df.EMA200.iloc[-1] and current_price < last_candle[['EMA20', 'EMA200']].iloc[-1].max(): ema_analysis = 'sell' # Check for bullish trends elif current_price > last_candle[['EMA5', 'EMA20', 'EMA50', 'EMA100', 'EMA200']].iloc[-1].max(): ema_analysis = 'buy' # Check for bearish trends elif current_price < last_candle[['EMA5', 'EMA20', 'EMA50', 'EMA100', 'EMA200']].iloc[-1].min(): ema_analysis = 'sell' # Check for bullish candlestick pattern if (open<close and previous_open>previous_close and close>previous_open and open<=previous_close): candle_analysis = 'buy' # Check for bearish candlestick pattern elif (open>close and previous_open<previous_close and close<previous_open and open>=previous_close): candle_analysis = 'sell' # Check if both analyses are the same if ema_analysis == candle_analysis and ema_analysis != '': return ema_analysis # If no signal is found, return an empty string return '' But I want to add MACD trading strategy , give me greatest MACD trading strategy please
f7437f9b96ebe254e8b24a88296639a6
{ "intermediate": 0.2929145395755768, "beginner": 0.38312211632728577, "expert": 0.32396334409713745 }
12,852
nested list html didn't give the nested list the margin
ed27ef96daee620bc7753197c38d737a
{ "intermediate": 0.35296371579170227, "beginner": 0.2496756613254547, "expert": 0.3973606526851654 }
12,853
rust Failed to read file with rustc compiler while no errors with rustenhanced
39d3701a04572aadd7e205f1a53c89e1
{ "intermediate": 0.4882594645023346, "beginner": 0.21831296384334564, "expert": 0.2934275269508362 }
12,854
Write a short job description for a sales manager position in the air compressor industry in Belgium
066c4bfa85cd0c374f223c8f670ee12b
{ "intermediate": 0.38941341638565063, "beginner": 0.26052916049957275, "expert": 0.3500573933124542 }
12,855
const Cart = () => { const cart = useAppSelector((state) => state.cart); const [stripeToken, setStripeToken] = useState(); const onToken = (token) => { setStripeToken(token); }; return ( <Container> <Navbar /> <PromoInfo /> <Wrapper> <Title>YOUR CART</Title> <Top> <TopButton>CONTINUE SHOPPING</TopButton> <TopTexts> <TopText>Shopping Bag(2)</TopText> <TopText>Your Wishlist(0)</TopText> </TopTexts> <TopButton buttonType="filled">CHECKOUT NOW</TopButton> </Top> <Bottom> <Information> {cart.products.map((product) => ( <Product> <ProductDetail> <Image src={product.img} /> <Details> <ProductName> <b>Product:</b> {product.title} </ProductName> <ProductId> <b>ID:</b> {product._id} </ProductId> {product.color?.map((color, i) => ( <ProductColor key={i} color={color} /> ))} </Details> </ProductDetail> <PriceDetail> <ProductAmountContainer> <AddIcon /> <ProductAmount>{product.quantity}</ProductAmount> <RemoveIcon /> </ProductAmountContainer> <ProductPrice> {product.price * product.quantity}PLN </ProductPrice> </PriceDetail> </Product> ))} <Hr /> </Information> <Summary> <SummaryTitle>ORDER SUMMARY</SummaryTitle> <SummaryItem> <SummaryItemText>Subtotal</SummaryItemText> <SummaryItemPrice>{cart.total}PLN</SummaryItemPrice> </SummaryItem> <SummaryItem> <SummaryItemText>Estimated Shipping</SummaryItemText> <SummaryItemPrice>5.90PLN</SummaryItemPrice> </SummaryItem> <SummaryItem> <SummaryItemText>Shipping Discount</SummaryItemText> <SummaryItemPrice>-5.90PLN</SummaryItemPrice> </SummaryItem> <SummaryItem type="total"> <SummaryItemText>Total</SummaryItemText> <SummaryItemPrice>{cart.total}PLN</SummaryItemPrice> </SummaryItem> <StripeCheckout name="FABICO" image="https://avatars.githubusercontent.com/u/1486366?v=4" billingAddress shippingAddress description={`Your total is $${cart.total}`} amount={cart.total * 100} token={onToken} stripeKey={KEY || ""} > <SummaryButton>CHECKOUT NOW</SummaryButton> </StripeCheckout> </Summary> </Bottom> </Wrapper> <Footer /> </Container> ); }; export default Cart; Parameter 'token' implicitly has an 'any' type. No overload matches this call. Overload 1 of 2, '(props: StripeCheckoutProps | Readonly<StripeCheckoutProps>): StripeCheckout', gave the following error. Type '{ children: Element; name: string; image: string; billingAddress: true; shippingAddress: true; description: string; amount: number; token: (token: any) => void; stripeKey: string; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<StripeCheckout> & Readonly<StripeCheckoutProps>'. Property 'children' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<StripeCheckout> & Readonly<StripeCheckoutProps>'.
702bc492521349b0cfd7f4307edbd1be
{ "intermediate": 0.35398420691490173, "beginner": 0.5248886346817017, "expert": 0.12112720310688019 }
12,856
this is a reactjs antdesign component, those 2 columns aren't on the same line. fix it: "<Row className="hidden-sm" justify="space-around" align="middle" style={{marginTop:'-180px', padding:'0 50px 0 50px'}}> <Col span={12}> <Title level={1} style={{ color: '#DDDCDC', marginTop: '-10' }}>قم بالمهام البسيطة وتقاضى الأجر!</Title> <p style={{ color: '#AEADAD' }}> كل ما عليك فعله هو تقييم الخدمات التجارية عبر الإنترنت وسندفع لك المال مقابل كل تقييم تقوم به، <br /> فقط قم بعمل حساب جديد ويمكنك البدء في تنفيذ المهام على الفور! </p> <Button type="primary" shape="round" size="large" icon={<PhoneOutlined />} style={{ boxShadow: '0 5px 20px rgba(94, 74, 227, .6)' }}> تواصل معنا </Button> </Col> <Col span={12}> <img src={fimg} alt="كريبتوتاسكي" style={{ width: "100%", maxHeight: '400px', objectFit: "cover" }} /> </Col> </Row>"
aedb1ce1fedb76541c762ab1d1c661d3
{ "intermediate": 0.24609869718551636, "beginner": 0.4962511956691742, "expert": 0.25765007734298706 }