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

标签:#Java

找到 1193 篇相关文章

AI 资讯

Article: Virtual Threads After JDK 24: What Changed for Production Java

JDK 24 removed the monitor-related carrier-thread pinning that stalled Netflix and similar teams on Java 21. What has replaced it on JDK 25 LTS is downstream-resource saturation: The bottleneck moved and now demands explicit bounding in application code. This article maps the failure modes that surface after virtual-thread adoption and gives a practical sequence backed by a public benchmark. By Sandeep Bharadwaj

2026-07-31 原文 →
AI 资讯

JavaScript vs React: What's the Difference?

JavaScript vs React: Understanding How They Work Together If you're starting web development, you've probably heard about JavaScript and React. Many beginners think they are competitors, but they actually work together. Let's understand them in simple terms. What is JavaScript? JavaScript is a programming language used to make websites interactive. Without JavaScript, a website would mostly be static. JavaScript allows you to: Handle button clicks Validate forms Create animations Fetch data from APIs Update content without refreshing the page Example: document . getElementById ( " btn " ). addEventListener ( " click " , () => { alert ( " Hello World! " ); }); JavaScript is the foundation of modern web development. What is React? React is a JavaScript library created by Meta Platforms for building user interfaces. Instead of manipulating the webpage manually, React helps developers create reusable UI components. Example: function Welcome () { return < h1 > Hello World! </ h1 >; } React uses JavaScript to create dynamic and interactive user interfaces more efficiently. Simple Analogy Think of building a house: JavaScript = The tools and materials (bricks, cement, wood) React = A construction framework that helps you build the house faster and more efficiently You need JavaScript to use React. Key Differences Feature JavaScript React Type Programming Language JavaScript Library Purpose Adds logic and interactivity Builds UI components Learning Curve Easier to start Requires JavaScript knowledge Usage Works everywhere Used mainly for frontend applications Created By Netscape Meta (Facebook) DOM Updates Manual Virtual DOM for optimized updates Why React Became Popular As applications grew larger, managing UI with plain JavaScript became difficult. React solves this by providing: Component-based architecture Reusable code Better state management Faster UI updates with Virtual DOM Large ecosystem and community support This makes React ideal for building modern applications

2026-07-31 原文 →
开发者

Use Google Sheets as a Translation Database for Your Web App (Apps Script + Next.js)

Every i18n setup I've seen has the same three-way standoff. Developers want type-safe JSON in the repo. Translators want a familiar tool, not a pull request. Product wants to fix a typo without a deploy. So you either pay $50–$500/month for a localization SaaS, or you copy-paste strings between a translator's spreadsheet and your JSON files until something silently breaks. For projects under ~1,000 keys, there's a better middle: the spreadsheet is the database. Translators edit a Google Sheet; an Apps Script endpoint serves it as clean locale JSON; your app pulls that at build time. Here's the whole pattern, with the code. Why a sheet beats a translation service for small projects A localization SaaS earns its price at scale — dozens of translators, thousands of keys, screenshots and review workflows. A 300-key marketing site doesn't have that problem; it has a coordination problem. A Sheet solves coordination for free: translators already know it, it has revision history and suggested edits built in, and product can change a string in ten seconds. You only add the two things a raw sheet lacks — a clean JSON API and a fallback for missing translations. The schema: one tab, one row per key A strings tab, with the key in column A and one column per locale: key en tr es fr hero.title Welcome Hoş geldiniz Bienvenido Bienvenue hero.cta Get started Başla Empezar Commencer Use dot-notation keys ( hero.title ) so the JSON nests naturally in your i18n library. Keep a tiny meta tab too: B1 = default locale ( en ), B3 = version ( 1.0.0 ). The Apps Script endpoint Deploy this as a Web App (same mechanics as any Apps Script webhook ). doGet serves one locale — or all of them — as JSON, and the fallback lives right in the query: an empty cell resolves to the default locale, so a half-translated key never ships blank. // Code.gs const SHEET_ID = ' your-sheet-id ' ; function doGet ( e ) { const locale = ( e . parameter . locale || ' all ' ). toLowerCase (); const result = buildLoca

