今日已更新 281 条资讯 | 累计 21147 条内容
关于我们

标签:#programming

找到 1397 篇相关文章

AI 资讯

How I Fixed a PHP Version Mismatch on Hostinger Shared Hosting (And What Actually Made It Work)

I spent way too long staring at this error. If you're here, you probably are too. Your requirements could not be resolved to an installable set of packages. Problem 1 - Root composer.json requires php ^8.3 but your php version (8.2.30) does not satisfy that requirement. My Laravel 13 app needed PHP 8.3. My Hostinger server was running 8.2. composer install refused to budge. Here's exactly what happened and the one-liner that fixed it. The Setup I was deploying a Laravel 13 + Inertia + React app to Hostinger shared hosting. Laravel 13 requires PHP 8.3 minimum — and so do its locked Symfony 8.x and PHPUnit 12.x dependencies. My composer.lock had been generated on a local machine with PHP 8.3, but Hostinger's CLI was defaulting to 8.2. The hPanel showed PHP 8.3 selected under PHP Configuration . The website itself was running fine on 8.3. But SSH? Still on 8.2. $ php -v PHP 8.2.30 ( cli ) That disconnect — hPanel vs. CLI — is the trap. What I Tried First composer update My first instinct was to just let Composer resolve newer compatible versions: composer update No luck. The root composer.json itself declared "php": "^8.3" , so Composer refused before even touching the lock file. The PHP constraint wasn't just in dependencies — it was in my own project requirements. composer install --ignore-platform-reqs This flag skips platform checks and forces the install anyway. It works , but it's a lie — you end up with packages that may behave incorrectly or fail at runtime because they genuinely require PHP 8.3 features. Not a real fix. Changing PHP in hPanel Hostinger's control panel has a PHP version switcher under Hosting → Manage → PHP Configuration . I had already set this to 8.3. This controls the web server / FPM version — what runs your .php files in the browser. It does not change what php points to in your SSH terminal. That's the key distinction most tutorials miss. What Actually Fixed It Hostinger installs multiple PHP versions in parallel. They live in /opt/alt/ph

2026-06-01 原文 →
AI 资讯

My Company Bought a $660K AI Platform. I Was Replaced. On Friday at 2:58 AM, It Fixed Everything. Then It Rolled Back the Wrong Patch.

Based on real system architecture decisions. About a $660K AI platform, three AI agents that kept the dashboard green, and a P0 incident that cost $3.15M over one weekend. Act 1 · The All-Hands Meeting Wang Lei, VP of Product, stood in front of the big screen, a smile on his face. Behind him, a dashboard rolled data from the "Axon AI Client Engineering Platform — Q1 Performance Report." Numbers cascaded across the wall: Metric Axon Platform Human Team (Last Q1) Improvement Avg daily tickets processed 847 312 +171% Avg first response time 12s 4h 17m ↓ 99.92% Customer satisfaction 4.8/5 4.1/5 +17% Monthly operating cost $52K $133K −61% Twelve department heads sat in the room. Dead silence. Wang Lei planted both hands on the table and scanned the room. His eyes landed on me. "Alex. Your team processed 312 tickets last Q1. Axon processed more than that in a single day last month." He smiled. Not a friendly smile. A sentencing smile. "And Axon costs less than a third of your team's operating expense." "We invested $660K in the whole platform. At current operating costs, it pays for itself in eighteen months." "After management review — the Client Engineering technical liaison function is being fully transitioned to the Axon platform." He clicked to the next slide. "Employees in replaced roles will complete exit interviews within the week." Someone inhaled sharply. I didn't. I opened my notebook to page 37. "Wang, what dimensions are these numbers from?" "What do you mean, 'what dimensions'?" His smile tightened. "Of those 847 daily tickets — how many are auto-tagging and routing, and how many are actual technical resolutions?" The room went quiet for about five seconds. Wang Lei looked at me. "Axon's ticket closure rate is ninety-three percent." "What's the reopen rate?" He paused. "What?" "After Axon replies — how many customers reopen the same ticket within twenty-four hours?" "We're still collecting that —" "Let me save you the trouble." I turned my notebook toward th

2026-06-01 原文 →
开发者

How to Find a Prime Number in Python — A Thinking Journey

