The Character-Indexed Object Problem in Laravel Docker APIs

1. Problem Description In a typical Laravel + Docker API deployment, you may notice an odd, intermittent bug: when accessing the same API endpoint multiple times in a row, the returned JSON response is sometimes corrupted. Instead of a normal structure like this: { "success": true, "data": [ { "id": 1, "name": "Test" } ], "statusCode": 200 } You might occasionally get something like this: { "0": "{", "1": "s", "2": "u", // ... } This bizarre issue usually happens after the container has been running for some time, even if you have already updated your PHP configuration to disable error output in production. Initially, everything seems fine, but after a day or two, the corruption becomes frequent. ...

May 18, 2025

Simple Delpoyment Workflow

Vercel and similar platforms have dramatically lowered the complexity of deploying web applications. For many individual developers or simple projects, sophisticated CI/CD pipelines and branching strategies may be overkill. In this blog post, we’ll walk through a lightweight Git-based deployment workflow that’s easy to manage, beginner-friendly, and perfectly suited for small- to medium-sized projects. 1. Workflow Overview This workflow assumes you’re using Vercel and Git (either via CLI or VS Code). The idea is to: ...

April 30, 2025

Designing Better Web Request Interactions

Designing Better Web Request Interactions with MUI When designing web applications, handling user interactions during network requests is crucial for delivering a smooth, responsive, and professional experience. In this blog post, we’ll explore the purpose behind request interaction design, the six recommended interaction patterns (with Material-UI components), and how to apply them to typical scenarios. 1. Purpose: Core Goals of Web Request Interaction Design Clearly Communicate System Status: Users should always know whether an action is processing, succeeded, or failed. Reduce User Anxiety During Waiting: Use visual cues to make waiting times feel shorter. Prevent Duplicate Operations: Disable controls during requests to avoid repeated submissions. Maintain Responsive Interfaces: Even during slow backend operations, keep the frontend feeling fluid. Guide Users Through Complex Flows: Break down complex operations into clear, manageable steps. 2. Interaction Patterns and Key Components Pattern Key MUI Components Main Purpose Loading Indicators CircularProgress, LinearProgress, LoadingButton Show ongoing processing status Disable Controls disabled attribute Prevent repeated clicks or submissions Feedback Mechanism Snackbar + Alert Clearly notify success or failure Skeleton Loading Skeleton Maintain layout and reduce perceived waiting time Full-Screen Loading Mask Backdrop + CircularProgress Block all interactions during critical operations Progressive Steps Stepper Guide users step-by-step through complex flows 3. Pattern Application Across Typical Scenarios Scenario Loading Indicator Disable Controls Feedback Mechanism Skeleton Loading Full-Screen Mask Progressive Steps Form Submission ✅ ✅ ✅ File Upload ✅ ✅ ✅ ✅ Delete Confirmation ✅ (small delete) ✅ ✅ (batch refresh) Registration/Login ✅ ✅ ✅ Bulk Data Loading ✅ ✅ Multi-Step Process ✅ (per step) ✅ (per step) ✅ (per step) ✅ 4. Typical Scenario Examples Scenario Description Form Submission When a user submits a form, the button shows a loading state, the form is disabled, and a Snackbar provides success or failure feedback. File Upload During file uploads, a Backdrop with a loading spinner blocks user interactions. Upon completion or failure, a Snackbar notification is shown. Delete Confirmation For a single delete action, a loading state can be shown on the button. For bulk deletes, a Skeleton screen can temporarily replace the refreshed data. Registration/Login Submitting login or registration forms triggers a LoadingButton, disables the inputs, and gives clear success or error feedback. Bulk Data Loading When loading lists or dashboards, use Skeleton components as placeholders until real data arrives. Multi-Step Process Use a Stepper to break registration, checkout, or onboarding into multiple steps, with loading indicators and feedback at each stage. By combining the right interaction patterns based on user actions, you can greatly enhance the perceived quality and responsiveness of your web application. ...

April 28, 2025

SaaS Test 2 : Test Case

1 Principle ✅ What Each Testing Layer Should Do Testing Layer What to Test Example 🟩 Unit Test Test core logic of individual functions or classes, without external dependencies Validate password strength: PasswordValidator::isStrong() 🟨 Integration Test Test how modules/services interact, often with real DB or services Check if user registration inserts into DB and sends email 🟥 End-to-End (E2E) Test Simulate real user behavior across the full stack Fill out registration form in browser → submit → redirect to dashboard ❌ What Each Testing Layer Should NOT Do Testing Layer Don’t Do This Reason 🟩 Unit Test Don’t access DB, network, or real APIs Unit tests should be fast, isolated, and logic-only 🟨 Integration Test Don’t test UI rendering or button positions Integration tests focus on backend/data flow, not UI components 🟥 End-to-End (E2E) Test Don’t test detailed field validations (e.g., regex) E2E tests should verify core flows, not internal validation rules 🧠 Test Layer Summary Layer DO DON’T Unit Test logic in isolation No DB, no API calls Integration Test module cooperation No UI component tests E2E Test full user flow No detailed field logic or validation 2 Minimum Viable Test Plan based on the Test Pyramid model. ...

April 20, 2025

SaaS Test 1 : Phased Testing Strategy for a SaaS System

‘SaaS Test 1 : Phased Testing Strategy for a SaaS System 🧪 Phase 1: Demo Stage – Manual Testing 🎯 Goal Quickly verify that basic user functions (e.g., registration and login) work as expected without investing time in automation. 🛠️ How Write and follow simple test cases manually. Use DevTools to debug UI or network errors. Focus on form validation, error messages, and navigation. 🧾 Example Test Cases Feature Test Case Expected Result Register Valid email and password Redirect to login or dashboard Register Weak password Show “password too weak” error Login Valid credentials Redirect to dashboard Login Wrong password Show “invalid credentials” error Logout Click logout Return to login page ❌ Why Not Use Playwright Yet? Time-saving at early stages Frequent UI changes make scripts brittle 🚀 Phase 2: Core Flow Stability – Partial Automation with Playwright 🎯 Goal Ensure that your critical workflows do not break as new features are added. ...

April 20, 2025

Json web token

In my latest Laravel project, the backend uses Laravel APIs and the frontend is built with Next.js. I used JWT for auth, and after finishing the setup, I reviewed the basics of how JWT works. 1 The Problem with Cross-Domain Authentication Online services can’t do without user authentication. Here’s how it typically works: The user sends their username and password to the server. Once the server verifies the credentials, it stores some related data in the current session—like the user’s role, login time, etc. The server then sends a session_id back to the user and stores it in the user’s cookie. For every following request, the user’s browser automatically sends the session_id back to the server via cookies. The server uses the session_id to retrieve the stored session data and confirm the user’s identity. The problem with this approach is poor scalability. It works fine on a single server, but in a server cluster or a cross-domain service-oriented setup, session data must be shared—every server needs access to the session data. ...

April 14, 2025

Framework for Web-Based Component Ordering System

I asked ChatGPT to help me design a web application that allows users to input structured window and door information, and I asked it to provide a thinking framework for the system. 🧠 Framework for Web-Based Component Ordering System (For APL Window/Door Fabricators) 1. 📅 WHO & WHY Dimension Content 💼 You are APL authorized fabricator using Soft Tech V6 🌟 Goal Build a customer-facing web ordering form for window/door products 👥 Users Builders, sales reps, site managers, clients ⚖️ User Needs Fast quoting, error-proof selection, intuitive structured input 2. 🔄 System Architecture Layered Structure: Layer Purpose Domain Knowledge Required Web Frontend Structured form UI to collect order data ❌ No Soft Tech V6 Backend Modeling, pricing, production logic ✅ Yes 3. 📁 Data Abstraction Core Inputs: Frame Code (V1, V12, A3…) as primary selector Field Groups: Dimensions Glass Colour Hardware Accessories Logic Inclusions: Allowed fields per Frame Code Field dependencies (e.g. frame type determines opening direction) Field value limits and defaults 4. 🎭 UI/UX Principles Priority Level Strategy 🥇 Highest Logical clarity: Group fields cleanly, label clearly 🥈 Medium Input validation and real-time error blocking 🥉 Lowest Fancy animations or complex transitions Recommended UI Style: Two-column form layout FrameCode-based field filtering Diagram image (static reference only) 5. 📂 Data Source Strategy Source Use V6 Interface (manual) Observe field structure, dependencies, default values V6 Admin Export (if any) Export Frame list, field types, options APL Product Manuals Provide diagram/images per FrameCode Soft Tech Web API (Advanced) Query model structure programmatically 6. 📊 Output Design Format Purpose JSON System input / future API usage Excel/CSV Factory-side V6 import Image Structure diagram (optional) 7. ✅ MVP to Full Product Roadmap Stage Scope Complexity MVP Form + JSON/Excel export ❌ Low V1 Field validation + auto-template logic ⚠️ Medium V2 Backend V6/ERP integration ✅ High V3 Live modeling preview / BIM data sync 🚀 Very High 📆 Summary: Build the frontend as a mirror of V6 logic, with strong structure, clarity, and field control. No domain knowledge is required if FrameCode-based structure is used as the foundation. ...

April 8, 2025

Designing and Delivering a Customizable Front-End UI System for End Users : 1

1 Delivery method We have to choice for users: Provide a project template Provide an import method that makes it easy to install into their existing project Inspired by AdminMart, we explored their approach to delivering UI systems via templates — including how they structure delivery, enable user customization, and support extensibility. The current analysis is based on the documentation of AdminMart and the templates provided by Material UI 2 Theme(Styling) & Customization When you init a new project, you can choice : ...

April 7, 2025

SQL slower query log : 1

Query1 [companyExWarehouseOrderItem] - NOT solve SELECT a.*, b.name AS stateName, b.nameZh AS stateNameZh, c.partNo, c.aliasName AS componentAliasName, c.spec AS componentSpec, c.colour AS componentColour, c.componentTypeId, c.businessTypeId, c.modelNo, d.name AS componentTypeName, d.nameZh AS componentTypeNameZh, d.customerNo AS componentTypeNo, f.name AS unitTypeName, f.nameZh AS unitTypeNameZh, g.orderNo AS parentOrderNo, h.customerNo AS planCustomerNo, h.orderLineNumber AS planOrderLineNumber, h.planNo, h.extendDesc AS planDesc, h.amount, h.unitPrice, h.currencyId, j.grossAmount, j.unmetAmount, k.demandId, l.userName AS qcCheckerNameZh, m.nameZh AS currencyNameZh FROM companyExWarehouseOrderItem AS a, companyExWarehouseOrderState AS b, companyBasicComponent AS c, companyComponentType AS d, companyBasicComponentBomUnitType AS f, companyExWarehouseOrder AS g, companyProductionSchedules AS h, companyProductionSchedulesBom AS j, companyProductionDemandSchedule AS k, user AS l, currency AS m WHERE a.parentId = 27682 AND a.sourceTypeId = 1 AND a.stateId = b.id AND a.componentId = c.id AND c.componentTypeId = d.id AND c.unitTypeId = f.id AND a.parentId = g.id AND a.scheduleId = h.id AND h.id = j.scheduleId AND a.componentId = j.componentId AND a.scheduleId = k.scheduleId AND a.qcCheckerId = l.id AND h.currencyId = m.id; before : 4.0291 code use in : solution.getSales().getTask().getExWarehouse().getItem().getListByParentId(mysqlCoon.getSlaveConn(), detailInfo.id, cb); ...

April 1, 2025

My Plan and Log for Pte Test

I will join the PTE test in 2, May, so I need a plan for prepare. PTE Academic Test Structure Summary Part Section / Task Type Estimated Time Number of Items Approx. Score Contribution (%) Affects Skills 1 Speaking & Writing ~54–67 minutes 28–36 ~50% Speaking + Writing Read Aloud – 6–7 High Speaking, Reading Repeat Sentence – 10–12 Very High Speaking, Listening Describe Image – 6–7 Moderate Speaking Retell Lecture – 3–4 High Speaking, Listening Answer Short Question – 5–6 Low Listening, Speaking 2 Writing ~54–67 minutes 28–36 ~50% Speaking + Writing Summarize Written Text ~10 min/item 1–2 Moderate Writing, Reading Essay ~20 minutes 1 Moderate–High Writing 3 Reading ~29–30 minutes 13–18 ~25% Reading (+ minor Writing) Reading & Writing: Fill in the Blanks – 5–6 High Reading, Writing Multiple Choice, Multiple Answer – 1–2 Low Reading Re-order Paragraphs – 2–3 Moderate Reading Fill in the Blanks – 4–5 Moderate Reading Multiple Choice, Single Answer – 1–2 Low Reading 4 Listening ~30–43 minutes 12–20 ~25% Listening (+ minor Writing) Summarize Spoken Text ~10 min/item 1–2 Moderate Listening, Writing Multiple Choice, Multiple Answer – 1–2 Low Listening Fill in the Blanks – 2–3 Moderate Listening, Writing Highlight Correct Summary – 1–2 Moderate Listening, Reading Multiple Choice, Single Answer – 1–2 Low Listening Select Missing Word – 1–2 Low Listening Highlight Incorrect Words – 2–3 Moderate Listening, Reading Write from Dictation – 3–4 Very High Listening, Writing Notes: Speaking & Writing section has the highest combined weight (~50%). Repeat Sentence and Write from Dictation are the most valuable tasks across the whole exam due to their dual-score contribution. Reading and Listening sections, while shorter in time, contain tasks that impact multiple scoring areas. Good time management and use of templates/shortcuts can help maximize scores in limited prep time. PTE All Task Types + Quick Strategy Table (For Short Preparation) Skill Section Task Type Task Goal (What to Do) Quick Strategy (How to Score) Speaking Read Aloud Read the text clearly and fluently Pause at punctuation, speak clearly, don’t rush or restart Speaking Repeat Sentence Repeat exactly what you hear Memorize first & last chunk, keep rhythm even if incomplete Speaking Describe Image Describe a chart or picture Use fixed template, speak confidently, don’t worry about accuracy Speaking Retell Lecture Summarize what you heard from a lecture Write keywords, use structured template, include 2–3 points minimum Speaking Answer Short Question Answer a general knowledge question orally Give 1-word or short phrase, skip if unsure Writing Summarize Written Text Write one-sentence summary of a passage Use linking words (“and”, “which”, “that”), keep sentence 40–70 words Writing Essay Write 200–300 word argumentative essay Use 4-paragraph template: Intro, 2 Body, Conclusion Reading Reading & Writing Fill Blanks Fill missing words in a passage Focus on grammar + collocations (e.g. “strong demand”, “major issue”) Reading Multiple Choice, Multiple Answer Choose all correct options after reading Read question first, avoid overselecting answers (no partial credit) Reading Re-order Paragraphs Put sentences in correct order Find topic sentence first, match references (“this”, “these”, etc.) Reading Fill in the Blanks Drag and drop correct word into blank Focus on meaning + grammar fit, use collocations Reading Multiple Choice, Single Answer Choose one best option after reading Read question first, scan quickly, avoid overthinking Listening Summarize Spoken Text Write 50–70 word summary of a lecture Take notes, use simple structure: Intro + 2 points + summary Listening Multiple Choice, Multiple Answer Choose all correct answers after listening Focus on main ideas, avoid clicking too many options Listening Fill in the Blanks Type missing words into transcript while listening Focus on spelling + grammar; memorize common collocations Listening Highlight Correct Summary Choose best summary of what you heard Match keywords from audio to options, eliminate wrong tone/detail Listening Multiple Choice, Single Answer Choose 1 correct answer after listening Focus on question stem, find keywords in audio Listening Select Missing Word Pick the final word/phrase from 3 options Focus on logic of sentence, predict before options appear Listening Highlight Incorrect Words Click words that differ from the audio Read along carefully, click only obvious mismatches Listening Write from Dictation Type the sentence you heard Practice spelling, focus on plural/singular, capitalize first word PTE Template-Based Answer Cheatsheet This cheatsheet contains high-efficiency answer templates for four PTE Academic task types. These templates help candidates score safely even with minimal preparation, by ensuring fluency, structure, and grammar. ...

March 19, 2025