{"id":23878381,"url":"https://github.com/mike014/longestsubstringapp","last_synced_at":"2025-02-22T22:41:20.044Z","repository":{"id":270092492,"uuid":"909317298","full_name":"Mike014/LongestSubstringApp","owner":"Mike014","description":"This Django application calculates the length of the longest substring without repeating characters, based on the logic implemented in an algorithm derived from a LeetCode problem","archived":false,"fork":false,"pushed_at":"2024-12-28T10:58:52.000Z","size":0,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-28T11:26:15.877Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Mike014.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-28T10:43:43.000Z","updated_at":"2024-12-28T10:58:55.000Z","dependencies_parsed_at":"2024-12-28T13:02:12.510Z","dependency_job_id":null,"html_url":"https://github.com/Mike014/LongestSubstringApp","commit_stats":null,"previous_names":["mike014/longestsubstringapp"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mike014%2FLongestSubstringApp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mike014%2FLongestSubstringApp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mike014%2FLongestSubstringApp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mike014%2FLongestSubstringApp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mike014","download_url":"https://codeload.github.com/Mike014/LongestSubstringApp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240245898,"owners_count":19771029,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-03T21:35:43.391Z","updated_at":"2025-02-22T22:41:19.847Z","avatar_url":"https://github.com/Mike014.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Longest Substring App\n\nThis Django application calculates the length of the longest substring without repeating characters, based on the logic implemented in an algorithm derived from a [LeetCode problem](https://leetcode.com/problems/longest-substring-without-repeating-characters/description/). The solution to the problem can also be found in my [LeetCode repository](https://github.com/Mike014/LeetCode-Solutions/tree/main/Longest_Substring_Without_Repeating_Characters).\n\n## Features\n- **Algorithm Integration:** The logic for calculating the longest substring without repeating characters is implemented in `algorithm.py` and integrated into the Django app through the `views.py` file.\n- **User Input:** A simple HTML form allows users to input a string and calculate the result.\n- **Database Storage:** Results are saved in the database for record-keeping and debugging purposes.\n\n## Debugging Process\nInitially, the app did not return the correct substring length. Here's the step-by-step debugging process that helped resolve the issue:\n\n1. **Algorithm Verification:**\n   - The logic in `algorithm.py` was independently verified using unit tests to ensure correctness.\n\n2. **Django Debugging:**\n   - The `DEBUG` setting in `settings.py` was set to `TRUE`:\n     ```python\n     DEBUG = True\n     ```\n   - Debugging messages were added in `views.py` to trace request methods and ensure the correct flow of data:\n     ```python\n     print(\"Received Request: \", request.method)\n     ```\n\n3. **Root Cause Analysis:**\n   - After testing, the issue was identified in the `HTML` template. The problem was in the line:\n     ```html\n     \u003cp\u003eLongest Substring Length: {{ result.length_of_longest_substring }}\u003c/p\u003e\n     ```\n     - The variable name did not match the field in the `models.py` file.\n\n4. **Fix:**\n   - The incorrect variable name was corrected to:\n     ```html\n     \u003cp\u003eLongest Substring Length: {{ result.length_of_longest_substring }}\u003c/p\u003e\n     ```\n\n## Files in the Project\n\n- **`algorithm.py`:** Contains the logic for calculating the longest substring without repeating characters.\n- **`views.py`:** Integrates the algorithm with Django views and handles user requests.\n- **`models.py`:** Defines the `SubstringResult` model for storing input strings and their corresponding results.\n- **`templates/substring/index.html`:** The HTML template for the user interface.\n\n## How to Run\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/Mike014/LongestSubstringApp.git\n   cd LongestSubstringApp\n   ```\n2.\tCreate and activate a virtual environment:\n   ```bash\n   python3 -m venv venv\n   source venv/bin/activate\n   ```\n3. Install dependencies:\n   ```bash\n   pip install -r requirements.txt\n   ```\n4. Run migrations:\n   ```bash\n   python manage.py migrate\n   ```\n5. Start the server:\n   ```bash\n   python manage.py runserver\n   ```\n\n## Notes\n- The algorithm is based on my solution for the LeetCode problem linked above.\n- Debugging was essential to ensure the application logic worked seamlessly from the algorithm to the user interface.\n   \n   \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmike014%2Flongestsubstringapp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmike014%2Flongestsubstringapp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmike014%2Flongestsubstringapp/lists"}