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

标签:#Go

找到 560 篇相关文章

AI 资讯

Embedding Forbidden Text in Spyware to Discourage AI Analysis

At least one malware developer is adding text about nuclear and biological weapons to their spyware, in an effort to stop automatic AI analysis. Details : The _index.js payload begins with a large JavaScript block comment containing fake system instructions and policy-triggering content. Because it is inside a comment, it does not affect JavaScript execution. The runtime skips it. The real malware begins after the comment with a try{eval(…)} wrapper around a large character-code array and a ROT-style substitution function. This header appears designed for AI-mediated analysis, not for Node, Bun, or Python. It attempts to derail scanners or analyst copilots that feed the beginning of a file to a language model without clearly isolating the content as untrusted data. In weak pipelines, this can cause refusal behavior, prompt confusion, context pollution, or premature classification before the scanner reaches the actual malware...

2026-06-24 原文 →
AI 资讯

MongoDB Indexes Finally Clicked for Me: Understanding Indexes, Compound Indexes & the Prefix Rule 🚀

While working on a MERN project, I came across these indexes: transactionSchema . index ({ user : 1 , date : - 1 }); transactionSchema . index ({ user : 1 , type : - 1 }); transactionSchema . index ({ user : 1 , category : - 1 }); My first reaction was: "Why are we creating 3 different indexes for the same schema? Isn't one index enough?" At that time, my understanding was: "Indexes help MongoDB find records faster." Which is true, but it wasn't enough to explain why multiple indexes existed for the same collection. That simple doubt led me down a rabbit hole of learning about indexes, compound indexes, how MongoDB stores them, and the famous Prefix Rule. Here's what I learned. What is an Index? Imagine a collection with millions of transactions. db . transactions . find ({ user : " Aarthi " }); Without an index, MongoDB may need to inspect every document until it finds the matching records. This is called a Collection Scan . Think of it like searching for a chapter in a book without a table of contents. You'd have to flip through page after page until you find it. An index works like a book's table of contents. Instead of scanning every document, MongoDB can jump directly to the relevant records. Example: db . transactions . createIndex ({ user : 1 }); Now MongoDB can quickly locate all transactions belonging to a specific user. What is a Compound Index? A compound index contains multiple fields. Example: db . transactions . createIndex ({ user : 1 , date : - 1 }); This means MongoDB organizes the index by: user └── date Conceptually, it looks something like: Aarthi 2025-08-10 2025-08-09 2025-08-08 John 2025-08-10 2025-08-05 The data is first grouped by user , and within each user, it is ordered by date . Now queries like: db . transactions . find ({ user : " Aarthi " }). sort ({ date : - 1 }); become very efficient. MongoDB can jump directly to Aarthi's records and retrieve them in date order. The Prefix Rule: The Concept That Finally Made It Click Consider this i

2026-06-24 原文 →
AI 资讯

Array in Go