Introduction Understanding how to find prime numbers is one of the best ways to develop logical thinking in programming. It looks simple on the surface, but it teaches you how to break a problem into smaller steps, build a solution gradually, and then improve it into a clean and reusable structure. In this blog, we will not jump directly into code. Instead, we will start from basic thinking, slowly convert that thinking into logic, and finally refine it into a proper Python program using functions and loops. The goal is not just to find prime numbers, but to understand how programming logic is actually built in real development. 1. Understanding the Problem First Before writing anything in Python, we need to understand what a prime number actually means. A prime number is a number that: is greater than 1 has exactly two divisors: 1 and itself So the real question becomes: How do we check whether a number has any divisors other than 1 and itself? That is the core problem we are trying to solve. 2. Thinking Like a Human Before Coding Let’s take a number, for example 13. To check if 13 is prime, we naturally try dividing it by smaller numbers: 2 → does not divide 13 3 → does not divide 13 4 → does not divide 13 5 → does not divide 13 and so on If none of these numbers divide 13 completely, then 13 is prime. So the logic is simple: Try dividing the number by possible candidates and see if any divide it perfectly. 3. Turning Thinking into a Basic Algorithm From the above idea, we can form a basic structure: We need: a number to test a variable that moves through possible divisors a way to detect whether a divisor exists We start checking from 2 because every number is divisible by 1 anyway. We also do not need to check beyond half of the number, because a number cannot have a divisor greater than half (except itself). So the idea becomes: Start divisor from 2 Go up to number // 2 If any number divides it evenly, it is not prime 4. First Working Logic (Direct Implementati

2026-06-01 原文 →
AI 资讯

Building Hermes Financial Agent: An Explainable AI Copilot for EGX Investors

Overview I built Hermes Financial Agent — an AI-powered financial assistant for investors in the Egyptian Exchange (EGX). The goal: not just calculate portfolio value, but explain risks in a transparent, auditable way. Features Real EGX market data via Yahoo Finance Portfolio tracking and valuation Daily financial reports Telegram-user portfolio isolation Cached quote fallback for resilience Explainable risk insights Explainable Risk Intelligence Unlike traditional trackers, Hermes surfaces: Portfolio concentration risk Stale market data exposure Quote coverage percentage Valuation gaps from unavailable data Users understand confidence level behind their valuation — not just the number. Technical Stack Hermes Agent framework Python GitHub Actions (automated smoke testing) Offline-safe quote fallback architecture Repository 🔗 GitHub Repository Future Roadmap News sentiment analysis Investment thesis tracking Market briefing generation Advanced financial reasoning agents hermeschallenge

2026-06-01 原文 →
AI 资讯

Error: Cannot Set Headers After They Are Sent to the Client

