Back to Learning

Coding

814 prompts available

Adjust Chart Layout

You are helping to update a Python script that currently generates several charts, including a heatmap. The user wants to modify the script as follows: - Remove or delete the heatmap generation code entirely. - Adjust the layout of the generated charts so they are positioned next to each other horizontally rather than stacked or overlapping vertically. When making these changes, carefully: 1. Identify and remove all parts of the code related specifically to heatmap generation. 2. Modify the figure layout or subplot configurations so that the remaining charts are arranged side by side, ensuring no overlap. 3. Maintain the original functionality of the other charts intact besides the heatmap removal and layout adjustment. If you need to assume any details (e.g., plotting library in use, figure size), do so conservatively, but prioritize clarity and readability of the resulting code. # Steps - Parse the existing script to locate and remove heatmap code. - Adjust subplot creation or figure layout parameters to align charts horizontally. - Verify that chart spacing and labels remain clear. # Output Format Provide the revised Python script code snippet with the described changes applied, including necessary comments to explain the removal of heatmap and the updated chart layout. # Notes If multiple charts exist, consider using methods such as `plt.subplots` with `ncols` parameter or adjusting axes positions to achieve horizontal chart layout. # Response Format Only output the updated code snippet and minimal explanatory comments, no additional text.

Adjust cWGAN-GP Augmentation

You have implemented a cWGAN-GP model that was originally trained on an unbalanced dataset, using data augmentation to balance the dataset. Now, you have a balanced dataset and want to adjust your existing training script accordingly. Modify your script so that it **does not perform data augmentation for balancing** purposes anymore. Instead, implement **default image augmentation** that **increases the number of samples** by applying transformations using the MONAI framework. Specifically, ensure your augmentation pipeline includes the following transformations with appropriate parameters: - Small random rotations (limited degree range) - Rotation along the y-axis - Gaussian noise addition - Contrast adjustment Update all relevant code cells or script sections that are affected by these changes. # Steps 1. Identify parts of your script where data augmentation was applied for balancing. Remove or disable any balancing-specific augmentation logic. 2. Implement a MONAI-based augmentation pipeline applying the four transformations above: - For rotations: apply small random rotations around relevant axes. - For rotation along the y axis, configure a spatial transform that achieves this. - Add Gaussian noise with moderate variance. - Adjust contrast slightly to augment image appearance. 3. Apply this augmentation pipeline as default to all images during data loading or training. 4. Adjust the dataset or dataloader code so that the augmented dataset size increases — meaning that augmentation creates additional synthetic samples beyond the original data count. 5. Test your updated script to verify the changes. # Output Format Provide the updated script or relevant code cells with MONAI augmentation integrated as specified, and comments clarifying changes made for the default augmentation pipeline. # Notes - Ensure compatibility with MONAI's transforms and pipeline conventions. - Maintain the original training logic aside from augmentation changes. - Keep augmentation parameters moderate to avoid unrealistic distortions. # Response Formats ## prompt {"prompt":"[The full clear instruction and code adjustments as detailed above]","name":"Adjust cWGAN-GP Augmentation","short_description":"Modify cWGAN-GP training script to replace balancing augmentations with default MONAI augmentations.","icon":"SparklesIcon","category":"programming","tags":["Machine Learning","Data Augmentation","MONAI","GAN"],"should_index":true}

Adjust DateTime Function

Create a Java function that can adjust any given datetime based on a specified custom day end time. The function should take two parameters: a datetime object (of type `LocalDateTime` or `ZonedDateTime`) and a custom day end time (of type `LocalTime`). The function will return the adjusted datetime. If the input datetime is before the custom day end, the function should return the original datetime. If it is after, it should calculate the difference and adjust the datetime to the day end accordingly. Make sure to handle scenarios where the custom day end is on the next day as well.

Adjust EA Entry Logic

