Back to Learning

Coding

814 prompts available

Add benefitId to ServiceConfig

You are given two files: `benefit.csv` which contains benefit data including `benefitId` and `benefitName`, and `benefit.config.ts` which contains a TypeScript configuration object named `ServiceConfig` where each entry references a `benefitName`. Your task is to update the `ServiceConfig` object in `benefit.config.ts` by comparing each `benefitName` there to the entries in `benefit.csv`. For each `benefitName` in `ServiceConfig` that exists in the CSV file, add a new attribute `benefitId` to that config entry, setting it equal to the corresponding `benefitId` from the CSV. Note: The `BehavioralHealthConfigs` section has already been updated manually. Your task is to update the remaining sections accordingly. # Steps 1. Parse the `benefit.csv` file to create a mapping of `benefitName` to `benefitId`. 2. Parse the `benefit.config.ts` file to identify all `ServiceConfig` sections except for the already updated `BehavioralHealthConfigs`. 3. For each entry in `ServiceConfig`, check if its `benefitName` exists in the CSV mapping. 4. If a match is found, add the `benefitId` attribute with the corresponding ID from the CSV. 5. Preserve the rest of the code structure, formatting, and comments. 6. Output the updated `benefit.config.ts` content with the added `benefitId` attributes in all applicable entries except `BehavioralHealthConfigs` section. # Output Format Provide the full updated contents of `benefit.config.ts` file as valid TypeScript code with the added `benefitId` attributes included appropriately. The formatting should be consistent with the original file style. # Notes - Do not modify the `BehavioralHealthConfigs` section as it is already handled. - Only update entries where the `benefitName` matches one in the CSV. - Maintain all existing attributes and comments.

Add Complaints Form Textbox

You are an expert HTML, CSS, and Java developer with over 25 years of experience in building web applications. Your task is to assist with modifying a web form section specifically named "Forms for Complaint:". Focus on the field labeled "20 Working Days up on" within this section. Your goal is to insert a new text box immediately below this field and above the existing "Form Content (Rich Text Editor)" field, ensuring there is appropriate spacing between these elements. Detailed requirements for the new text box: - It should be 5 lines in height (e.g., a multiline text area). - The width should cover 50% of the screen (viewport width). - It must accept user input text. - The input text should be saved together with the rest of the form data on submission. - The label of this field shall be "Important Dates (foi, complaints sent, etc)". - Styling (font family, size, and color) of the label and input text must match exactly that of the "20 Working Days up on" field. Please reason through how to implement this addition considering the existing form's structure and styles. Provide the HTML snippet and any accompanying CSS and Java code necessary to realize this change, ensuring data persistence on form submission. # Steps 1. Identify the existing structure around "20 Working Days up on" and "Form Content (Rich Text Editor)" fields. 2. Create a multiline text box (textarea) with 5 rows, 50% viewport width. 3. Add label "Important Dates (foi, complaints sent, etc)" above the textarea. 4. Match styling to "20 Working Days up on" field (font, size, color). 5. Insert the labeled textarea between the two existing fields with proper spacing. 6. Modify form handling backend code in Java to accept and save this new input. # Output Format Provide: - The updated HTML snippet showing the new labeled textarea within the form section. - The CSS snippet or inline styles needed to match the existing field styles and size requirements. - The Java code snippet to handle the new form field data on submission, ensuring persistence. Ensure code snippets are complete enough to be integrated directly into the existing system with minimal adjustment. # Notes If detailed existing form structure or style information is missing, make reasonable assumptions based on modern best practices and standard HTML/CSS/Java usage for web forms.

Add Confusion Matrix Output

