Dev Perfects
40 subscribers
9.23K photos
1.26K videos
468 files
13K links
بخوام خیلی خلاصه بگم
این کانال میاد مطالب کانالای خفن تو حوزه تکنولوژی و برنامه نویسی رو جمع میکنه

پست پین رو بخونید
https://t.iss.one/dev_perfects/455


ارتباط:
https://t.iss.one/HidenChat_Bot?start=936082426
Download Telegram
Forwarded from Syntax | سینتکس (Daimon)
تست Canary: راز پشت پرده تغییرات گوگل

چند وقت پیش داشتم ایمیل‌هایم را در گوگل چک می‌کردم که یک ویژگی جدید توجه من را جلب کرد؛ دکمه‌ای مخصوص پرسش از هوش مصنوعی درباره‌ی محتوای ایمیل‌ها. فکر کردم این یک تغییر جذاب است و سری به بقیه ایمیل‌هایم زدم تا از این فیچر استفاده کنم. اما جالب بود که این ویژگی فقط در یک ایمیل فعال شده بود! چرا همه کاربران این ویژگی را ندارند؟ مگر این همان گوگل نیست که وقتی چیزی اضافه می‌کند برای همه فعال می‌شود؟

با کمی تحقیق و کنجکاوی، به یک واژه رسیدم:
Canary Test

چرا تست Canary؟
تصور کنید گوگل می‌خواهد ویژگی جدیدی را به سرویس ایمیل خود اضافه کند. اگر این ویژگی به‌درستی کار نکند، ممکن است کل سیستم ایمیل دچار مشکل شود. اما به کمک Canary Test، ابتدا این تغییرات را برای گروه کوچکی از کاربران فعال می‌کنند. اگر همه‌چیز درست کار کرد، این تغییر را برای کاربران بیشتری اجرا می‌کنند؛ و اگر مشکلی رخ داد، به‌سرعت به نسخه قبلی برمی‌گردند، بدون این‌که کسی متوجه شود.

فواید این تست
این تست مثل نگهبانی است که با فداکاری جلوی آسیب‌های بزرگ را می‌گیرد
ریسک کم‌تر: ابتدا در شرایط محدود بررسی می‌شود که ویژگی جدید مشکلی ایجاد نکند.
شناسایی مشکلات: قبل از اینکه همه کاربران با باگ‌ها روبرو شوند، تیم توسعه آن‌ها را شناسایی و رفع می‌کند.
تجربه‌ی کاربری بهتر: بدون اختلال و با اطمینان بالا، کاربران از قابلیت‌های جدید لذت می‌برند.

گوگل، فیس‌بوک و سایر غول‌ها چطور از Canary Test استفاده می‌کنند؟
در این روش، غول‌های فناوری مثل گوگل و فیس‌بوک ابتدا تغییرات را به درصد کوچکی از کاربران عرضه می‌کنند. این کاربران به‌عنوان "قناری‌های" سیستم انتخاب می‌شوند تا در صورت شناسایی خطر، باقی کاربران در امان بمانند. اگر همه‌چیز خوب پیش رفت، تغییرات به همه عرضه می‌شود؛ و اگر نه، به‌راحتی تغییرات را متوقف می‌کنند.

پس اگر روزی دیدید که شما یک قابلیت خاص در یک اپلیکیشن دارید و دوستانتان نه، بدانید شاید شما هم یکی از «قناری‌ها»ی سیستم باشید! 🐤

Source

@Syntax_fa
آیا میدانستید PeachPie
کد PHP را کامپایل میکنه روی .NET runtime اجرا میکنه
چه شود
https://peachpie.io
https://github.com/peachpiecompiler/peachpie
چرا یکی باید بخواد بین .net و php پل بزنه ؟

@DevTwitter | <MehrdadLinux/>
توصیه امروز:

از زندگیت لذت ببر زود دیر میشه رفیق :)

#توصیه

🔆 CHANNEL | GROUP
😂😂😂
این واقعاً حق بود

#meme