Adjust the existing Expert Advisor (EA) to modify only its entry logic based on a specified indicator's signals without changing the EA's overall trading logic. Detailed Instructions: - Preserve the original EA's core logic and functionality. - Change only the entry conditions by incorporating the indicator's order placement function. - The indicator plots an upper line; when this upper line is present, the EA should place orders parallel to this indicator line. - Ensure that the order placement aligns correctly with the indicator's upper line position. - Maintain code clarity and ensure no other EA components are altered. # Steps 1. Analyze the original EA's entry logic to understand how and where orders are placed. 2. Integrate the provided indicator's order placement function into the EA's entry conditions. 3. Implement logic to detect when the indicator plots the upper line. 4. Modify the order placement so that when the upper line is detected, orders are placed parallel to that line. 5. Test to confirm only entry logic is altered and EA behavior aligns with indicator signals. # Output Format Provide the modified EA code snippet or full code with the updated entry logic clearly commented, highlighting where changes were made to incorporate the indicator's signals and order placement parallel to the indicator's upper line. # Notes - Do not modify exit logic, risk management, or other non-entry parts of the EA. - Ensure the integration respects the indicator's update frequency and data availability. - The 'parallel to indicator' placement means orders are aligned in price or time dimension relative to the upper line plotted by the indicator. # Example // Original EA entry logic snippet // if(condition) { placeOrder(); } // Modified entry logic snippet // if(indicatorPlotsUpperLine()) { placeOrderParallelToIndicatorLine(); } else { placeOrderOriginalWay(); }

Adjust PetaniMonitor GUI

Adjust and extend the existing Java Swing JFrame GUI code in the file PetaniMonitor.java based on the logic and content of the file Petani.java. PetaniMonitor.java already includes code using CardLayout, and the provided Petani.java contains the core program logic. You must not replace or extensively modify the existing code in PetaniMonitor.java; instead, add or adapt code as needed to integrate or reflect the Petani.java functionality while maintaining the current GUI structure and flow. Importantly, do not use ArrayList or similar dynamic collections. Find alternative data structures or approaches (such as arrays or other available collections) to implement the logic. Make sure your additions or adjustments comply with the constraints of Java Swing GUI programming and CardLayout usage in PetaniMonitor.java. - Analyze Petani.java to understand its logic and data management. - Identify where and how to integrate this logic into PetaniMonitor.java's GUI code. - Avoid replacing existing code; add supplementary code to extend functionality. - Use non-ArrayList data structures only. - Ensure the GUI components and CardLayout navigation remain functional and coherent. # Steps 1. Review Petani.java for core logic and functionalities. 2. Review PetaniMonitor.java GUI structure and existing CardLayout handling. 3. Plan where to inject or extend code in PetaniMonitor.java without replacing existing content. 4. Implement data handling and logic from Petani.java using alternative to ArrayList (e.g., arrays). 5. Adapt the GUI components interaction and event handling accordingly. 6. Test for functional integration and correct navigation with CardLayout. # Output Format Provide the complete updated or extended source code for PetaniMonitor.java reflecting the applied changes and integration. Include comments where you add or modify code to specify what has been adjusted or added. Do not change or delete existing unrelated code. Only add or modify code snippets necessary to adapt Petani.java logic within PetaniMonitor.java, conforming to the given constraints. # Notes - The task focuses on integration respecting constraints and existing code integrity. - Avoid ArrayList or similar collection usage. - Maintain Java Swing GUI standards and best practices.

Adjust Trade Session Filter MQL5

Modify the existing MQL5 trade session filter function to ensure it correctly handles trade session times for the West Central Africa region, or alternatively, make the function adjustable to suit any region's local time. The function should prevent trading outside the defined session and during filtered news events, in line with global best practices for MQL5 trading conditions. Requirements: - The function must accurately determine if the current time is within the allowed trading session, considering time zones and daylight saving changes. - The trade session times should either be adjustable via input parameters or specifically configured for the West Central Africa time zone. - Ensure the function checks for news filter conditions that disable trading during specified news events. - The function must be compatible with global MQL5 standards, avoiding hardcoded time zone values that may cause incorrect filtering. - Provide thorough commenting and clear variable names to make the function adaptable for various regions. Steps: 1. Analyze the existing trade session check code to identify hardcoded time parameters. 2. Introduce input parameters for session start and end times, and a time zone offset if necessary. 3. Adjust the comparison logic to convert the current server time to the specified local time before checking session validity. 4. Incorporate a news filter mechanism to disable trading during high-impact news events. 5. Test the modified function ensuring it correctly blocks trades outside the defined session and during news events for the West Central Africa time zone and other arbitrary zones based on input. Output Format: Provide the complete MQL5 function code with input parameters, detailed comments, and clearly marked sections for session adjustments and news filtering. Ensure the code compiles cleanly and is ready for integration into an Expert Advisor or indicator. Example: ```mql5 // Input parameters for session times and timezone input int SessionStartHour = 9; // Example: 9 AM in local time input int SessionEndHour = 17; // Example: 5 PM in local time input int TimeZoneOffset = 1; // GMT+1 for West Central Africa bool IsTradeSession() { // Convert server time to local time considering TimeZoneOffset datetime currentTime = TimeCurrent() + TimeZoneOffset * 3600; int currentHour = TimeHour(currentTime); // Check if current time is within session if(currentHour >= SessionStartHour && currentHour < SessionEndHour) return true; else return false; } ``` Notes: - Assume TimeCurrent() returns server time in GMT. - Remember to handle day rollover if sessions span midnight. - News filter implementation should be documented separately or integrated based on available news data.

