Generative Art with p5.js: Creating Beauty from Code

Are you ready to make something truly beautiful with p5.js? Forget about boring bar charts and sales data—let’s create art that moves, breathes, and responds to your touch. We’re going to explore generative art, where code becomes your paintbrush and algorithms become your muse.

Generative art is all about creating beauty through systems and rules. Instead of drawing each line by hand, you write code that follows patterns, and those patterns create something unexpected and often stunning. It’s like planting a garden and watching it grow—you set the conditions, but nature (or in this case, your code) does the rest.

Let’s start with something simple but mesmerizing: a field of flowers that sway in the wind. Each flower will be unique, with its own color, size, and movement pattern. We’ll use mathematical functions to create organic, natural-looking motion.

let flowers = [];
let wind = 0;function setup() {createCanvas(800, 600);colorMode(HSB, 360, 100, 100, 1);// Create a field of flowersfor (let i = 0; i < 50; i++) {flowers.push(new Flower(random(width),random(height),random(20, 60),random(360)));}
}function draw() {background(200, 30, 95, 0.1); // Soft sky blue with fade effect// Update windwind = sin(frameCount * 0.02) * 0.5;// Draw and update flowersfor (let flower of flowers) {flower.update();flower.display();}
}class Flower {constructor(x, y, size, hue) {this.x = x;this.y = y;this.size = size;this.hue = hue;this.angle = 0;this.stemLength = size * 2;this.petals = floor(random(5, 12));}update() {this.angle += wind + sin(frameCount * 0.05 + this.x * 0.01) * 0.1;}display() {push();translate(this.x, this.y);rotate(this.angle);// Draw stemstroke(120, 80, 40);strokeWeight(3);line(0, 0, 0, this.stemLength);// Draw flower headtranslate(0, this.stemLength);// Draw petalsfor (let i = 0; i < this.petals; i++) {let angle = (i / this.petals) * TWO_PI;let petalX = cos(angle) * this.size * 0.8;let petalY = sin(angle) * this.size * 0.8;fill(this.hue, 80, 90, 0.8);noStroke();ellipse(petalX, petalY, this.size * 0.6, this.size * 0.3);}// Draw centerfill(60, 90, 90);ellipse(0, 0, this.size * 0.3);pop();}
}

This creates a gentle field of flowers that sway in a simulated breeze. Each flower is unique, with different colors, sizes, and numbers of petals. The HSB color mode gives us more intuitive control over colors—hue (the color), saturation (how vivid), and brightness (how light or dark).

But let’s make it more interactive. What if the flowers respond to your mouse, growing taller when you’re near them?

let flowers = [];
let wind = 0;function setup() {createCanvas(800, 600);colorMode(HSB, 360, 100, 100, 1);for (let i = 0; i < 50; i++) {flowers.push(new Flower(random(width),random(height),random(20, 60),random(360)));}
}function draw() {background(200, 30, 95, 0.1);wind = sin(frameCount * 0.02) * 0.5;for (let flower of flowers) {flower.update();flower.display();}
}class Flower {constructor(x, y, size, hue) {this.x = x;this.y = y;this.size = size;this.hue = hue;this.angle = 0;this.stemLength = size * 2;this.petals = floor(random(5, 12));this.targetStemLength = this.stemLength;}update() {this.angle += wind + sin(frameCount * 0.05 + this.x * 0.01) * 0.1;// Respond to mouse proximitylet distance = dist(mouseX, mouseY, this.x, this.y);let mouseInfluence = map(distance, 0, 100, 1.5, 1);this.targetStemLength = this.size * 2 * mouseInfluence;// Smooth animationthis.stemLength += (this.targetStemLength - this.stemLength) * 0.1;}display() {push();translate(this.x, this.y);rotate(this.angle);// Draw stem with gradientfor (let i = 0; i < this.stemLength; i += 5) {let alpha = map(i, 0, this.stemLength, 1, 0.3);stroke(120, 80, 40, alpha);strokeWeight(3);line(0, i, 0, i + 5);}translate(0, this.stemLength);// Draw petals with variationfor (let i = 0; i < this.petals; i++) {let angle = (i / this.petals) * TWO_PI;let petalX = cos(angle) * this.size * 0.8;let petalY = sin(angle) * this.size * 0.8;// Vary petal color slightlylet petalHue = this.hue + sin(i * 0.5) * 20;fill(petalHue, 80, 90, 0.8);noStroke();ellipse(petalX, petalY, this.size * 0.6, this.size * 0.3);}fill(60, 90, 90);ellipse(0, 0, this.size * 0.3);pop();}
}

Now the flowers grow taller when you move your mouse near them! The map() function is crucial here—it takes a value from one range (distance from 0 to 100 pixels) and converts it to another range (stem length multiplier from 1.5 to 1).

Let’s take this further and create something more abstract and mesmerizing. How about a flowing particle system that creates organic, living patterns?

let particles = [];
let flowField = [];function setup() {createCanvas(800, 600);colorMode(HSB, 360, 100, 100, 1);// Create flow fieldlet cols = 20;let rows = 15;let fieldWidth = width / cols;let fieldHeight = height / rows;for (let x = 0; x < cols; x++) {flowField[x] = [];for (let y = 0; y < rows; y++) {let angle = noise(x * 0.1, y * 0.1, 0) * TWO_PI * 2;flowField[x][y] = angle;}}// Create particlesfor (let i = 0; i < 100; i++) {particles.push(new Particle(random(width), random(height)));}
}function draw() {background(0, 0, 0, 0.1);// Update flow fieldlet cols = 20;let rows = 15;for (let x = 0; x < cols; x++) {for (let y = 0; y < rows; y++) {let angle = noise(x * 0.1, y * 0.1, frameCount * 0.01) * TWO_PI * 2;flowField[x][y] = angle;}}// Update and display particlesfor (let particle of particles) {particle.follow(flowField);particle.update();particle.display();}
}class Particle {constructor(x, y) {this.pos = createVector(x, y);this.vel = createVector(0, 0);this.acc = createVector(0, 0);this.maxSpeed = 2;this.hue = random(360);this.life = 255;}follow(field) {let x = floor(this.pos.x / (width / 20));let y = floor(this.pos.y / (height / 15));x = constrain(x, 0, 19);y = constrain(y, 0, 14);let angle = field[x][y];let force = p5.Vector.fromAngle(angle);force.setMag(0.1);this.acc.add(force);}update() {this.vel.add(this.acc);this.vel.limit(this.maxSpeed);this.pos.add(this.vel);this.acc.mult(0);// Wrap around edgesif (this.pos.x > width) this.pos.x = 0;if (this.pos.x < 0) this.pos.x = width;if (this.pos.y > height) this.pos.y = 0;if (this.pos.y < 0) this.pos.y = height;// Gradually fadethis.life -= 0.5;if (this.life <= 0) {this.pos = createVector(random(width), random(height));this.life = 255;this.hue = (this.hue + 30) % 360;}}display() {stroke(this.hue, 80, 90, this.life / 255);strokeWeight(2);point(this.pos.x, this.pos.y);}
}

This creates a mesmerizing flow field where particles follow invisible currents that change over time. The noise() function creates smooth, organic randomness that feels natural and flowing. Each particle leaves a trail as it moves, creating beautiful, ever-changing patterns.

But let’s make it even more interactive. What if you could paint with these particles, creating your own flow field with your mouse?

let particles = [];
let flowField = [];
let painting = false;function setup() {createCanvas(800, 600);colorMode(HSB, 360, 100, 100, 1);// Initialize flow fieldlet cols = 40;let rows = 30;for (let x = 0; x < cols; x++) {flowField[x] = [];for (let y = 0; y < rows; y++) {flowField[x][y] = 0;}}for (let i = 0; i < 200; i++) {particles.push(new Particle(random(width), random(height)));}
}function draw() {background(0, 0, 0, 0.1);// Paint with mouseif (painting) {let cols = 40;let rows = 30;let x = floor(mouseX / (width / cols));let y = floor(mouseY / (height / rows));x = constrain(x, 0, cols - 1);y = constrain(y, 0, rows - 1);// Create a circular brushfor (let i = -2; i <= 2; i++) {for (let j = -2; j <= 2; j++) {let nx = x + i;let ny = y + j;if (nx >= 0 && nx < cols && ny >= 0 && ny < rows) {let angle = atan2(mouseY - pmouseY, mouseX - pmouseX);flowField[nx][ny] = angle;}}}}for (let particle of particles) {particle.follow(flowField);particle.update();particle.display();}
}function mousePressed() {painting = true;
}function mouseReleased() {painting = false;
}class Particle {constructor(x, y) {this.pos = createVector(x, y);this.vel = createVector(0, 0);this.acc = createVector(0, 0);this.maxSpeed = 3;this.hue = random(360);this.life = 255;}follow(field) {let cols = 40;let rows = 30;let x = floor(this.pos.x / (width / cols));let y = floor(this.pos.y / (height / rows));x = constrain(x, 0, cols - 1);y = constrain(y, 0, rows - 1);let angle = field[x][y];let force = p5.Vector.fromAngle(angle);force.setMag(0.2);this.acc.add(force);}update() {this.vel.add(this.acc);this.vel.limit(this.maxSpeed);this.pos.add(this.vel);this.acc.mult(0);if (this.pos.x > width) this.pos.x = 0;if (this.pos.x < 0) this.pos.x = width;if (this.pos.y > height) this.pos.y = 0;if (this.pos.y < 0) this.pos.y = height;this.life -= 1;if (this.life <= 0) {this.pos = createVector(random(width), random(height));this.life = 255;this.hue = (this.hue + 45) % 360;}}display() {stroke(this.hue, 90, 90, this.life / 255);strokeWeight(3);point(this.pos.x, this.pos.y);}
}

Now you can paint with particles! Click and drag to create flow currents that the particles will follow. It’s like digital finger painting with living, breathing particles.

Let’s create something completely different—a generative landscape that grows and evolves like a living organism. This will use cellular automata principles to create organic, natural-looking patterns.

let landscape = [];
let cols, rows;
let cellSize = 10;function setup() {createCanvas(800, 600);colorMode(HSB, 360, 100, 100, 1);cols = width / cellSize;rows = height / cellSize;// Initialize landscape randomlyfor (let x = 0; x < cols; x++) {landscape[x] = [];for (let y = 0; y < rows; y++) {landscape[x][y] = random(1);}}
}function draw() {background(200, 30, 95);// Update landscapelet newLandscape = [];for (let x = 0; x < cols; x++) {newLandscape[x] = [];for (let y = 0; y < rows; y++) {let neighbors = countNeighbors(x, y);let current = landscape[x][y];// Conway's Game of Life rules with variationif (current > 0.5) {if (neighbors < 2 || neighbors > 3) {newLandscape[x][y] = max(0, current - 0.1);} else {newLandscape[x][y] = min(1, current + 0.05);}} else {if (neighbors === 3) {newLandscape[x][y] = min(1, current + 0.2);} else {newLandscape[x][y] = max(0, current - 0.02);}}}}landscape = newLandscape;// Draw landscapefor (let x = 0; x < cols; x++) {for (let y = 0; y < rows; y++) {let value = landscape[x][y];let hue = map(value, 0, 1, 120, 200); // Green to bluelet brightness = map(value, 0, 1, 30, 90);fill(hue, 80, brightness);noStroke();rect(x * cellSize, y * cellSize, cellSize, cellSize);}}// Add some organic growthif (random() < 0.1) {let x = floor(random(cols));let y = floor(random(rows));landscape[x][y] = min(1, landscape[x][y] + 0.3);}
}function countNeighbors(x, y) {let sum = 0;for (let i = -1; i < 2; i++) {for (let j = -1; j < 2; j++) {let nx = (x + i + cols) % cols;let ny = (y + j + rows) % rows;if (landscape[nx][ny] > 0.5) sum++;}}if (landscape[x][y] > 0.5) sum--;return sum;
}function mousePressed() {// Add life where you clicklet x = floor(mouseX / cellSize);let y = floor(mouseY / cellSize);if (x >= 0 && x < cols && y >= 0 && y < rows) {landscape[x][y] = 1;}
}

This creates a living landscape that grows, dies, and evolves according to simple rules. Click anywhere to add life, and watch as patterns emerge and change over time. It’s like watching a digital ecosystem grow and evolve.

Now let’s create something truly spectacular—a generative music visualizer that responds to sound. We’ll create a system that generates visual patterns based on frequency analysis, even without real audio input.

let particles = [];
let frequencies = [];
let time = 0;function setup() {createCanvas(800, 600);colorMode(HSB, 360, 100, 100, 1);// Initialize frequency data (simulated)for (let i = 0; i < 64; i++) {frequencies[i] = 0;}// Create particle systemfor (let i = 0; i < 100; i++) {particles.push(new AudioParticle());}
}function draw() {background(0, 0, 0, 0.1);// Generate simulated frequency datafor (let i = 0; i < frequencies.length; i++) {let baseFreq = sin(time + i * 0.1) * 0.5 + 0.5;let mouseInfluence = map(dist(mouseX, mouseY, i * 10, height/2), 0, 200, 1, 0);frequencies[i] = baseFreq * mouseInfluence;}// Draw frequency barslet barWidth = width / frequencies.length;for (let i = 0; i < frequencies.length; i++) {let barHeight = frequencies[i] * height * 0.8;let hue = map(i, 0, frequencies.length, 0, 360);fill(hue, 80, 90, 0.6);noStroke();rect(i * barWidth, height - barHeight, barWidth - 1, barHeight);// Add glow effectdrawingContext.shadowBlur = 20;drawingContext.shadowColor = color(hue, 80, 90);rect(i * barWidth, height - barHeight, barWidth - 1, barHeight);drawingContext.shadowBlur = 0;}// Update and display particlesfor (let particle of particles) {particle.update(frequencies);particle.display();}time += 0.05;
}class AudioParticle {constructor() {this.pos = createVector(random(width), random(height));this.vel = createVector(0, 0);this.size = random(2, 8);this.hue = random(360);}update(freqs) {// Respond to frequency datalet freqIndex = floor(map(this.pos.x, 0, width, 0, freqs.length));freqIndex = constrain(freqIndex, 0, freqs.length - 1);let amplitude = freqs[freqIndex];this.vel.y = -amplitude * 5;this.pos.add(this.vel);this.vel.mult(0.95); // Damping// Wrap aroundif (this.pos.y < 0) this.pos.y = height;if (this.pos.x < 0) this.pos.x = width;if (this.pos.x > width) this.pos.x = 0;// Change color based on frequencythis.hue = (this.hue + amplitude * 10) % 360;}display() {fill(this.hue, 90, 90, 0.8);noStroke();ellipse(this.pos.x, this.pos.y, this.size, this.size);// Add trailfor (let i = 1; i < 5; i++) {let alpha = map(i, 1, 5, 0.8, 0);fill(this.hue, 90, 90, alpha);ellipse(this.pos.x - this.vel.x * i * 0.1, this.pos.y - this.vel.y * i * 0.1, this.size * 0.5, this.size * 0.5);}}
}

This creates a stunning audio visualizer that responds to your mouse position. The frequency bars represent different audio frequencies, and the particles float upward based on the intensity of each frequency. Move your mouse around to create different “sound” patterns.

The beauty of generative art is that you can combine these techniques in infinite ways. Want to create a galaxy that responds to music? Or a forest that grows based on your mouse movements? The possibilities are endless.

Here’s one more example that combines everything we’ve learned—a generative mandala that grows and evolves:

let mandala = [];
let angle = 0;
let growth = 0;function setup() {createCanvas(800, 600);colorMode(HSB, 360, 100, 100, 1);background(0);
}function draw() {translate(width/2, height/2);// Create rotating mandalafor (let i = 0; i < 12; i++) {push();rotate(angle + i * TWO_PI / 12);// Draw petalsfor (let j = 0; j < 8; j++) {let petalAngle = j * TWO_PI / 8;let x = cos(petalAngle) * (100 + growth);let y = sin(petalAngle) * (100 + growth);let hue = (angle * 10 + i * 30 + j * 45) % 360;fill(hue, 80, 90, 0.6);noStroke();push();translate(x, y);rotate(petalAngle);ellipse(0, 0, 30 + growth * 0.2, 60 + growth * 0.3);pop();}// Draw connecting linesstroke(angle * 5 % 360, 70, 80, 0.3);strokeWeight(2);for (let j = 0; j < 8; j++) {let angle1 = j * TWO_PI / 8;let angle2 = (j + 1) * TWO_PI / 8;let x1 = cos(angle1) * (100 + growth);let y1 = sin(angle1) * (100 + growth);let x2 = cos(angle2) * (100 + growth);let y2 = sin(angle2) * (100 + growth);line(x1, y1, x2, y2);}pop();}// Add floating particlesfor (let i = 0; i < 5; i++) {let particleAngle = angle * 0.5 + i * TWO_PI / 5;let particleRadius = 150 + sin(angle + i) * 50;let x = cos(particleAngle) * particleRadius;let y = sin(particleAngle) * particleRadius;fill((angle * 20 + i * 72) % 360, 90, 90, 0.8);noStroke();ellipse(x, y, 8, 8);}angle += 0.02;growth += 0.1;// Reset growth periodicallyif (growth > 100) {growth = 0;}
}function mousePressed() {// Add explosion effectfor (let i = 0; i < 20; i++) {let angle = random(TWO_PI);let radius = random(50, 200);let x = cos(angle) * radius;let y = sin(angle) * radius;fill(random(360), 90, 90, 0.8);noStroke();ellipse(x, y, random(5, 15), random(5, 15));}
}

This creates a living mandala that continuously grows, rotates, and evolves. Click anywhere to add explosion effects. The mandala uses mathematical symmetry to create beautiful, hypnotic patterns that feel both organic and geometric.

The key to creating compelling generative art is to start with simple rules and let complexity emerge naturally. Use mathematical functions like sin(), cos(), and noise() to create organic movement. Experiment with color theory and transparency to create depth and atmosphere. And most importantly, make it interactive—let your audience become part of the artwork.

Remember, generative art isn’t about creating perfect, static images. It’s about creating living systems that surprise and delight you. Sometimes the most beautiful moments come from unexpected interactions between simple rules. So go ahead and experiment—let your code paint, let your algorithms dance, and see what beautiful patterns emerge from the chaos.

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/diannao/97658.shtml
繁體地址,請注明出處:http://hk.pswp.cn/diannao/97658.shtml
英文地址,請注明出處:http://en.pswp.cn/diannao/97658.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

Wi-Fi技術——網絡安全

一、數據幀的安全 1、無線網絡安全的發展 理論上無線電波范圍內的任何一個站點都可以監聽并登錄無線網絡&#xff0c;所有發送或接收的數據&#xff0c;都有可能被截取&#xff0c;因此無線網絡安全十分重要。 原始802.11的安全策略為WEP&#xff0c;其存在根本性的漏洞&#x…

Java提供高效后端支撐,Vue呈現直觀交互界面,共同打造的MES管理系統,含完整可運行源碼,實現生產計劃、執行、追溯一站式管理,提升制造執行效率

前言在當今競爭激烈的制造業環境中&#xff0c;企業面臨著提高生產效率、降低成本、保證產品質量以及快速響應市場變化等多重挑戰。制造執行系統&#xff08;MES&#xff0c;Manufacturing Execution System&#xff09;作為連接企業上層計劃管理系統&#xff08;如ERP&#xf…

【macOS】垃圾箱中文件無法清理的常規方法

【macOS】垃圾箱中文件無法清理的方法如果外接 SSD 移動盤上的垃圾文件無法刪除&#xff0c; 可能是由于文件系統格式不兼容、文件被占用、權限不足等原因導致的&#xff0c; 以下是一些常見的解決方法&#xff1a;檢查移動硬盤文件系統格式&#xff1a;如果移動硬盤是 NTFS 格…

鴻蒙ArkTS 核心篇-15-條件渲染(組件)

目錄 根據邏輯條件結果&#xff0c;渲染不同的 UI 內容 DevEco Studio代碼實戰 預覽效果 總結 根據邏輯條件結果&#xff0c;渲染不同的 UI 內容 DevEco Studio代碼實戰 let num: number 20Entry Component struct Index {build() {Column() {if (num 1) {Text(文本 1)} …

大模型微調顯存內存節約方法

大模型微調時節約顯存和內存是一個至關重要的話題&#xff0c;尤其是在消費級GPU&#xff08;如RTX 3090/4090&#xff09;或資源有限的云實例上。下面我將從顯存&#xff08;GPU Memory&#xff09; 和內存&#xff08;CPU Memory&#xff09; 兩個方面&#xff0c;為你系統地…

Linux筆記12——shell編程基礎-6

字符截取命令一、cut命令功能&#xff1a;用于從文件或標準輸入中提取指定字段或列語法&#xff1a;cut [選項] 文件名-f&#xff1a;列號&#xff0c;提取第幾列&#xff0c;默認識別制表符分割出來的列&#xff08;列號之間用,隔開&#xff09;-d&#xff1a;分隔符&#xff…

高效瀏覽器標簽頁管理:Chrome擴展開發完全指南

Hi&#xff0c;我是前端人類學&#xff08;之前叫布蘭妮甜&#xff09;&#xff01; 在信息過載的時代&#xff0c;瀏覽器標簽頁管理已成為提高工作效率的關鍵技能。本文將介紹如何開發一個功能完整的Chrome擴展&#xff0c;幫助用戶高效管理瀏覽器標簽頁&#xff0c;并探討其實…

從 WPF 到 Avalonia 的遷移系列實戰篇3:ResourceDictionary資源與樣式的差異與遷移技巧

從 WPF 到 Avalonia 的遷移系列實戰篇3:ResourceDictionary資源與樣式的差異與遷移技巧 我的GitHub倉庫Avalonia學習項目包含完整的Avalonia實踐案例與代碼對比。 我的gitcode倉庫是Avalonia學習項目。 文中主要示例代碼均可在倉庫中查看&#xff0c;涵蓋核心功能實現與優化方案…

基于Springboot的音樂媒體播放及周邊產品運營平臺(有報告)。Javaee項目,springboot項目。

演示視頻&#xff1a; 基于Springboot的音樂媒體播放及周邊產品運營平臺&#xff08;有報告&#xff09;。Javaee項目&#xff0c;springboot項目。項目介紹&#xff1a; 采用M&#xff08;model&#xff09;V&#xff08;view&#xff09;C&#xff08;controller&#xff09…

【項目思維】嵌入式產業鏈與技術生態

這篇文章深入解析嵌入式產業鏈與技術生態上下游關系&#xff0c;輔助建立嵌入式工程師職業發展認知。嵌入式行業并不是“寫單片機程序”那么簡單&#xff0c;而是一個 從芯片設計到系統集成再到最終產品落地 的復雜生態鏈。理解上下游價值鏈&#xff0c;有助于你成為系統型工程…

機器學習(講解)

一、引言&#xff1a;什么是監督學習&#xff1f;監督學習&#xff08;Supervised Learning&#xff09;是機器學習中最基礎且應用最廣泛的范式之一。其核心思想是利用已標記的數據&#xff08;即輸入-輸出對&#xff09;訓練模型&#xff0c;使其能夠對新的、未標記的數據進行…

使用 Bright Data Web Scraper API + Python 高效抓取 Glassdoor 數據:從配置到結構化輸出全流程實戰

使用 Bright Data Web Scraper API Python 高效抓取 Glassdoor 數據&#xff1a;從配置到結構化輸出全流程實戰 摘要 本文詳細介紹了如何使用 Bright Data 的 Web Scraper API 搭配 Python&#xff0c;實現對 Glassdoor 平臺信息的高效抓取。通過 API 請求構建器、反爬機制集成…

Burgan Bank Türkiye 如何借助 Elastic 改造可觀測性和安全性

作者&#xff1a;來自 Elastic Jon Ashley, Ido Friedman, Burak Dz Burgan Bank Trkiye Burgan Bank K.P.S.C. 是科威特項目公司 (KIPCO) 集團的子公司&#xff0c;成立于 1977 年&#xff0c;是中東和北非 (MENA) 地區最大的控股集團和重要銀行集團之一。 該銀行作為客戶的解…

LeetCode 165. 比較版本號 - 優雅Java解決方案

文章目錄LeetCode 165. 比較版本號 - 優雅Java解決方案題目描述示例分析示例 1示例 2示例 3算法思路Java實現方案方案一&#xff1a;雙指針法&#xff08;推薦&#xff09;方案二&#xff1a;優化的單次遍歷法可視化執行過程示例&#xff1a;compareVersion("1.2", &…

基于Kubernetes StatefulSet的有狀態微服務部署與持久化存儲實踐經驗分享

基于Kubernetes StatefulSet的有狀態微服務部署與持久化存儲實踐經驗分享 在傳統微服務架構中&#xff0c;大多數服務都是無狀態的&#xff08;Stateless&#xff09;&#xff0c;可以通過 Deployment、ReplicaSet 等控制器實現水平自動擴縮容。但在生產環境中&#xff0c;仍有…

MySQL編程開發

變量系統變量&#xff1a;MySQL內置變量#查看所有系統變量show variables \G;#通過模糊查詢篩選變量show variables like “%path%”;全局變量&#xff1a;在所有終端中都生效&#xff1b;會話變量&#xff1a;在當前會話&#xff08;本次登錄&#xff09;&#xff1b;#可以通過…

20250830_Oracle 19c CDB+PDB(QMS)默認表空間、臨時表空間、歸檔日志、閃回恢復區巡檢手冊

PDB 關業務,CDB 管底層;每天緊盯 PDB,必要時看 CDB。 一、CDB 與 PDB 的關系 Oracle 12c 以后引入 多租戶架構(Multitenant),分成兩類容器: 層級 名稱 作用 存儲內容 典型操作 CDB CDB$ROOT(容器數據庫) 數據庫實例的根容器 Oracle 元數據、系統表字典、公共用戶、PDB…

什么是MIPS架構?RISC-V架構?有什么區別?【超詳細初學者教程】

什么是MIPS架構&#xff1f;RISC-V架構&#xff1f;有什么區別&#xff1f;【超詳細初學者教程】 關鍵詞&#xff1a;MIPS架構&#xff0c;RISC-V架構&#xff0c;精簡指令集RISC&#xff0c;嵌入式系統&#xff0c;CPU架構對比&#xff0c;指令集架構&#xff0c;開源處理器&…

IDEA Spring屬性注解依賴注入的警告 Field injection is not recommended 異常解決方案

一、異常錯誤 在使用 IntelliJ IDEA 進行 Spring 開發時&#xff0c;當使用 Autowired 注解直接在字段上進行依賴注入時&#xff0c;IDE 會顯示黃色警告&#xff1a; Field injection is not recommended這個警告出現在以下代碼模式中&#xff1a; Service public class UserSe…

智能核心:機器人芯片的科技革新與未來挑戰

在人工智能與機器人技術深度融合的今天&#xff0c;機器人芯片作為驅動智能機器的“大腦”&#xff0c;正成為科技競爭的戰略制高點。這一微小卻至關重要的硬件&#xff0c;決定了機器人的計算能力、響應速度與智能水平&#xff0c;是機器人從“自動化”邁向“自主化”的關鍵所…