You have a Python program for sentiment analysis using fuzzy logic. Your task is to modify the output of the accuracy test section to additionally display the confusion matrix. Also, identify and include any other relevant tables or metrics that can help to better interpret and demonstrate the model's accuracy and performance (such as precision, recall, F1-score, etc.). Ensure the output is clearly formatted and easy to understand. # Steps 1. Identify the part of the Python program where the accuracy test is currently performed. 2. Add functionality to compute and display the confusion matrix for the test results. 3. Determine additional relevant metrics/tables to better assess model accuracy (e.g., classification report showing precision, recall, F1-score). 4. Implement calculation and display of these additional performance metrics. 5. Format all output in a clear, well-structured manner for easy interpretation. # Output Format - Confusion matrix displayed as a labeled matrix or table. - Additional performance metrics in tabular form or classification report style. - Original accuracy metric retained and clearly shown. # Notes - Use appropriate Python libraries (e.g., scikit-learn's metrics module) for these calculations if not already used. - Make sure the new output integrates smoothly with existing program output without redundancy.

Add Bias Mitigation Code

Please enhance the provided code by adding mechanisms to prevent or mitigate bias. Analyze the existing logic for possible sources of bias, such as data handling, decision rules, or assumptions, and introduce code to address these issues effectively. Ensure the added code promotes fairness, inclusivity, and impartial results. # Steps 1. Review the given code thoroughly to identify potential bias points. 2. Consider common bias types relevant to the context (e.g., demographic bias, confirmation bias). 3. Introduce validation checks, balanced data handling, or algorithmic adjustments to reduce bias. 4. Comment and document the changes to explain how bias is mitigated. # Output Format Provide the complete updated code with the bias mitigation mechanisms added. Include inline comments highlighting the specific parts responsible for preventing bias. # Notes - If the original code or context is not provided, describe general strategies or provide sample code snippets for bias mitigation relevant to typical scenarios. - Emphasize maintaining code functionality while integrating bias prevention.

Add Buffer Buttons to Indicator

Create buffer buttons for a trading indicator that will be provided by the user. You will receive the source code or description of a trading indicator. Your task is to add buffer buttons to this indicator, which can be used within the trading platform (such as MetaTrader) to interact with indicator buffers. # Steps 1. Review the indicator code or description sent by the user. 2. Identify the indicator buffers used for calculations or display. 3. Implement buffer buttons that correspond to these buffers, allowing easy access and manipulation. 4. Ensure the buffer buttons integrate seamlessly with the indicator's existing structure. 5. Provide the updated indicator code with buffer buttons clearly commented. # Output Format Provide the modified indicator code including the buffer buttons in a code block. Include comments to explain the buffer button implementation. # Notes - Confirm with the user if they have specific requirements for the buffer buttons (e.g., labels, actions). - Maintain the original logic and functionality of the indicator apart from adding the buffer buttons.

Add Connections Tab

Create a new tab labeled 'Connections' within the existing tabs system in the FormTabs.jsx component for the specified pages: Warehouses, CostCenters, Categories, Final Accounts, and Accounts. For each page, display the specified input fields inside this 'Connections' tab as follows: - **Warehouses**: Inputs for Location and Parent Warehouse - **CostCenters**: Input for Location - **Categories**: Input for Parent Category - **Final Accounts**: Input for Parent Final Account - **Accounts**: Inputs for Final Account, Parent Account, Cost Center, and cost_Center_editing_options Ensure the new 'Connections' tab integrates seamlessly with the existing tabs, follows the current UI/UX conventions, and correctly renders the appropriate inputs per page within this tab. # Steps 1. Locate and open `FormTabs.jsx` in the project source. 2. Identify how tabs are currently defined and rendered for each relevant page. 3. Add a new tab called 'Connections' alongside existing tabs for each mentioned page. 4. Implement the rendering logic inside the 'Connections' tab to show the specified inputs per page. 5. Verify the inputs match the names and expected data types from the specifications. 6. Test the UI to ensure the 'Connections' tab behaves like other tabs and inputs are correctly displayed. # Output Format Provide the changed or added React JSX code snippets showing the tabs definition and the 'Connections' tab contents for each specified page, clearly demarcated and commented.

Add Deinit and Tick Functions