2026-07-31 原文 →
AI 资讯

MOKSHA Devlog: Why My Game Worked on Itch.io but Died on GitHub Clone (The .gitignore Trap) 🤡

Hey DEV Community! 👋 I am currently building MOKSHA, an HTML5 Canvas game deeply rooted in Vedic philosophy. The game involves managing your Karma, avoiding Maya (Illusions), and achieving spiritual liberation. Ironically, while building a game about waking up from cosmic illusions, I fell into a technical illusion myself yesterday. Let me tell you a chaotic detective story about how my game froze on a fresh repository clone, and how I found the silent assassin hiding in plain sight. 🤡 🚫 The Disaster: Works on Itch.io, Freezes on GitHub So, there I was, ready to release a fresh update. I generated my build packages locally, zipped them up, and proudly uploaded them to Itch.io. I hit Publish, tested the live link, and everything worked flawlessly. High scores, smooth frames, total spiritual awakening. Then, I casually walked over to my terminal, ran git add . followed by git push, and went to bed thinking I was an absolute pro. The next morning, I wanted to double-check my clean repository, so I cloned it fresh into a new folder. I booted up the local server, and... the entire game was completely unclickable. Dead clicks. Frozen canvas. Total illusion (Maya). 💀 Opening up the browser console revealed a fierce wall of red text: style.min.css:1 Failed to load resource: the server responded with a status of 404 (Not Found) main.min.js:1 Failed to load resource: the server responded with a status of 404 (Not Found) 🕵️‍♂️ The Realization: It Wasn't Me, It Was My .gitignore! Initially, I blamed my sleep-deprived brain, thinking I forgot the chronological order of pushing and building. But when I opened my root directory to inspect the crime scene, I found the real culprit staring right back at me on lines 46 and 50 of my .gitignore file: dist/ *.zip index.min.html The Ultimate Trap Exposed 🪤 Because dist/ was explicitly blacklisted in my .gitignore, Git was literally doing its job perfectly by completely ignoring my production builds during staging! Here is exactly how the

2026-07-31 原文 →
AI 资讯

Spring AI Token Usage: Measure Cost Before You Pick a Model — LLM Cost Control 1/4

Cutting LLM costs in Spring AI starts with two choices: which model answers a request, and what defaults your ChatClient adds to every one it sends. Neither is worth changing until you can see where the tokens go. That is why this article starts with measurement. This is Part 1 of four, and it covers the first three of ten cost drivers. Driver #0 tells you where the money actually goes; #1 and #2 are the two decisions that shape every request your application sends. The remaining seven attach to what you build here. A note on the numbers: where a price ratio matters for the argument (input vs. output, cache read vs. write), this series quotes real July 2026 list prices with a link. All other examples use a flat rate of $1 per million input tokens, so you can redo the calculation with your own provider's price sheet. You should do that, because these prices change every few months. Driver #0 — Spring AI observability measurement: you cannot cut what you cannot see Provider invoices and usage dashboards usually show your spending by model and by token type — input, output, and cached. That is useful, but it is not enough. The numbers cannot tell you which feature, client, or advisor inside your application was responsible for that usage. Spring AI integrates with Spring Boot's Micrometer-based observability to fill this gap. Its core AI components automatically emit that data. ChatModel , EmbeddingModel , and ImageModel implementations (support varies by provider) publish model-level observations, including token usage where available. ChatClient (including advisors) and VectorStore report execution observations and traces rather than token usage metrics. Each metric includes built-in tags, such as the model name and token type. These tags separate models and providers, but not callers: every request to the same model carries the same tag values, so they cannot tell two features apart on their own. Spring AI marks tags as low- or high-cardinality: low-cardinality tags

2026-07-30 原文 →
AI 资讯

How to Reduce LLM Costs in Spring AI 2.0: 10 Practical Controls