Error: Cannot Set Headers After They Are Sent to the Client If you've built APIs with Express for any length of time, you've probably seen this error: Error [ ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client Or: Cannot set headers after they are sent to the client The frustrating part is that the application often works for some requests and fails only under specific conditions. This error is almost always caused by sending multiple responses for the same request. Let's break down why it happens and how to prevent it in production code. Problem Consider this Express route: app . get ( " /users/:id " , ( req , res ) => { if ( ! req . params . id ) { res . status ( 400 ). json ({ error : " User ID required " }); } res . json ({ id : req . params . id }); }); Looks harmless. But if the first response is sent, Express continues executing the remaining code. Result: Error [ ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client The server attempts to send two responses for a single request. HTTP doesn't allow that. Why It Happens A request can only receive one response. Once Express sends: res . send (); or res . json (); or res . redirect (); or res . end (); the HTTP headers are already transmitted. Any attempt to modify headers or send another response will trigger the error. In production systems, this usually happens because of: Missing return statements Multiple async operations Duplicate error handling Middleware issues Promise and callback mixing Race conditions Example Missing Return Statement This is the most common cause. app . get ( " /profile " , ( req , res ) => { if ( ! req . user ) { res . status ( 401 ). json ({ error : " Unauthorized " }); } res . json ( req . user ); }); If req.user is missing: res . status ( 401 ). json (...) runs first. Then: res . json ( req . user ) runs immediately afterward. Two responses. One request. Crash. Correct Version app . get ( " /profile " , ( req , res ) => { if ( ! req

2026-06-01 原文 →
AI 资讯

The compiler caught a lot. It didn't catch enough.

I built a small web scraping framework in Rust, mostly with an AI doing the typing. It's called ferrous — a Colly-style collector: register CSS selector callbacks, queue URLs, write JSONL. About 700 lines. The pitch I kept hearing, and half-believed, was that Rust and LLMs are a good match now: the borrow checker is a correctness oracle the model can lean on, so the class of bugs that plagues AI-written Python just won't compile. That's true. It's also where the story gets uncomfortable, because the build was green and the code was still wrong. How I worked I'm not a Rust native. ferrous was partly an excuse to get fluent — build something real instead of reading about lifetimes — and partly a test of how far an LLM could carry the typing while I drove. The loop was plain: describe the next change in English, let the model write the Rust, read what came back, run cargo , move on. It kept observations.md as a running design journal, one entry per change, each with a short rationale for the decision it made. That setup has a soft spot, and it's the whole point of this post. When you drive a language you don't fully know, the only reviewer you've got with real authority is the compiler. Everything past that — is this idiomatic, is it the right abstraction, does it actually do what the journal claims — depends on already knowing what correct looks like. Which is exactly the knowledge a learner doesn't have yet. Keep that in mind through the next part, because it's the difference between the one bug I could have caught and the six I couldn't. The bug that the toolchain told me wasn't there I ship two fetch backends. The default goes through the Zyte API; an optional one, gated behind a wreq feature, makes direct requests with browser TLS emulation. Each has an example. After a refactor that added URL resolution — ctx.resolve_and_visit(href) so callbacks stop hand-building absolute URLs — I had the model update the examples to use it. It did, and it wrote up the change in

2026-06-01 原文 →
开发者

Branchless Cardinal Direction Movement

I developed a branchless, zero-dependency formula to handle cardinal direction movement without lookup arrays, which I call the Hichem formula . It uses phase-shifted triangle waves to compute dx and dy entirely at the ALU level, making it highly efficient for GPU and embedded applications. submitted by /u/CardiologistLow6042 [link] [留言]

2026-05-31 原文 →
AI 资讯

Mobile won the platform war on distribution, not capability

Author here. Wrote this from the vantage point of having shipped Android apps from 2010 to 2019-20. It's a platform-war retrospective along an axis I don't see articulated cleanly very often: update friction and channel control rather than runtime capability. Short version of the argument: The native-only residue (where mobile genuinely wins on capability) is thinner than the narrative claims. UPI in India because the device is the channel. Frame-budget and AR-heavy games. Sustained background GPS. RAW camera. Delivery/on-demand, with a tell (the apps are richer than the web versions because that's where the channel control is, not because the web cannot do it). Electron is the keystone, not a defensive aside. Slack, VS Code, Postman, Bruno, Spotify desktop. If web-versus-native were the deciding axis, the entire web-shell desktop category should have failed. It did not, because the desktop channel is open and the maintainer ships on their own cadence. PWAs are the reverse proof. Apple controls three brakes on the iOS web channel: the WebKit-only rule, the buried Add to Home Screen, and the notification permission. iOS web push did not land until 16.4 in March 2023, years after Android. When the channel is suppressed, the maintainer's update advantage does not save you. The Android hobbyist economy died not from a market outcome but from a channel outcome. Cambridge Analytica 2018 was the public license for a multi-year platform-hardening cycle (target-SDK floor, scoped storage, Play Integrity, foreground-service mandates) that progressively re-priced what kind of software was even shippable. The store does not just control the install button; the channel itself keeps narrowing on the people inside it. It's Part 1 of a two-part series on delivery channels. Posting because I'd rather have the argument tested here than not. submitted by /u/lordVader1138 [link] [留言]

2026-05-31 原文 →
开发者

AstroFit – My Fitness Tracking Web Application

By Suryansh Sinha (sinxcos07) Introduction Recently, I built AstroFit , a fitness-focused web application as a personal project to learn more about modern web development, deployment, databases, and building complete applications from idea to production. This project helped me understand how different parts of a web application work together, from the user interface to backend functionality and deployment. Why I Built AstroFit I wanted to work on a project that felt practical and useful while also helping me improve my development skills. Instead of creating a simple clone project, I decided to build a fitness application where I could experiment with real-world features and deployment workflows. Development Journey Building AstroFit involved much more than just creating pages and connecting them together. Some of the areas I explored while working on this project included: Frontend development Backend integration Database management Authentication systems Deployment and hosting Debugging production issues One of the biggest learning experiences was understanding how different technologies communicate with each other in a complete application. Future Plans I plan to continue improving AstroFit by adding more features, refining the user experience, and expanding its capabilities over time. This project is still evolving, and I'm excited to keep working on it. Project Links Live Demo: astrofit-fitness.vercel.app GitHub: sinxcos07 / astrofit-frontend Fitness platform combining workout tracking and astrology-inspired personalization. AstroFit AstroFit is a modern fitness web application that combines workout tracking with astrology-inspired personalization to create a unique and engaging fitness experience. Features Modern responsive UI Astrology-inspired fitness experience Workout tracking interface User authentication system Backend integration Smooth and interactive design Mobile-friendly layout Tech Stack Frontend HTML5 CSS3 JavaScript Backend Node.js Express.js SQL

2026-05-31 原文 →
AI 资讯

Need help understanding TikTok's messaging APIs

I'm integrating TikTok into my SaaS platform and I'm having a hard time figuring out which API I actually need. My goal is: - A TikTok user logs into my platform using TikTok OAuth. - I obtain an access token. - Using that token, I want to send and receive TikTok messages directly from my platform (similar to how platforms like Sambad.io, ManyChat, etc. work). The problem is that TikTok's API documentation feels pretty vague regarding messaging. I can find information about Login Kit, Content Posting APIs, Creator APIs, and Business APIs, but I can't clearly determine whether TikTok provides public APIs for sending and receiving direct messages. While researching, I noticed that Sambad.io appears to support TikTok messaging, which makes me wonder if they're using a partner-only API or if they have some special TikTok partnership. Has anyone implemented TikTok messaging integration before? Specifically: - Does TikTok provide public APIs for sending and receiving DMs? - Are these APIs restricted to approved partners? - Which TikTok product/API should I be looking at? - If messaging APIs are partner-only, what is the process for getting access? Any guidance or real-world experience would be greatly appreciated. submitted by /u/AffectionateTouch103 [link] [留言]

2026-05-31 原文 →