@SohrabContents
Forwarded from  (Amir Hossein "Amiria" Maher)
بشین ور دل خودم
Forwarded from  (Amir Hossein "Amiria" Maher)
بشین ور دل خودم
Forwarded from  (Amir Hossein "Amiria" Maher)
امروز چندمه؟
Forwarded from Code Module | کد ماژول (𔓙)
دیگه وقتت رو برای نوشتن کاستوم هوک‌ها هدر نده🩸

پکیج usehooks-ts مجموعه‌ای از هوک‌های آماده و کاربردی برای پروژه‌های ریکتی هست که خوشبختانه با تایپ اسکریپت هم سازگاره. در این مجموعه، هوک های مختلفی برای انواع کارها مانند مدیریت ایونت‌ها، مدیریت لوکال استوریج، مدیریت تایمرها، دسترسی به اطلاعات مرورگر و ... پیدا میشه، که باعث ساده‌تر شدن کدنویسی، سرعت بیشتر و همچنین کاهش نیاز به نوشتن کد تکراری میشه.

🔗 Link

#react
@CodeModule
Forwarded from  (Amir Hossein "Amiria" Maher)
bargheman.com

نوشتن که برید اینجا و شناسهٔ قبضتون رو بنویسید و بفهمید که کِی برق ندارید.

#موقت
Forwarded from 🎄 یک برنامه نویس تنبل (The Lazy 🌱 Raymond)
🔶 ارز تتر به تجارت نفت ورود می‌کند

شرکت تتر، ارائه‌دهنده‌ی بزرگ‌ترین استیبل‌کوین جهان (USDT)، با ورود به عرصه‌ی تجارت نفت، گامی بلند در جهت گسترش فعالیت‌های خود برداشته است. بنابر بیانیه رسمی تتر، این شرکت با تأمین مالی معامله‌ای ۴۵ میلیون‌ دلاری برای خرید ۶۷۰ هزار بشکه نفت خام، از تمایل خود برای ورود جدی به صنعت انرژی پرده‌برداری کرد. این اقدام علاوه‌بر تأثیرگذاری بر بازارهای سنتی انرژی، می‌تواند تحولات چشمگیری را در دنیای ارزهای دیجیتال و فین‌تک به‌همراه داشته باشد.

#خبر

@TheRaymondDev
Forwarded from code2 - تکنولوژی و فناوری (Mahdi Taleghani)
In a Next.js app router project, data can be fetched in multiple places depending on the nature of the data, rendering strategy, and whether the data needs to be accessed at build time, on the server, or on the client. Here’s a breakdown of where to fetch data in Next.js’s app router and when each is appropriate:

### 1. Server Components (default in app directory)
- Where: Fetch data directly within server components, like your page.tsx or other components under the app directory.
- When: Ideal for server-only data, sensitive data, or data that doesn’t need client-side interactivity. Server components can fetch data using async functions and make use of server-only packages (e.g., databases).
- Example:
     import { PrismaClient } from "@prisma/client";

export default async function Page() {
const prisma = new PrismaClient();
const data = await prisma.someModel.findMany();

return (
<div>
{/* Render data */}
</div>
);
}

- Considerations: Server components do not increase the JavaScript sent to the client. However, since they are server-rendered, you may need additional client-side components if you want interactivity.

### 2. Client Components (use use client directive)
- Where: If you need client-side interactivity, mark the component with use client at the top and use data-fetching hooks like useEffect.
- When: Useful for data that requires client-side interactivity, like managing local state, dynamic data fetching (especially based on user interactions), or when using APIs that are only available on the client.
- Example:
     "use client";
import { useState, useEffect } from 'react';

export default function ClientComponent() {
const [data, setData] = useState(null);

useEffect(() => {
async function fetchData() {
const response = await fetch('/api/data');
const result = await response.json();
setData(result);
}
fetchData();
}, []);

return <div>{data ? JSON.stringify(data) : 'Loading...'}</div>;
}

- Considerations: Client components increase the JavaScript bundle size sent to the client, so they should be used when necessary.

### 3. API Routes
- Where: Use pages/api to create backend API endpoints, which can be called from both server and client components.
- When: Use API routes when you want to keep logic (like authentication, session checks, or data manipulation) separate from the component. This is especially useful for POST requests, sensitive data handling, or operations that don’t need to be part of the server-rendering flow.
- Example:
     // pages/api/data.ts
