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
آیا میدانستید 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
Forwarded from Gopher Academy
🥂امروز 10 november هست روزی که گولنگ به دنیا اومد🎂


🍻زادروزت خجسته باد

❤️Go
🔹High-level programming language

🫡Go is a statically typed, compiled high-level programming language designed at Google by Robert Griesemer, Rob Pike, and Ken Thompson. It is syntactically similar to C, but also has memory safety, garbage collection, structural typing, and CSP-style concurrency. Wikipedia

🔻Designed by: Robert Griesemer, Rob Pike, Ken Thompson

🔻First appeared: November 10, 2009; 14 years ago

🔻Implementation language: Go, Assembly language (gc); C++ (gofrontend)

🔻License: 3-clause BSD + patent grant

🔻Memory management: Garbage collection

🔻OS: DragonFly BSD, FreeBSD, Linux, macOS, NetBSD, OpenBSD, Plan 9, Solaris, Windows

🔻Paradigm: Multi-paradigm: concurrent imperative, functional object-oriented


👑 @gopher_academy