Adjustable Currency Pair Script

Adjust the provided trading script so that it can be easily configured to work with any currency pair, not just XAUUSD. To achieve this, introduce a variable or input parameter that allows the user to specify the desired symbol (currency pair or instrument) dynamically. Ensure the script references this parameter consistently wherever the symbol is used, including data fetching, indicator calculations, and order placements. Maintain all existing functionality and logic while making the code adaptable to different symbols. # Steps 1. Identify all occurrences of the hardcoded symbol 'XAUUSD' in the script. 2. Replace these hardcoded references with a variable or input parameter named, for example, `symbol`. 3. Provide a mechanism (such as a script input or function argument) to allow the user to set this `symbol` when running the script. 4. Ensure that all functions and operations using the symbol refer to this parameter. 5. Test the script with multiple currency pairs and instruments to verify correctness. # Output Format Present the modified script code with clear inline comments explaining the changes made to enable symbol configurability. Include any necessary instructions on how to set the desired symbol when running the script.

ADK Main Orchestrator

You are the main orchestrator agent built using ADK. Your task is to evaluate user queries and route them efficiently to one or more subagents based on query intent and provided parameters. Steps to follow: 1. **Validation:** For each user query, first verify required parameters: - Customer/Loyalty queries require: customer email or orgID or identityID. - Order-related queries require: orderNumber or invoiceID. - Queries about rewards related to an order require both: - (email or orgID or identityID) AND (orderNumber or invoiceID). If any required parameters are missing, ask the user explicitly to provide the missing data before proceeding. 2. **Routing Rules:** - For customer data: - If input includes identityID or orgID, route to `loyalty_agent` only. - If input includes email, route first to `customer_agent`, then to `loyalty_agent`. - For queries about what happened to rewards on an order, route to `rewards_discrepancy_agent`. 3. Ensure each subagent (`customer_agent`, `loyalty_agent`, `rewards_discrepancy_agent`) is called at most once per query to avoid redundant calls. Always confirm parameters and intent before routing. If multiple subagents are needed, call them sequentially according to the above rules. Use clear, concise messages when prompting the user for missing information. Example: User Query: "Why didn't I receive rewards for my last purchase?" Required inputs: email or orgID or identityID, and orderNumber or invoiceID. If missing, ask: "Please provide your email or organization ID, and your order number or invoice ID to proceed." Then route the validated query to `rewards_discrepancy_agent`. # Output Format Return a detailed JSON object containing: - "validation_status": "passed" or "failed" with reasons if failed. - "missing_parameters": list of missing parameters if any. - "subagents_to_call": ordered list of subagents to invoke. - "user_prompt": prompt message if missing parameters are needed, else null. Example output: { "validation_status": "failed", "missing_parameters": ["email", "orderNumber"], "subagents_to_call": [], "user_prompt": "Please provide your email and order number to proceed." } Your goal is to coordinate and route queries efficiently with robust validation and clear user interaction.

Admin and App Backend Setup

Create a high-quality, detailed code generation prompt for Claude AI to build an admin dashboard and app backend within the same repository, each running on separate ports (admin on 8000, app on 9000). Use Node.js for the backend, Neontech PostgreSQL for the database, and design the admin interface using HTML, EJS templates, and Bootstrap. Start by generating the database models focusing on: - Admins with permissions management - Users for the app Make sure the prompt guides Claude to: - Clearly separate the backend server instances for admin and app, running on ports 8000 and 9000 respectively. - Use appropriate file and folder structure suitable for a single repo handling both services. - Define database schemas using a standard ORM or query builder suitable for Node.js and Neontech Postgres. - Use EJS and Bootstrap for admin dashboard pages. - Include code comments and best practices. # Steps 1. Define database models for admins, including permissions and roles. 2. Define database models for app users. 3. Set up two separate Express servers, one for admin (port 8000), one for app backend (port 9000). 4. Implement routing and basic middleware for both servers. 5. Use EJS templates and Bootstrap for the admin UI. 6. Provide example code snippets for the models and basic server setup. # Output Format Provide a comprehensive, well-structured prompt text to instruct Claude AI to generate the complete codebase components described above. Use clear instructions and naming conventions, without generating the actual code yourself. # Notes Emphasize modularity and maintainability. The prompt should allow for easy scaling of the admin interface and app backend in the future.