Spring AI's defaults are built for a fast start; they do not guarantee a low monthly cost. Shipping an LLM feature is easy — making it cost-efficient is not. This series shows the spots where money leaks, along with the control that closes each one. Spring AI 2.0 reached GA on 12 June 2026 . It needs Spring Boot 4 , moves the tool-calling loop out of the ChatModel , adds tool search, and extends structured outputs. Tool search and the extended structured-output controls point in the same direction: they determine how many tokens your application sends and receives. The bill grows quietly. A chatbot with a 2,000-token system prompt, run 100,000 times a month, sends 200 million tokens of the same text. At an example rate of $1 per million input tokens, that is $200 a month — before a single user message. Then add conversation history, which is sent in full on every turn. Add retrieved RAG documents and the JSON schema of every registered tool. The input side can grow 10× with no change in traffic at all. Output tokens cost several times more per token than input tokens, and reasoning models bill their hidden "thinking" as output too. The provider sets the prices. The framework gives you controls that can reduce the number of tokens you pay for. This series works through ten cost drivers, numbered #0 to #9. Each one is a place where tokens repeat or grow without anyone deciding they should, and each comes with the Spring AI control that cuts it. They are spread across four parts. Part 1 is live. Parts 2 to 4 follow in August 2026. Part 1 — Token Usage: Measure Cost Before You Pick a Model (Drivers #0–#2) Provider dashboards show what you spent, but not which feature spent it. Spring AI's observability closes that gap, and from there you can match each model to its task and stop features from carrying defaults they never needed. Part 2 — Prompt Caching and Chat Memory: Where the Tokens Go (Drivers #3–#5) This part covers limiting response length, bounding how much conve

2026-07-30 原文 →
AI 资讯

The 300px Canvas Bug That Shrunk My React Image Editor

This is a submission for DEV's Summer Bug Smash: Clear the Lineup powered by Sentry . Project Overview I am building a browser-based text removal workspace where a user uploads an image, paints over unwanted text or objects, and sends the resulting mask to an image-editing pipeline. The mask editor uses three stacked <canvas> elements: a base canvas for the uploaded image; an overlay canvas for the painted mask; a cursor canvas for the brush preview and pointer events. All three canvases must have identical dimensions. The pointer coordinates must also map back to the same bitmap coordinate system, or the generated mask will not match the part of the image the user selected. Bug Fix On desktop, the editor had plenty of horizontal space but the uploaded image appeared inside a narrow strip surrounded by a large empty area. The result preview used the available width correctly, so the two sides of the same workspace looked unrelated. The visible symptom was a tiny image editor. The actual failure started before the image was drawn. The initialization code measured the width of the canvas wrapper: const container = canvas . parentElement if ( ! container ) return const containerWidth = container . clientWidth || 1 const containerHeight = 600 It then calculated the largest canvas size that would preserve the uploaded image's aspect ratio: const imgAspectRatio = img . width / img . height const containerAspectRatio = containerWidth / containerHeight let canvasWidth : number let canvasHeight : number if ( imgAspectRatio > containerAspectRatio ) { canvasWidth = containerWidth canvasHeight = containerWidth / imgAspectRatio } else { canvasHeight = containerHeight canvasWidth = containerHeight * imgAspectRatio } The aspect-ratio calculation was correct. The measurement it received was not. Root Cause: The Canvas Measured Itself The wrapper was a relatively positioned element with no declared width: < div className = "relative transition-all duration-500 ease-out" style = { {

2026-07-30 原文 →
AI 资讯

Rino.js 3, Building Modern Websites Without a Frontend Framework

Modern web development has become incredibly powerful. But also increasingly complicated. Many projects begin by installing hundreds of megabytes of dependencies before writing a single page. Frameworks, bundlers, routers, templating systems, CSS tooling, and runtime libraries all solve important problems, but they also introduce additional complexity. I wanted something different. I wanted to build websites that start with plain HTML, while still providing the features developers expect today: Reusable components Markdown support TypeScript CSS and JavaScript bundling Internationalization (i18n) Content collections RSS/Atom feeds Sitemap generation Fast development builds That idea became Rino.js. What is Rino.js? Rino.js is an HTML-first website compiler for building static websites, documentation, blogs, portfolios, company websites, and other content driven projects. Instead of introducing a custom templating language or requiring a frontend framework, Rino.js treats HTML as the primary language. Pages remain valid HTML while additional functionality is added through a small set of build-time conventions. The goal is simple: Write HTML. Generate optimized static websites. Why HTML First? HTML has existed for decades, yet modern web development often treats it as something generated by another language. Rino.js takes the opposite approach. Instead of writing components in JSX or another template language, components are simply HTML files. <component rino-import= "header" ></component> That's all it takes. The compiler replaces the component during the build, producing plain static HTML with no runtime dependency. Starting Rino.js Rino.js has a command that is designed to provide default project. npm create rino@latest Project Shape A Rino.js project usually looks like this: my-site/ rino-config.js dev.js generate.js feed.js sitemap.js backoffice.js pages/ index.html about.html components/ header.html footer.html public/ images/ photo.webp scripts/ export/ app.js

2026-07-30 原文 →
AI 资讯

Getting Started with Ant Design — Build Your First React UI in 15 Minutes

What Is Ant Design? Ant Design (antd) is a React UI library built by Alibaba's Ant Group. It's the most starred React component library on GitHub from China, with over 90k stars — yet surprisingly undercovered in the English-speaking developer community. If you've used Material UI or Chakra UI, Ant Design is the Chinese equivalent, but with its own design philosophy: consistent, predictable, and packed with enterprise-grade components out of the box. Fun fact: Alibaba, Tencent, Baidu, and most Chinese tech companies use Ant Design in production. It powers dashboards that serve hundreds of millions of users. Why Ant Design Over MUI? Feature Ant Design Material UI Components 60+ 50+ Table (Pro) Built-in sorting, filtering, pagination, row selection Requires manual wiring Form validation Declarative, built-in Requires react-hook-form or Formik Tree-shaking Supported (v5) Supported Bundle size (min) ~200KB gzipped ~140KB gzipped Documentation Chinese-first, English translations available English-first Design system Ant Design System (custom) Material Design (Google) Ant Design wins on out-of-the-box productivity — especially for data-heavy apps like admin panels and dashboards. MUI wins on bundle size and first-party English docs. Installation npm install antd @ant-design/icons No peer dependencies beyond React 16+. Your First Ant Design Component import React from " react " ; import { Button , Space } from " antd " ; import { SearchOutlined , DownloadOutlined } from " @ant-design/icons " ; export default function App () { return ( < Space > < Button type = "primary" icon = { < SearchOutlined /> } > Search </ Button > < Button icon = { < DownloadOutlined /> } > Download </ Button > < Button type = "dashed" > Dashed </ Button > < Button type = "link" > Link </ Button > </ Space > ); } That's it. Five button variants with zero CSS. Building a Data Table in 5 Minutes import React , { useState , useMemo } from " react " ; import { Table , Input } from " antd " ; const data

2026-07-30 原文 →
AI 资讯

The Lateral Isolation Tax: Preventing Direct Communication Between Peer Services

I put together a project to document an architectural discipline I call " Lateral Isolation ". The core idea is simple: preventing direct communication between peer services by requiring all interactions to pass through a controlled boundary. I am not claiming this is a brand-new pattern—it is essentially Information Hiding and the Acyclic Dependencies Principle applied strictly at the service level. However, I wanted to provide more than just theory. My GitHub repository includes runnable code and an ArchUnit test that physically proves the isolation holds and prevents the inevitable "just this once" dependency sprawl. The Trade-offs (The "Tax") I have explicitly documented the costs because architectural rules are never free: Latency: Enforcing this means accepting a 5–10 ms latency tax per hop. Centralization: A shared boundary introduces centralization risks. Because it is not meant to be a blanket rule, I also included a framework for deciding when to enforce it versus when to skip it. Looking for Critique I am looking for this community to poke holes in the logic. Where does my "decision rule" fall apart? I would appreciate any blunt feedback or edge cases I might have missed. You can check out the runnable demos and the full logic here: https://github.com/vijayagopalsb/isolation-tax

2026-07-30 原文 →
AI 资讯

My Internship Journey: Learning Beyond the Classroom

Internships are one of the most valuable experiences for any undergraduate, and I am grateful to have completed mine. This journey allowed me to bridge the gap between academic knowledge and real-world software development while improving both my technical and professional skills. From my very first day, I was introduced to a collaborative development environment where teamwork, communication, and problem-solving played a major role. I had the opportunity to work on real projects, understand industry workflows, and learn how professional software products are built and maintained. Throughout my internship, I gained hands-on experience with modern web technologies, version control using Git, API integration, debugging, and deploying applications. I also learned the importance of writing clean, maintainable code and following industry best practices. Working alongside experienced developers helped me improve my coding standards and exposed me to new tools and frameworks. One of the biggest lessons I learned was that software development is not only about writing code. It involves understanding user requirements, collaborating with team members, managing deadlines, and continuously learning new technologies. Every challenge I encountered became an opportunity to grow and improve my skills. Beyond technical knowledge, this internship strengthened my confidence, communication, time management, and ability to work effectively in a professional team. The guidance and support from my mentors played a significant role in my growth throughout this journey. Looking back, this internship has been a milestone in my career. It has given me practical experience, valuable industry exposure, and a clearer vision of the software engineering field. I am excited to apply these lessons in my future projects and continue growing as a developer. I would like to express my sincere gratitude to my mentors, teammates, and the organization for providing me with this incredible opportunity. Th

2026-07-30 原文 →
开发者

Join our latest Frontend Challenge: Comfort Food Edition 🍲

We're back with another Frontend Challenge, and this time we're hungry! 🍜🥧 Running through August 16 , Frontend Challenge: Comfort Food Edition invites you to build something inspired by the food that makes you feel at home. Show off the dish you make when nothing else will do, build a site for a restaurant that exists (or one that only lives in your head), share the recipe you've been perfecting for years, or put a spotlight on a regional dish that deserves more attention. Whether you're a CSS connoisseur, a JavaScript chef, or somewhere in between, there's a prompt here for you. We hope you give it a try! The Prompts CSS Art: Comfort Food Create a work of art using primarily CSS! Let food be your inspiration: a steaming bowl of ramen, a stack of pancakes, a perfectly cut slice of pie, or the dish you grew up eating. CSS Art Submission Template Note: We're now allowing a sprinkle of JavaScript in CSS Art submissions! However, judging will continue to focus primarily on the CSS component, so keep JavaScript usage light and purposeful. The star of the show should still be your CSS skills. Perfect Landing: Comfort Food Build a polished, functional landing page with a food theme. This could be a real or imaginary restaurant, a recipe collection, a food festival, a love letter to a regional dish, or anything else you can imagine, as long as it captures the theme and demonstrates excellent frontend fundamentals. Perfect Landing Submission Template Note: You may use JavaScript, TypeScript, Dart, WebAssembly, or any other browser-compatible language/runtime in your Perfect Landing submissions! Show us what modern web development can do. Judging Criteria and Prizes CSS Art submissions will be evaluated on: Creativity Effective Use of CSS Aesthetic Outcome Perfect Landing submissions will be evaluated on: Accessibility Usability and User Experience Creativity Code quality Prizes Each prompt winner will receive a DEV++ Membership and an exclusive DEV Badge. All Participants w

2026-07-30 原文 →
AI 资讯

Why You’re Failing the 2026 QA Automation Interview (And The Architecture You Need to Know)

Download my Automation Testing Interview Questions from ⬇️ Apple AppStore - https://apps.apple.com/us/app/qa-automation-interview-prep/id6786760948 👈 ⬇️ Playstore - https://play.google.com/store/apps/details?id=com.app.seleniuminterviewquestions 👈 The standard advice for passing a QA Engineering interview is broken. If you ask a forum how to prepare, you will be told to "learn Playwright," "memorize XPath," or "know how to write a basic API GET request in Postman." That advice worked in 2021. Today, engineering teams do not want manual testers who learned basic syntax. They are hiring Software Engineers in Test (SDETs) who understand system architecture, CI/CD pipelines, and data state. If you are failing technical rounds, it is rarely because you forgot a WebDriver command. It is because you are testing the syntax instead of the system. Here are the two architectural concepts you are actually being judged on in a modern QA interview, and how to approach them. 1. The API Race Condition & Idempotency Trap In a technical round, a senior engineer will rarely ask you to "test a login endpoint." Instead, they will give you a scenario like this: "We have a microservice that processes payments. The user clicks 'Submit', but the network drops, so they click it again. How do you automate a test to ensure they aren't charged twice?" The Junior Answer: "I will write an automated script that clicks the button twice quickly and checks the database." The Senior Answer (What they want to hear): "I will write a test that validates the API's idempotency . I will intercept the first request, capture the unique idempotency key from the header, and fire a duplicate POST request with the exact same payload and key. The test must assert that the backend returns a 409 Conflict or a 200 OK with the original transaction ID, verifying the database state didn't duplicate the charge." If you do not understand idempotency, payload validation, and race conditions, your API automation is just che

2026-07-29 原文 →
AI 资讯

Unknown Time Is Not Noon: Modeling Missing Temporal Data Without Inventing Facts

Missing data is not the same thing as a convenient default. That sounds obvious, yet temporal software regularly converts an empty time field into midnight, noon, the current time, or the start of a day. The interface may look complete after that conversion, but the program has silently changed an unknown fact into a known one. This matters anywhere an hour can change the result: medical timelines, transport schedules, legal deadlines, astronomical calculations, historical records, and calendrical systems. I encountered the problem while working with a BaZi calculation pipeline. A BaZi chart can use year, month, day, and hour components. If the birth time is absent, the honest result is a three-component analysis with hour-dependent conclusions withheld. Inserting noon would make the output look richer while making its provenance weaker. The useful engineering question is not “Which fallback time should we choose?” It is “How do we keep uncertainty visible through every layer of the system?” The public calculation evidence repository provides the concrete calendar-domain fixtures referenced below. The rest of this article focuses on the reusable software boundary behind them. Model knowledge, not just a string A common input model makes absence too easy to erase: const birthTime = form . time || " 12:00 " ; After this line runs, downstream code cannot tell whether noon came from the user or the fallback. Validation, analytics, caching, and the result renderer all see the same string. The information loss happens before the calculation begins. A small discriminated union keeps the two states separate: /** * @typedef {{ kind: "known", localTime: string, source: "user" }} * KnownTime * @typedef {{ kind: "unknown" }} UnknownTime * @typedef {KnownTime | UnknownTime} BirthTime */ function parseBirthTime ( value ) { const normalized = value ?. trim (); return normalized ? { kind : " known " , localTime : normalized , source : " user " } : { kind : " unknown " }; } This typ

2026-07-29 原文 →
AI 资讯

Port Support You Can Trace Back to a Green Test

“Supported on iOS, Android, desktop, and web” sounds useful until you need one method on one target. Does WebSocket work on watchOS? Which Linux architectures do we build? Was the JavaScript media test green this week, or did somebody update a table six months ago and forget it? What is Codename One? Codename One is an open-source framework for building native iOS, Android, desktop, and web apps from a single Java or Kotlin codebase. Learn more at codenameone.com . PR #5389 turns those questions into the Codename One Port Status page . It maps 49 user-facing feature groups across 10 portability targets to current conformance results, environment data, skip reasons, and the date of the run. The table is an output, not an opinion The HelloCodenameOne suite already exercises APIs and screenshot goldens on Android, iOS, tvOS, watchOS, JavaScript, native Linux, native Windows, and Mac Catalyst. The missing part was a contract that translated thousands of test cases into a stable public vocabulary. The new conformance mapping connects registered tests and screenshots to rows such as networking, media, databases, maps, notifications, input, accessibility, and 3D. CI normalizes each port's result into the same report format. A publishing workflow writes the latest reports to a data-only branch. The website consumes those reports and renders the matrix. The page currently renders 490 feature cells. Ten targets appear because architectures and renderer variants matter. iOS Metal and legacy OpenGL are separate evidence paths. Windows x64 and ARM64 are separate. Linux x64 and ARM64 are separate. JavaSE is deliberately excluded from the public portability matrix. It is the simulator and development runtime, not one of the deployed native targets the table is meant to prove. A green cell has a chain of evidence Each status report records the commit, environment, registered tests, outcome, duration, and skipped cases. The website data also records the runtime used for browser and

2026-07-29 原文 →