Coding
814 prompts available
Add Photo Button Function
Implement functionality for the "Add Photo" button that enables users to select and insert a photo from their PC. Ensure the button triggers the file selection dialog allowing users to browse their local filesystem for image files. Upon selection, the chosen photo should be integrated or displayed as intended in the application. # Steps 1. Attach an event listener to the "Add Photo" button to respond to user clicks. 2. Trigger the file input dialog allowing selection of image files (e.g., JPEG, PNG). 3. Capture the file(s) selected by the user. 4. Validate the file type and size if necessary. 5. Render or insert the selected photo into the designated area of the application. # Output Format Provide the implementation code snippet in the appropriate programming language or framework used (e.g., JavaScript with HTML). Include comments explaining key parts of the code for clarity.
80s Style Restaurant Script
Create a comprehensive restaurant management script themed around an 80s-style diner. The script must include the following features: - **Cooking Marker:** A specific in-game location (marker/target) where employees go to cook food. - **Food Purchase Marker:** A separate marker where players can buy food. - **Yellow Themed Menu UI:** Develop a yellow-colored pop-up menu interface for buying food, supporting configurable PNG icons for food items. - **Boss Menu:** Implement a fully functional boss menu that allows management of employees, including hiring, firing, managing salaries, and handling financial transactions such as withdrawing and depositing money into the job society account. - **Configurability:** The entire script should be fully configurable. Provide at least three example restaurants within the configuration illustrating different setups. - **Animations:** Integrate appropriate animations for cooking activities. - **Cleaning Job:** Add a cleaning task where employees must mop specified vector locations defined in the configuration. Ensure all elements align with an 80s style theme and that the script is modular and easy to customize. Use clear markers for interactive points and ensure UI elements are visually distinct with the specified color scheme. # Steps 1. Define the structure of the script with separate modules for cooking, purchasing, boss management, and cleaning. 2. Configure markers in the game world: one for cooking, one for buying food, and cleaning areas. 3. Design the yellow-themed menu UI with configurable PNG images for food items. 4. Develop the boss menu features with employee and financial management functionalities. 5. Implement animations matching cooking and cleaning actions. 6. Include at least three sample restaurant configurations showcasing different names, menus, and marker locations. 7. Provide full configurability for all aspects (menus, animations, markers, jobs). # Output Format Provide the full design and code snippets as necessary in a structured format, including configuration examples for three distinct 80s-style restaurants. Include comments explaining key functionalities and how to customize each part of the script. Include details on where to place the cooking, buying, and cleaning markers and how to modify the yellow-themed menu and boss menu options. # Notes - Ensure the color scheme for menus is a clearly visible yellow tone. - Use PNGs that can be loaded or replaced via configuration. - Animations should fit the 80s diner aesthetic. - Ensure the script supports multi-user environments where employees and bosses can interact concurrently.
9EMA MT5 AI Bot
Create a detailed and effective MetaTrader 5 (MT5) expert advisor (EA) AI bot that uses the 9-period Exponential Moving Average (9 EMA) as its core trading indicator. The bot should be designed to analyze market data, identify trading signals based on the 9 EMA crossover or other related strategies, and execute buy or sell orders automatically. Requirements: - Implement the 9 EMA indicator calculation on price data. - Develop trading logic that triggers entries and exits based on the 9 EMA pattern or crossovers. - Incorporate risk management features such as stop-loss, take-profit, and position sizing. - Optimize the bot’s decision-making process for various market conditions. - Provide clear and structured MQL5 code compatible with the MT5 platform. # Steps 1. Explain the concept and calculation of the 9 EMA. 2. Outline the trading strategy using the 9 EMA (e.g., buy when price crosses above the 9 EMA, sell when it crosses below). 3. Develop the EA structure, including initialization, deinitialization, and the OnTick function. 4. Code the 9 EMA indicator logic. 5. Implement signal detection and trading order execution. 6. Add risk management parameters. 7. Include comments and documentation within the code for clarity. # Output Format Provide the complete MQL5 source code for the MT5 expert advisor implementing the 9 EMA trading strategy. Include comprehensive comments explaining each part of the code and a summary of how the bot operates.
Add Popups for Combos and Proxies
Enhance the existing application by adding all necessary improvements, including implementing popup interfaces that allow users to select combos and proxies seamlessly. Details: - Identify and integrate all required improvements to optimize performance and user experience. - Design and implement a popup UI component for selecting combos. - Design and implement a similar popup UI component for selecting proxies. - Ensure that the popups are user-friendly, responsive, and maintain consistency with the overall application design. - Include validation and error handling for selections within the popups. - Maintain clear and manageable code structure for easy maintenance and scalability. Steps: 1. Review the current application code and functionality. 2. List all improvements necessary for optimization and user experience. 3. Develop popup components for combos and proxies selection. 4. Integrate the popup components with the existing application logic. 5. Test the popups thoroughly for different scenarios and edge cases. 6. Refactor code as needed for clarity and maintainability. Output Format: Provide a detailed implementation plan and, where appropriate, sample code snippets or pseudo-code demonstrating how to implement the popup selection features and the associated improvements. If code is provided, ensure it is well-documented and follows best practices.
Add Product Upload and Sorting
You are tasked with enhancing an existing codebase by adding a product uploading system and a modern product sorting system. Your goal is to provide production-ready, copy-paste code snippets that seamlessly integrate with the existing system. Requirements: 1. **Product Uploading System:** - The system should allow uploading products into targeted categories and their respective subcategories. - It should also allow selecting some products as featured. 2. **Product Sorting System:** - Implement a modern sorting mechanism for products. - Sorting options should include "new", "popularity", and potentially others relevant to e-commerce. 3. **Code Formatting:** - Each code snippet should have the first line indicating the file path and name, e.g., `# products/models.py`. 4. **Production Ready:** - The code must be fully functional and ready to be integrated without additional modifications. - Include necessary imports, model definitions, or views as needed. 5. **Clarification:** - If you require the existing code or more information about the current architecture, ask before proceeding. # Steps - Request the existing codebase or relevant parts if not provided. - Design and provide model updates or additions for products, categories, subcategories, and featured flags. - Implement forms or serializers as needed for product uploading. - Implement views or APIs to handle the upload process targeting categories/subcategories and setting featured products. - Implement sorting logic that supports modern sorting criteria. - Provide each code snippet starting with a comment that describes the file path. # Output Format - Provide each code file contents with the first line being a comment denoting the file path. - Provide clean, well-commented, and ready to copy code sections. # Notes - Do not assume the existing code structure; clarify if necessary. - Focus on clean and maintainable code suitable for production. - Use consistent naming conventions.
Aajtak Clone Next.js
Create a complete clone of the news website Aajtak using Next.js. This task involves developing a fully functional and visually accurate replica of Aajtak's website, utilizing Next.js framework for React. Ensure that the clone includes the main features such as news categories, article lists, detailed news pages, multimedia content support (images, videos), responsive design for various devices, navigation menus, and footer sections. Pay close attention to replicating the user interface style, color schemes, typography, and interactive elements to closely match the original Aajtak site. Use best practices for Next.js, including server-side rendering, dynamic routing, and optimized image handling. Implement clean, modular, and maintainable code. # Steps 1. Analyze the Aajtak website's structure, layout, and key components. 2. Set up a new Next.js project with required dependencies. 3. Create the homepage with news sections and headlines. 4. Implement internal pages for different news categories. 5. Build article detail pages with full content and media. 6. Add navigation and footer consistent with the original site. 7. Ensure responsive design for desktop, tablet, and mobile views. 8. Optimize loading performance and accessibility. # Output Format Provide the full Next.js project source code organized in standard folders (pages, components, public, styles, etc.). Include README documentation describing setup and any important notes. # Notes - You do not need to implement backend APIs; mock data or static generation is acceptable. - Focus on frontend replication and Next.js features. - Avoid copyrighted content; use placeholder text or open news sources for sample data.
Aajtak News Website Clone
Create a fully functional clone of the Aajtak news website using Next.js for the frontend and Mongoose with MongoDB for the backend. The website should be optimized for high performance and fast loading speeds. Key Features: - Admin Dashboard: Implement a secure admin interface where the admin can add, edit, and delete news posts efficiently. - News Posts Management: Each news article should include title, content, images, categories, publication date, and author details. - Responsive Design: The UI should be fully responsive and resemble the look and feel of the Aajtak news website. - Routing and Navigation: Properly handle client-side and server-side routing for fast loading and SEO. - Data Validation and Security: Ensure data validation, authentication for admin users, and secure API endpoints. # Steps 1. Set up a Next.js project with server-side rendering. 2. Design database schemas using Mongoose for news posts and admin user authentication. 3. Create RESTful API endpoints for CRUD operations on news posts. 4. Build an admin dashboard with forms to create, update, and delete posts. 5. Replicate Aajtak's homepage layout and article pages. 6. Optimize for performance including image optimization and caching. 7. Implement authentication and authorization for admin users. # Output Format - Provide the complete source code organized into frontend and backend modules. - Include detailed instructions on how to set up the development environment, run the project locally, and deploy. - Document API endpoints and admin dashboard usage. # Notes - Focus on replicating core functional and visual aspects but avoid copyrighted content. - Prioritize high-speed performance and SEO best practices.
Add Progress Bar to Function
As a senior JavaScript and PHP developer, analyze the following code in detail. Your primary task is to integrate a progress bar that reflects the progress of the function `fetchAllGooglePages`. You must keep the existing code structure intact and only modify or add the necessary components to implement the progress bar. ## Steps 1. Review the code to understand its structure and the logic of the `fetchAllGooglePages` function. 2. Identify where in the process you can track progress and display updates on the progress bar. 3. Implement a progress bar using JavaScript (and PHP if server-side interaction is required) that dynamically updates as `fetchAllGooglePages` progresses. ## Output Format - Provide the modified code, ensuring all added or changed components are clearly marked and explained. - Include comments within the code to highlight and explain the added progress bar functionality. - Ensure the code is clear, functional, and demonstrates the progress bar working seamlessly with `fetchAllGooglePages`. ## Notes - Ensure all implementations are compatible with current web standards and best practices. - Consider edge cases and potential pitfalls within the function when implementing the progress bar. Make sure your implementation does not introduce any errors or impede the current functionality. - Assume no additional external libraries are to be used unless absolutely necessary.
AarogyasriPortal SQL Integration
You are tasked with managing and enhancing a Java-based project named "AarogyasriPortal" that includes a directory structure for demo Java classes and resource SQL queries. In this project: - The "demo" directory contains various Java source files related to data export, database connection, CSV writing, file transfer, logging utilities, and a new file named "SqlQueryLoader.java". - The "resources/queries" directory contains SQL query files, with a newly added file "patient_query.sql". Your main objectives are: 1. Understand the role and integration of the new "SqlQueryLoader.java" class within the existing demo Java files. This class likely handles loading SQL queries from external resources. 2. Understand how the "patient_query.sql" script is composed and how it will be used by the "SqlQueryLoader" and other Java classes. 3. Outline or implement the interactions to load SQL queries from external files and use them in Java code to perform database operations. 4. Ensure that the loading of SQL from resource files is efficient, reusable, and integrates seamlessly into the existing project structure. 5. Suggest any best practices or improvements for managing SQL queries and Java integration in this context. # Steps - Review the existing Java classes for database connection, CSV writing, logging, and file transfer to understand how SQL queries are currently handled. - Examine "SqlQueryLoader.java" to determine how it loads SQL query strings (likely from resource files). - Analyze "patient_query.sql" for its query content. - Demonstrate or describe how "SqlQueryLoader.java" can be invoked to load "patient_query.sql" and how the loaded query can be executed using the database connection. - Provide sample Java code snippets or usage pattern illustrating this integration. # Output Format Provide a detailed technical explanation and/or Java code example showing how "SqlQueryLoader.java" loads SQL files from the resources directory, specifically "patient_query.sql", and how this is used in the existing project to execute queries. Include any relevant class or method signatures, and explain integration points succinctly and clearly. # Examples Example snippet for loading SQL query: ```java SqlQueryLoader loader = new SqlQueryLoader(); String patientQuery = loader.loadQuery("patient_query.sql"); // Use patientQuery with DatabaseConnection to execute ``` Example directory usage: - Resources path: "/queries/patient_query.sql" - Loading resource as stream and reading content as a string. # Notes - Make sure to consider classpath resource loading best practices in Java. - Emphasize maintainability and separation of concerns (SQL query management outside of Java source code). # Response Formats Provide only the technical explanation and required code snippets, no extra commentary.
Add Project Section
Enhance the HTML code by adding a project section, complete with CSS styling for a consistent visual presentation. ## Steps 1. **Identify Project Section Placement**: Add the project section below the Qualifications section and before the Contact Me section. 2. **HTML Structure**: - Use a section tag with an appropriate id and class name (e.g., `id="project"`, `class="project section"`). - Include a section title and any project-related content such as descriptions, images, or links. 3. **CSS Styling**: - Add styles in the CSS file to ensure the project section matches the website's overall design (e.g., consistent fonts, colors, layout). - Use existing class patterns or define new styles if necessary. ## Output Format Provide: - A complete HTML snippet for the new project section. - Relevant CSS code that aligns the new section with the rest of the webpage. ## Example ### HTML Snippet ```html <section class="project section" id="project"> <h2 class="project section__title">Projects</h2> <span class="section__subtitle">My recent work</span> <div class="project__container"> <!-- Example project item --> <div class="project__item"> <img src="asset/project1.webp" alt="Project Title" class="project__img"> <h3 class="project__title">Project One</h3> <p class="project__description">Brief description of the project, its purpose, and technologies used.</p> <a href="#" class="btn project__btn">View Project</a> </div> <!-- Add additional projects, if any --> </div> </section> ``` ### CSS Example ```css .project { background-color: #f8f9fa; padding: 4rem 0; } .project__img { width: 100%; height: auto; border-radius: 8px; margin-bottom: 1.5rem; } .project__title { font-size: 1.5rem; color: #333; margin-bottom: 0.5rem; } .project__description { font-size: 1rem; color: #666; margin-bottom: 1.5rem; } .project__btn { text-decoration: none; background-color: #007bff; color: #fff; padding: 0.75rem 1.5rem; border-radius: 4px; } .project__btn:hover { background-color: #0056b3; } ``` ## Notes - Ensure that the IDs and classes used in the HTML correspond with the CSS styles to maintain consistency. - Review and test the layout after code integration to ensure it meets visual and functional expectations.
Aave Flash Loan Solidity
Develop efficient and secure Ethereum flash loan smart contracts in Solidity that implement advanced financial strategies such as arbitrage, collateral swapping, and liquidity provision using the Aave lending platform. Ensure the contracts include robust error handling, thorough in-line comments, and adhere to best security practices to prevent vulnerabilities like reentrancy, while being gas efficient. Your implementation must include: - Setting up a smart contract project environment using Hardhat or Truffle. - Integrating with Aave protocol interfaces to initiate and receive flash loans. - Solidity functions that initiate flash loans, execute financial strategies atomically (e.g., arbitrage between decentralized exchanges), and repay borrowed assets with fees within a single transaction. - Comprehensive checks ensuring loan repayment and handling edge cases such as slippage, liquidity shortages, and transaction failures. - Usage of Solidity version compatible with the latest Aave contracts (>=0.8.x), with proper pragma statements and relevant imports from Aave and OpenZeppelin. - Thorough testing and simulation instructions for local blockchain environments before deployment. # Steps 1. Initialize a Solidity project with Hardhat or Truffle. 2. Add dependencies and interfaces from the Aave protocol. 3. Implement a Solidity smart contract inheriting from IFlashLoanReceiver or equivalent interface to handle flash loan callbacks. 4. Define functions to carry out chosen financial strategies (arbitrage, collateral swap, liquidity provision) within the flash loan execution context. 5. Incorporate require/assert statements and error handling to validate loan repayment, strategy success, and edge case scenarios. 6. Embed detailed, clear in-line comments explaining logic, parameter usage, and security considerations. 7. Test the contract rigorously in a local or simulated blockchain environment (e.g., Hardhat Network) against various scenarios, ensuring safety and expected behavior. # Output Format Provide the full Solidity smart contract source code implementing the flash loan logic with: - Comprehensive, descriptive comments throughout. - Neatly organized and formatted code for readability. - A concluding summary outlining deployment procedures and instructions on how to utilize the contract effectively. # Examples - A flash loan arbitrage contract that borrows ETH via Aave, conducts asset swaps across two decentralized exchanges exploiting price discrepancies, and repays the loan plus fees successfully within one atomic transaction. - A collateral swapping contract using flash loans to atomically and safely switch collateral types within lending protocols. - A liquidity provisioning contract leveraging flash loans to add liquidity into decentralized exchange pools at optimal moments to maximize returns. # Notes - Prioritize gas optimization and security standards. - Avoid deprecated Aave interfaces; use the most current and maintained versions. - Explicitly note any assumptions or constraints within the code comments. - Highlight how common issues like slippage and liquidity shortages are handled. - Emphasize secure coding practices to mitigate reentrancy and other vulnerabilities. Execute this task with precision to help developers create maintainable, secure, and effective flash loan solutions with the Aave protocol on Ethereum.
Add Prompt Style Dropdown
Add a dropdown field to the application interface that allows the user to select which prompt style they would like to use. The dropdown should include the following three options with their full descriptions and use cases: 1. **RTF (Role, Task, Format) — Best for Quick Components** - Usage: Ideal for coding UI components quickly. - Description: Forces specification of the technical stack in the "Format" section. - Example: Role: Senior Full-Stack Developer; Task: Create a responsive navigation bar with a glassmorphism effect; Format: Provide a single file with HTML, CSS (using Tailwind 2026 classes), and vanilla JavaScript for the mobile toggle. 2. **COAST (Context, Objective, Actions, Scenario, Task) — Best for Complex Apps** - Usage: Recommended for building entire features or multi-step logic. - Description: Provides necessary environmental details, including user scenarios. - Example: Context: Building a 2026-standard e-commerce dashboard; Objective: Implement a real-time inventory chart; Actions: Use Chart.js, fetch data from a mock API, and handle loading states; Scenario: User is on a mobile device with slow latency; Task: Write the JS logic and corresponding HTML/CSS. 3. **CRISPE (Capacity, Role, Insight, Statement, Personality, Experiment) — Best for Debugging** - Usage: Suitable when code doesn't work and multiple potential fixes are needed. - Description: Includes "Insight" section for error logs and "Experiment" for testing fixes. - Example: Insight: "The CSS Grid isn't aligning on Safari 2026; here is the current code..."; Experiment: "Provide three different methods to fix this: one using Flexbox, one using Grid, and one using container queries". Include instructions or tooltips in the UI to help users understand each prompt style and select the one best suited for their coding task. **Additional guidance:** - Ensure the dropdown is easily accessible and clearly labeled, for example, "Select Prompt Style". - When a prompt style is selected, display a brief summary or usage guide dynamically. - Adhere to modern coding standards for implementation. # Output Format Provide the implementation code or UI specification needed to add this dropdown field within the existing app context. If applicable, include JSON or component code snippets for clarity. # Notes - The dropdown options should preserve the exact prompt style names (RTF, COAST, CRISPE). - Descriptions should help users quickly discern which prompt style fits their needs. - The dropdown is intended to enhance usability by guiding prompt construction based on user goals.