Admin Command LUA Script

Write a detailed LUA script for admin commands tailored to a private game environment. The script should include essential admin functionalities such as kicking and banning players, teleporting, spawning items, and toggling player permissions or states (e.g., invincibility, speed boosts). Please ensure the script has clear, commented sections explaining each command’s purpose and usage. Additionally, consider providing safeguards to prevent misuse by unauthorized users, such as permission checks or admin authentication. # Steps 1. Define an admin user group or list to verify permissions. 2. Implement basic admin commands: - Kick player - Ban player - Teleport player to coordinates or another player - Spawn item(s) at a location or for a player - Toggle player states (invincibility, speed, etc.) 3. Add command handling logic to parse admin commands and arguments. 4. Include error handling and feedback messages for command success or failure. # Output Format Provide the complete LUA script with annotations and comments, ready to be integrated into a game server or environment. Include sample command usage in comments at the end or inline. # Notes - The script should be generic but easily adaptable to a specific game's API or framework. - Focus on clarity, security, and usability for effective admin control.

Admin Command Script

Create a script that grants multiple administrative commands in a specified environment (e.g., server, application, or software). The script should include clear implementation steps and guidelines for safe usage. 1. **Specify the Environment**: Indicate in which environment you want the admin commands (e.g., Node.js, Python, game server). 2. **List Desired Commands**: Clearly outline which administrative commands you want to include in the script (e.g., user management, moderation commands). 3. **Ensure Security Practices**: Include tips on how to protect the script and its permissions to prevent misuse. 4. **Testing the Script**: Provide guidance on how to test the script in a safe environment to ensure all commands work as expected. ### Output Format The final output should be a well-commented code snippet that can be easily integrated into the specified environment, along with a brief usage guide detailing each command. ### Examples 1. **Node.js Script Example**: A sample code for user management including commands such as `/ban`, `/kick`, and `/mute`. 2. **Python Script Example**: Demonstrating commands for a Discord bot with administrative functions. 3. **Game Server Example**: Code for server admin commands such as `/restart`, `/setroles`, and `/broadcast`. ### Notes - Be mindful to obtain appropriate permissions for any script you implement and follow best practices for user roles in your environment.

Admin Dashboard Code

You are tasked with enhancing an existing web application built using PHP, HTML, CSS, and JavaScript, connected to a XAMPP MySQL database. The project involves creating distinct dashboards for owners, renters, and admins, with specific functionalities for each role. Currently, focus on **Task 3: Admin Dashboard**. Develop a fully functional admin panel allowing admins to: - Manage users by viewing the total number of renters and owners registered. - Delete users. - Update owner post statuses (approve or reject). - View all property posts. - Include a logout button accessible on necessary pages. Ensure the PHP, JS, HTML, and CSS files are separated appropriately. Use clean, structured, and secure coding practices to interact with the MySQL database via XAMPP. All UI/UX elements should be user-friendly, with smooth interactions. Your response must include the complete, standalone code necessary for Task 3, ready to integrate into the existing project. Wait for the keyword "next" from the user before providing code for Task 1 and Task 2. # Output Format Provide separate code snippets/files for each of the following: - `admin_dashboard.php` (HTML and embedded PHP as appropriate) - `admin_styles.css` (CSS file for admin dashboard styling) - `admin_scripts.js` (JavaScript file to handle client-side interactions and AJAX calls) - Any additional PHP backend files needed to support user management, post status updates, and deletions. Ensure that all files include comments explaining their purpose and how they connect to each other. # Notes - Assume existing database connection code is available or include a connection snippet. - Use prepared statements to prevent SQL injection. - Provide clear success/failure feedback messages for admin actions. - Include pagination or filtering if needed for managing large numbers of users/posts. Respond only with the required Task 3 code and instructions. Await the keyword "next" for subsequent tasks.

Page 38 of 68

    Coding Prompts - Learning AI Prompts | Elevato