import { NextApiRequest, NextApiResponse } from 'next';
import { PrismaClient } from '@prisma/client';

export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const prisma = new PrismaClient();
const data = await prisma.someModel.findMany();
res.status(200).json(data);
}

- Considerations: API routes offer more flexibility and can be used by both server and client components, which is useful for actions like form submissions or fetching data on demand.
Forwarded from code2 - تکنولوژی و فناوری (Mahdi Taleghani)
### 4. Middleware (for authentication and access control)
- Where: Use a middleware.ts file in the root directory.
- When: Middleware is useful for route-based logic, like authentication or role-based access control, without directly fetching data for rendering. Middleware runs on the edge and can redirect users based on conditions.
- Example:
     // middleware.ts
import { NextResponse } from 'next/server';

export async function middleware(request) {
const isAuthenticated = checkAuth(request); // Define your own check
if (!isAuthenticated) return NextResponse.redirect(new URL('/login', request.url));
return NextResponse.next();
}

export const config = {
matcher: '/protected/:path*', // Apply to specific routes
};

- Considerations: Middleware is limited in functionality compared to traditional API routes but is highly efficient for edge-based logic.

### 5. Static Fetching (using generateStaticParams for Static Site Generation)
- Where: If the data doesn’t change often and you don’t need real-time updates, use static generation with generateStaticParams or getStaticProps in the app directory.
- When: For data that doesn’t change frequently (e.g., blog posts, product pages) or when optimizing for SEO by generating pages at build time.
- Example:
     import { PrismaClient } from '@prisma/client';

export async function generateStaticParams() {
const prisma = new PrismaClient();
const items = await prisma.someModel.findMany();
return items.map(item => ({ id: item.id }));
}


### Summary
- Use Server Components by default for data fetching when rendering on the server.
- Use Client Components for client-side interactions or dynamic data that changes after initial render.
- Use API Routes for encapsulating backend logic or for requests initiated on the client-side.
- Use Middleware for lightweight route protection or conditionally redirecting users.
- Use Static Fetching for rarely changing content that benefits from static generation (like blog posts).

Each strategy is flexible, and you can mix these approaches depending on the needs of each part of your app.
Forwarded from 🎄 یک برنامه نویس تنبل (The Lazy 🌱 Raymond)
This media is not supported in your browser
VIEW IN TELEGRAM
Forwarded from Linuxor ?
توی برنامه نویسی اگه فکر کردین چیزی رو کامل و بدون اشکال ساختین و دیگه نیازی به تغییر نداره، بدونین مسیر رو اشتباه اومدین.



🐧 @Linuxor
Forwarded from 🎄 یک برنامه نویس تنبل (The Lazy 🌱 Raymond)
۱۰۰۰ تایی شدیم 🎉🥂🥳

از حمایت هاتون مچکرم و همگی‌تون خیلی خوش آومدید 🥂🍾

@TheRaymondDev
Forwarded from 🎄 یک برنامه نویس تنبل (The Lazy 🌱 Raymond)
🔶 از فردا برای قطعی برق آماده باشید.

سعی کنید دستگاه هایی با آن کار نمی کنید از پریز برف بیرون بکشید که با قطعی برق دچار خرابی نشود.

موقعی که برق دارید, پاوربانک و گوشی کامل شارژ کنید.

@TheRaymondDev
‼️مسیری هموار برای کار بین‌المللی و مهاجرت شغلی
 از طریق WINaTALENT

امکان اپلای برای بیش از ۳۲۰ پوزیشن در بیش از ۲۰ کشور اروپایی
داشتن ریفرر اختصاصی

۶۰٪ شانس بیشتر برای تایید اپلای

با سرویس Refriend می‌تونی برای شغل‌هایی با ویزا اسپانسرشیپ اپلای کنی. 
با کد تخفیف، ثبت‌نام کن و مسیر مهاجرت شغلیت رو شروع کن. 
تعداد محدود

👤💼 کد تخفیف، در کانال WINaTALENT!
@winatalent_fa
@winatalent_fa
@winatalent_fa