What is an Array in Go? In Go, an array is a fixed-size, ordered set of values with the same type. Imagine an array as a 12 egg tray; the minimum number of eggs which can fit into an array is 12; the maximum number of eggs which can fit into an array is 12. That is the exact behaviour of a Go array. package main ​ import "fmt" ​ func main() { var groceries [3]string// Step 1: Create an array that holds 3 strings groceries[0] = "Bread"// Step 2: Put "Bread" in slot 0 groceries[1] = "Milk"// Step 3: Put "Milk" in slot 1 groceries[2] = "Eggs"// Step 4: Put "Eggs" in slot 2 fmt.Println(groceries)// Step 5: Print the whole array } Expected output: [Bread Milk Eggs] Zero Values In Go, you create an array by using the var keyword, and each of the slots receives the safe code Zero value, given that no elements are explicitly set. This means that your array will never be in an unsafe state of being uninitialized. It will be valid on every slot, even before set. The same thing is a safety feature in Go intentionally. var prices [3]float64 fmt.Println(prices) // Output: [0 0 0] - Go fills all the values with zeros automatically Declaring an Array In Go, you can declare an array in a few different ways, and you will learn about each of them in turn. Using the var Declaration var groceries [3]string groceries[0] = "Bread" groceries[1] = "Milk" groceries[2] = "Eggs" If you want to initialise an array of a specific size and use it later, then this is the best method to achieve this. Array Literals If you are already aware of all the values at the time you write the code, then you can use the literal syntax: package main import "fmt" func main() { groceries := [3]string{"Bread", "Milk", "Eggs"} fmt.Println(groceries) } Expected output: [Bread Milk Eggs] The actual syntax is: [size]type{value1, value2, value3} This method is used when we know the values which we want to store in an array. Let the Compiler count for you — The ... trick When using literal syntax, and you find that you

2026-06-24 原文 →
开发者

Google Home will soon get better at recognizing you

A new update for Google Home could make it less likely your smart home cameras mistake you for someone else, just because you're facing away from the camera. Starting June 23rd, Google's expanding its facial recognition feature so that people you've tagged in your Familiar Faces library can continue to be identified when their faces […]

2026-06-24 原文 →
AI 资讯

The Monotonic Stack: Like Gandalf's Staff for Array Problems

The Quest Begins (The "Why") Honestly, I still remember the first time I stared at the Daily Temperatures problem on LeetCode and felt like I was trying to crack a vault with a toothpick. The brute‑force solution — two nested loops, checking every future day for a warmer temperature — was simple to write, but it timed out on the larger test cases. I spent an hour tweaking loops, adding early breaks, and even trying to memoize results, only to watch the same red “Time Limit Exceeded” banner flash again. I was frustrated, but more than that, I was curious. Why did this problem feel so repetitive ? Every element seemed to be asking the same question: “What’s the next greater value to my right?” If I could answer that for each index in a single pass, the whole thing would collapse into O(n). That’s when I remembered a weird little data structure I’d seen in a textbook — the monotonic stack — and realized it might be the magic wand I needed. The Revelation (The Insight) Here’s the thing: a monotonic stack isn’t just a stack with a funny name; it’s a way to capture relationships between elements without ever looking backward more than once . Imagine you’re walking through a line of people sorted by height, and you want to know, for each person, who is the first taller person standing ahead of them. If you keep a stack of people whose heights are strictly decreasing as you move from left to right, then whenever you see a new person taller than the one on top of the stack, you’ve just found the answer for that stacked person: the current person is their “next greater.” You pop them off, record the distance, and keep going. Because each index is pushed once and popped at most once , the total work is linear. The same idea works for “next smaller,” “previous greater,” or any problem where you need the nearest element that satisfies a monotonic condition. The stack does the heavy lifting of remembering candidates that could still be relevant, discarding the ones that are alrea

2026-06-24 原文 →
科技前沿

A breath test could diagnose pneumonia in minutes

With a test being developed at MIT, diagnosing pneumonia and other lung conditions could someday be as easy as breathing into a tube. The test, dubbed PlasmoSniff, is a portable, chip-scale sensor that traps and detects biomarkers, synthetic compounds indicating disease. The idea is that a person would first breathe in nanoparticles that are specially…

2026-06-24 原文 →
AI 资讯

Plants appear to detect the patter of falling rain

MIT engineers have found the first direct evidence that plant seeds can sense sounds in nature: Rice submerged in shallow water germinated 30% to 40% more quickly when exposed to vibrations from water dripping on the surface. They think other types of seeds may respond similarly. When a raindrop hits a puddle’s surface or the…

2026-06-24 原文 →
AI 资讯

Reinventing the zipper

With an adaptable fastener designed at CSAIL, pitching a tent or adjusting the cast for a broken bone could be almost as easy as zipping your coat. The researchers, led by associate professor Stefanie Mueller, were inspired by an abandoned prototype for a three-sided zipper that William Freeman, PhD ’92 (now an MIT professor), patented…

2026-06-24 原文 →
开发者

Ultrasound imaging turns a robot hand into a skillful mimic

Our hands are the nimblest parts of our bodies, coordinating 34 muscles, 27 joints, and over 100 tendons and ligaments to perform countless nuanced movements and gestures. So far, robots have been notoriously bad at mimicking that dexterity, in part because researchers struggle to capture what is actually going on under our skin in order…

2026-06-24 原文 →
安全

Stand Up for Research, Innovation, and Education

Right now, MIT alumni and friends are voicing their support for: America’s scientific and technological leadership Merit-based admissions and affordable education Advances that increase US health, security, and prosperity Our community is standing up for MIT and its mission to serve the nation and the world. And we need you to join us at this…

2026-06-24 原文 →
AI 资讯

Sharing a love for calculus

The national conversation about the value of education is currently dominated by speculation about the risks and positive potential of AI. Whatever your own perspective on that debate, I hope you’ll be glad to know that MIT is also working on a deeply important but comparatively old-fashioned challenge: American high school students’ startlingly uneven access…

2026-06-24 原文 →
AI 资讯

A man of many words

Brian Sietsema has a favorite word. It’s somewhat surprising that he can choose just one. He’s the person spellers rely on to confirm pronunciations and answer questions about the roots of the words they’re given at the Scripps National Spelling Bee—arguably the world’s most prestigious competition of its kind. The story of how the word…

2026-06-24 原文 →
AI 资讯

Super Mario is mathier than you think

Here’s a problem you probably didn’t solve in school: You’re an ambitious young plumber from Brooklyn in a world inhabited by violent human-size mushrooms called Goombas. The love of your life has been kidnapped, so you embark on a quest to rescue her, venturing through stretches of pipe-filled and monster-­ridden terrain where your only means…

2026-06-24 原文 →
AI 资讯

Heads in the game

The Argentina v. France final of the 2022 Men’s World Cup in Qatar was shaping up to be one of the most epic games in soccer history. With just 12 minutes remaining in the extra time added to the game to break a tie, the referee had a critical decision to make—and fast. Lionel Messi,…

2026-06-24 原文 →
开发者

The Pixel 10A finally costs what it should

We can usually rely on Google to put together a compelling package in its Pixel A-series devices. The Pixel 10A was kind of a letdown, though. It added only a handful of updates, like satellite messaging and updated Gorilla Glass on the screen — but it still costs $499, like the Pixel 9A. Kind of […]

2026-06-24 原文 →
AI 资讯

AI Studio is untapped territory for a large set of Developers and rightfully So..

This post is my submission for DEV Education Track: Build Apps with Google AI Studio . What I Built I set out to build the same app as the one mentioned in the Tutorial. Please create an app that generates a unique new Magic the Gathering card, using Imagen for the visuals, and Gemini to create the text descriptions and stats for the card. Apply the "Sophisticated Dark" design theme to the app. Spammed Fix Errors Non-Stop After this other than the Manual Entry option. Demo My Experience You can't trust Gemini Flash even for the Task provided in the Tutorial Standalone at least and well I spammed Fix Errors and they removed the Auto-Fixing of Errors because of idk an infinite loop or something but well the Error Fixing Experience was quite Meh considering I haven't delved into Vue and React in that level yet so I just 'Vibe Coded' and I found out with this experience that Vibe-Coding is UnCool. I think I would do the other course after properly understanding concepts behind it unlike the way I jumped in this One.

2026-06-23 原文 →
AI 资讯

Go 1.26 Cheat Sheet

This cheat sheet is based on Go 1.26. Table of Contents Program structure Variables, constants, and types Control flow Functions Arrays, slices, and maps Structs, methods, and tags Interfaces Errors Goroutines, channels, and synchronization Context Generics Iterators Testing Standard-library quick reference Tips and common mistakes Modules and packages Further reading Program structure package main // Every executable must be in package main. import ( "fmt" "os" ) func main () { fmt . Println ( "Hello, Go 1.26" ) os . Exit ( 0 ) } Every Go source file starts with a package declaration. An executable program uses package main and a main function. Group standard-library and third-party imports separately. Variables, constants, and types Variable declarations and inference // var can infer the type from an initializer. var name = "Gopher" // string var age int // No initializer: specify a type. Zero value: 0. var id int64 = 42 // Use an explicit type when int is not what you want. // Short declaration: inside functions only. city := "Tokyo" // Declare multiple variables in a block. var ( x , y int = 1 , 2 msg string ) Use var name = "Gopher" when an initializer makes the type clear. Without an initializer, write the type explicitly. A := declaration is only valid inside a function, and at least one name on its left side must be new. Types and zero values Category Types Zero value Numbers integers, floats, complex numbers 0 ( 0 + 0i for complex) Strings string "" Booleans bool false Arrays [N]T every element is T 's zero value Structs struct every field has its zero value Reference-containing types pointers, slices, maps, channels, functions, interfaces nil Defined types e.g. type UserID int the underlying type's zero value Category Types Notes Boolean bool true or false String string immutable sequence of bytes (usually UTF-8, but invalid UTF-8 is allowed) Signed integers int , int8 , int16 , int32 , int64 int is platform-sized (32 or 64 bit) Unsigned integers uint , u

2026-06-23 原文 →