Analyze the provided code carefully to understand its current structure, functionality, and components. Based on this analysis, perform the following tasks: 1. Add a **deinitialization function** that appropriately cleans up or releases resources allocated during the code's operation. 2. Add a **main expert tick function** which should act as the primary recurring execution step or update function reflecting the intended expert logic or processing cycle in the code. Make sure your additions maintain consistency with the existing code style, naming conventions, and architecture. Before writing the code, reason thoroughly about where and how these functions fit into the overall design to ensure proper integration. --- # Steps - Examine the current code for initialization, resource management, and main loop or processing functions. - Design a deinitialization function to clean up any allocations, handles, or ongoing processes. - Define the main expert tick function to encapsulate the primary recurring logic. - Integrate these functions logically, referencing existing structures and patterns. - Comment clearly on each function's purpose and usage within the codebase. # Output Format Provide the modified code snippet including: - The newly added deinitialization function. - The main expert tick function. - Any relevant comments or annotations to clarify the additions. Ensure the output is a complete and well-formatted code block in the language of the original code provided. --- # Notes - If the code language or context is not specified, request this information before proceeding. - Maintain code readability and consistency. - Avoid adding functionality beyond what is specified. --- # Examples Given a snippet initializing resources, you might add: ```c void Deinitialize() { // Free allocated memory // Close file handles } void ExpertTick() { // Main recurring logic per tick } ``` Replace placeholders and logic as per the original code.

Add < /dev/tty

Add the string "< /dev/tty" exactly as given at the end of the provided code without making any other changes to the code. Only output the modified code with this addition; do not include any explanations or comments.

Add FillWithExamples Flag

You are working on a Python 3 project that uses Pydantic 2, Poetry 2, and PyTest. The project currently presents input widgets for forming API payloads. Your task is to enhance the existing system by adding a new boolean flag named `fill_with_examples` with the following behavior: - When `fill_with_examples` is `false` (the default), the system behaves as it currently does, showing the input widgets for the user. - When `fill_with_examples` is `true`: - Instead of widgets, display a JSON representation of the API payload. - The JSON payload should be pre-filled with example data derived from the Pydantic models, similar to how widget fields are currently auto-filled. - Show a button that allows sending the displayed JSON payload to the API. - Ensure the JSON payload is validated against the Pydantic models for correctness before sending. - Use the existing API sending mechanisms currently used when working with the widgets. You will be provided with the relevant source code files: `feature_create_form.py`, `_form_validator.py`, and `feature_groups.py`. Your responsibilities: 1. Analyze and understand the current process of form data handling, widget rendering, example data filling, validation, and API submission. 2. Assess how example data is populated in widgets and whether this can be leveraged or adapted for filling the JSON payload. 3. Determine how validation is currently implemented and validate the JSON payload accordingly. 4. Plan the best approach to integrate the `fill_with_examples` flag into the system with the specified behavior. 5. Provide a detailed implementation plan outlining the required changes, integration points, and any potential challenges. 6. Request clarifications if needed before proceeding. Upon receiving the source files, start by thoroughly analyzing them to understand the current architecture and workflows. # Steps 1. Review the shared files `feature_create_form.py`, `_form_validator.py`, and `feature_groups.py` for the current form building, validation, and API submission logic. 2. Identify where the widget rendering and example data population occur. 3. Identify how form data is validated and submitted. 4. Design how to add the `fill_with_examples` flag to influence the UI rendering logic: - Switch UI to show JSON payload instead of widgets if true. - Populate the JSON with examples from models. 5. Decide how to implement the send button and hook it into existing API submission methods. 6. Ensure payload validation against Pydantic models before allowing submission. 7. Draft an implementation plan including proposed code changes or additions. # Output Format Provide a detailed plan covering: - Summary of your understanding of the current system. - How `fill_with_examples` flag will be integrated technically. - Changes needed in each provided file. - Validation approach for the JSON payload. - API sending logic reuse. - Any assumptions or open questions. Use clear language and structured bullet points or numbered lists. # Notes - Focus on minimal changes that align with existing architecture. - Ensure user experience is consistent with the requirements. - Clarify any ambiguities before starting actual coding. Your first response after receiving the files should be this analysis and plan for approval before proceeding.

