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

标签:#m

找到 8689 篇相关文章

开发者

JavaScript Interview Questions Every Dev Should Know — Part 2: Functions, Scope & Closures

Welcome to Part 2 of the JS interview series! This time we're tackling functions, scope, and the topic that trips up even experienced developers in interviews: closures . Missed Part 1? Check out Fundamentals & Data Types first. Q1. What is a closure? A closure is what happens when an inner function "remembers" and continues to have access to the variables from its enclosing (outer) function's scope, even after that outer function has already finished running and would normally have had its local variables cleaned up. This works because JavaScript functions don't just capture the values of outer variables — they capture live references to them, keeping the entire surrounding scope alive in memory for as long as the inner function itself is reachable. Closures are one of the most powerful and commonly used patterns in JavaScript. They're the mechanism behind data privacy (since variables inside a closure can't be accessed from outside except through the functions that were given access), factory functions that generate customized functions, memoization caches, and event handler callbacks that need to remember state from when they were created. In the classic counter example below, each call to counter() creates a fresh, independent count variable that only the returned function can see or modify — there's no way to reach into it from outside. function counter () { let count = 0 ; return () => ++ count ; } const inc = counter (); inc (); // 1 inc (); // 2 Q2. What is lexical scoping? Lexical scoping (also called static scoping) means that a variable's accessibility is determined entirely by where it's physically written in your source code — not by which function called which, or the order in which functions happen to execute at runtime. When JavaScript compiles your code, it can already determine, just by looking at the nesting of functions and blocks, exactly which variables any given piece of code will be able to see. This is what allows an inner function to "reach

2026-08-04 原文 →
AI 资讯

How I Made Features in a Large Flutter App Actually Removable

"Just delete the features you don't need" is the easiest thing in the world to write in a README, and the hardest to make true. I hit this building a Flutter app with six verticals in one codebase — marketplace, ride-hailing, car rentals, social feed, chat, wallet. Deleting one should have been simple. It wasn't, because every feature had tendrils: a route in the central route table a tab hardcoded in the app shell a button on the home screen a service registered in main() Remove the feature folder and you get a wall of compile errors from files that have nothing to do with it. Here's what actually worked. Make three things data instead of code 1. Routes Each feature exposes its own routes from its own folder: class WalletModule extends AppModule { const WalletModule (); @override String get id = > 'wallet' ; @override List < GetPage > get pages = > [ GetPage ( name: AppRoutes . wallet , page: () = > const WalletScreen ()), ]; } The app's route table becomes a composition: static final routes = < GetPage >[ .. . _centralRoutes , .. . ModuleRegistry . pages , ]; Adding or removing a feature stops being an edit to a shared file. It's one line in a registry. 2. Bottom-navigation tabs This one surprised me. My app shell imported the feed widget directly: // before — the always-present shell depends on an optional feature import '../feed/feed_tab.dart' ; The shell ships in every build. That import meant the social feature could never be removed. So a tab became a small data class that a feature contributes: class ShellTab { final String id ; final int order ; // core tabs use 10/30/40 final IconData icon ; final String labelKey ; final Widget Function () builder ; } Social contributes its tab at order 20, slotting between home and alerts without the shell knowing it exists. The shell merges its own tabs with ModuleRegistry.shellTabs and sorts. 3. Entry points Home screens linked to feature screens with Get.toNamed(...) . Named routes are already decoupled — no import nee

2026-08-04 原文 →
AI 资讯

Scope Is Never Fixed — Why Specification Ambiguity (Not Scope Creep) Is the Real Fixed-Price Problem

Software projects fail on fixed-price contracts. This is not a controversial statement — the Standish Group's CHAOS report has tracked this for decades, showing that only 31% of software projects succeed on time and on budget, while 50% are challenged and 19% fail outright. But the conventional wisdom about why they fail — scope creep — misses the real problem. Scope creep is a symptom. The real disease is specification ambiguity . The Map Is Not the Territory Paweł Brodziński, an experienced software delivery leader, captured this perfectly with a simple analogy. A specification is a map of the software you want to build. And as with any map, its representation of the terrain is necessarily imperfect. For a perfect map, it would have to be as large as the terrain itself. "The only absolutely precise specification of a software project is the code itself. But if you already have that, why would you buy it?" When you write "As a workspace owner, I can set administrative privileges to workspace members," two people reading that sentence will envision different things. One imagines a simple dropdown with three permission levels. The other imagines role-based access control with custom policies, audit logs, and delegation. Both are reasonable interpretations of the same text. The PMI's research on communications complexity confirms why this happens: the number of communication paths grows geometrically with project size ( n(n-1)/2 ), and every path is a channel where ambiguity can creep in. Even a simple conversation involves encoding, decoding, and filtering — two receivers can interpret the same message differently. Why This Is Not Scope Creep Scope creep is when a client asks for something new after the contract is signed. That's a well-understood problem with well-understood countermeasures: change requests, sign-offs, contingency buffers. Specification ambiguity is different. It's not about adding new things — it's about both parties believing they agreed on the sa

2026-08-04 原文 →
AI 资讯

The Art of Range Pricing in Software Projects: A Practical Guide for Agencies

Every software agency has been here: the client asks for a price, you give a range (say $45k–$65k), and two things can happen. Either the client nods and you win the deal at the low end — or they get suspicious and ask "so you don't actually know how much it costs?" Range pricing is often misunderstood. Used wrong, it looks like you're guessing. Used right, it's the most honest and professional way to price software projects — because anyone who gives you a single fixed number for an undefined project is either padding heavily or gambling with their margin. This guide covers when to use range pricing, how to structure it, and — most importantly — how to present it so clients trust you more, not less. Why Single-Point Pricing Is a Problem A fixed price for an undefined project forces you into one of two positions: You pad aggressively — add 40% contingency, quote $70k for a project you'd happily do for $50k. If the scope doesn't expand, the client overpays. If it does, you're protected. Either way, one party loses. You guess lean — quote $50k based on your best assumptions. If the client adds features mid-project, your margin evaporates. The client thinks they're paying for X, you're building X+Y. Both parties end up frustrated. A pricing range avoids both traps. It says: "based on what we know today, this project falls between $45k and $65k. Here's what needs to be true for the low end, and here's what would push it toward the high end." That's not guesswork. That's transparency. The Anatomy of a Good Pricing Range Not all ranges are created equal. A useful range has three properties: 1. Width That Respects Uncertainty The width of your range communicates how well you understand the project. Range width What it signals When it's appropriate < 15% ($50k–$57k) High confidence Detailed spec, similar past projects, known team 15–30% ($50k–$65k) Moderate confidence Clear brief, some unknowns in tech or integration 30–50% ($50k–$75k) Low confidence Vague brief, new domain

2026-08-04 原文 →
AI 资讯

A question on ICLR and NeurIPS deadlines, and OpenReview [D]

After a very silent discussion period, we are in a very confused state with regards to NeurIPS, and really unsure what to make of everything. We do not wish to withdraw the submission since we have no idea what the reviewers and AC think of the paper, having deserted the conversation after a hopeful set of initial reviews. As of currently, ICLR abstract submission deadline is before the NeurIPS results announcement. Are we allowed to resubmit as an ICLR abstract, or will OpenReview flag this and consider it problematic? submitted by /u/ihatesalad1 [link] [留言]

2026-08-04 原文 →
AI 资讯

The next Xbox could play every Xbox game ever made

The next Xbox, Project Helix, could theoretically have the largest library of any home console. Not only will it play PC games, but we now know, courtesy of a leaked memo obtained by The Verge's Tom Warren, that it will run games from every generation of Xbox: the original 2001 Xbox, the 2005 Xbox 360, […]

2026-08-04 原文 →
开发者

Safe Lock-free Primitives with iceoryx2's ByteAtomic

https://ekxide.io/blog/byte-wise-atomic-wrapper-to-prevent-ub iceoryx2 provides zero-copy inter-process communication mechanisms based on shared memory and data structures that are modified concurrently by multiple processes. One of the key operations in these algorithms is a memory copy using core::ptr::copy . However, this results in undefined behavior if one process reads the data while another process writes to it concurrently. Even if our lock-free algorithm reliably detects such a race, iceoryx2 cannot depend on undefined behavior in a safety-critical system. This blog post introduces our solution: a byte-wise atomic wrapper that enables well-defined concurrent copy operations. It also shows how it can be used to implement a simple sequence lock. Note: I am not the original author of the blog post. Since the author does not have a Reddit account, I am posting it on her behalf. submitted by /u/elfenpiff [link] [留言]

2026-08-04 原文 →
开发者

Python Pandas Library

Pandas is an open-source library for data analysis and manipulation in Python. It provides fast, flexible and expressive data structures for working with relational and labelled data. Originally developed by Wes McKinney in 2008, it has become a foundational tool in modern data science and serves as a highly programmable analogue to spreadsheet software. Key characteristics NumPy foundation: Built on top of NumPy, it inherits highly optimised, array-based computational performance. Label-driven alignment: Data are automatically aligned according to explicit row and column labels, thereby improving the reliability of calculations involving partially mismatched datasets. Heterogeneous typing: Unlike strict numerical arrays, Pandas can accommodate mixed data types, including integers, strings, floats and booleans, within a single tabular structure. Missing-data resilience: It provides native support for detecting, representing and handling missing values, such as NaN. Core data structures Series: A one-dimensional labelled array capable of holding any data type. In practical terms, it resembles a single column in a spreadsheet. DataFrame: A two-dimensional tabular data structure with labelled rows and columns. It may be regarded as a collection of Series sharing a common index, analogous to a table in SQL or a worksheet in Excel. Core features and capabilities Robust input/output parsing: Pandas supports efficient reading and writing across multiple formats, including CSV, Excel, SQL databases, JSON and Parquet. Advanced data cleaning: Built-in methods enable users to identify, filter and remove duplicates, and to impute missing values. Flexible wrangling and reshaping: The library facilitates pivoting, melting, slicing and subsetting operations based on conditional logic. High-performance merging: Relational operations such as inner, outer, left and right joins, as well as concatenation, can be executed in concise code. Split-apply-combine (GroupBy): Data may be group

2026-08-04 原文 →