Add Filter Functionality

You are an expert AI assistant specializing in web development and e-commerce platforms. Your task is to help enhance an existing supermarket e-commerce website and its admin control dashboards by adding robust filter functionality. This filter functionality should enable users to efficiently narrow down products based on various attributes such as category, price range, brand, availability, and other relevant criteria. Additionally, the admin dashboard should include filter options to manage and analyze product listings, sales data, and inventory effectively. When generating the code snippets, instructions, or explanations, consider the current structure of the codebase and ensure that the additions are modular, maintainable, and integrate seamlessly with the existing frontend and backend frameworks. Provide clear guidance on where and how to implement these filters, including UI components for the frontend and query or API modifications for the backend. Also include best practices for performance optimization and user experience. Steps to accomplish this task: 1. Analyze the existing codebase structure concerning product listings and admin dashboards. 2. Define the filtering criteria based on typical supermarket e-commerce needs. 3. Implement frontend filter components integrated with the product listing pages and admin dashboards. 4. Modify backend APIs or database queries to support filtering queries efficiently. 5. Ensure the filter state is managed correctly to provide smooth usability. 6. Test the filter functionality to confirm accuracy and performance. Output the guidance, code snippets, and integration instructions in a clear, step-by-step format suitable for developers working on the existing codebase. # Output Format Provide a comprehensive, structured response including detailed implementation instructions, sample code snippets for both frontend and backend (using placeholders for specific technologies as needed), and recommended best practices for filter functionality in e-commerce and admin dashboards.

Add Django REST Framework

Provide a detailed, step-by-step guide on how to integrate Django REST Framework (DRF) into an existing Django project. Include all necessary installation commands, configuration steps (such as adding 'rest_framework' to INSTALLED_APPS), creation of serializers, views, URLs, and any other relevant setup to make DRF functional within the project. # Steps 1. Install Django REST Framework using pip. 2. Add 'rest_framework' to the INSTALLED_APPS list in the project's settings.py. 3. Create serializers for your models to convert model instances to JSON. 4. Develop API views or viewsets to handle HTTP requests. 5. Configure URLs to route requests to the DRF views. 6. Optional: Set up authentication and permissions as required. # Output Format Provide the instructions as a clear, numbered list with code snippets where applicable, ensuring that the user can follow along to successfully integrate DRF into their existing Django project.

Add Firewall File Generator

You are provided with existing Python code (attached or referenced). Your task is to generate new Python code that includes all the existing functionality plus an additional function with the following requirements: - The new function should generate a file named `add_firewall.txt`. - Inside this file, write a string that consists of the IP addresses from `ip_list` combined with their CIDR class notation. - Ensure that the CIDR class for each IP is correctly computed and appended. Follow these guidelines: # Steps 1. Review the existing Python code structure. 2. Define a new function that processes the `ip_list`. 3. For each IP in `ip_list`, determine its CIDR class (e.g., /8, /16, /24 as appropriate). 4. Generate a string that includes each IP and its corresponding CIDR notation. 5. Write this string to a file named `add_firewall.txt`. 6. Integrate this function into the original code without disrupting existing functionality. # Output Format Return the complete Python code including the original code and the new function added. Preserve original comments and style where possible. The code should be ready to run and correctly generate the requested file when executed. # Notes - Assume `ip_list` is available in the code or passed as a parameter. - CIDR class should reflect standard IP classes (Class A, B, or C). - Focus on correctness and clarity in the new function. # Response Formats Provide the full updated Python code as plain text, ready to be used directly.

Page 29 of 68

    Coding Prompts - Learning AI Prompts | Elevato