This media is not supported in your browser
VIEW IN TELEGRAM
دقیقا ۳ سال و ۶ ماه پیش، داستان از اینجا شروع شد...
😁8❤🔥1
این ویدیو جادی خیلی جالب بود و یک ایده مسخره دیگه بهم داد ولی از اونجایی که مریض شدم حال ندارم انجامش بدم👍
https://youtu.be/yDU-0cN43eQ?si=gheWzBh5SEO1T5o0
@TorhamDevCH
https://youtu.be/yDU-0cN43eQ?si=gheWzBh5SEO1T5o0
@TorhamDevCH
YouTube
Writing and explaining "Image to Dice Pattern convertor"
Have you ever seen those portraits created by 1000s of dices and wondered HOW? In this session, we'll write a python noscript to generate the dice pattern based on an input image. We will see how a programmer thinks and will become familiar with the Pillow…
☃2
TorhamDev | تورهام 😳
حقیقتا میخواستم ریاضی گسسته بخونم برای امتحان. اما دیدم ۱ حجمش زیاده و من الکی وقت میزارم کل روز یکی از مباحثش یادبگیرم که شاید کلا ۱ سوال ازش بیاد. در نتیجه باخودم گفتم که من که همه واحدها رو افتادم. اینم روش :) به جاش چیکار میکنیم؟ میریم یک دوره asyncio…
۱۰ شدم ( ۱۰ داده در حقیقت)
so it wasn't a bad choice LOL
so it wasn't a bad choice LOL
🥴6🤷♀2🍾2⚡1
خب، یک چیز جالب که فهمیدم(قبلش نمیدونستم 🗿) رو این آقاعه که چشماش بسته است گفت.
بزارید از این ماجرا شروع کنم، تا حالا برای شما پیش اومده که بخوایید یک tuple رو این شکلی بنویسید ولی کار نکنه؟
و این اتفاق برای این میوفته که پایتون tuple هارو با ویرگول(،) میشناسه نه با پرانتز (این تیکه رو نمیدونستم)
در نتیجه پرانتز صرفا برای شفاف سازی حضور tuple هستش :)
و خوب دلیلش هم اینه که بعد با پرانتز میتونید اولويت هایی مثل opration ها ریاضی ضرب و تقسیم و .. با پرانتز مدریت کنید.
در نتیجه کد زیر هم درست کار میکنه.
@TorhamDevCH
بزارید از این ماجرا شروع کنم، تا حالا برای شما پیش اومده که بخوایید یک tuple رو این شکلی بنویسید ولی کار نکنه؟
a = (1)اتفاقی که میوفته اینه ک a مساوی با integer یک میشه نه tupleای که داخلش یک هست.
و این اتفاق برای این میوفته که پایتون tuple هارو با ویرگول(،) میشناسه نه با پرانتز (این تیکه رو نمیدونستم)
در نتیجه پرانتز صرفا برای شفاف سازی حضور tuple هستش :)
و خوب دلیلش هم اینه که بعد با پرانتز میتونید اولويت هایی مثل opration ها ریاضی ضرب و تقسیم و .. با پرانتز مدریت کنید.
در نتیجه کد زیر هم درست کار میکنه.
a = 1,و این یک tuple میده. نکته خفن تر ماجرا داخل unpacking کرد عه :)) که اون یک ماجرا جداست اگه این پست ۲۰ تا ریکشن 😱 بگیره اون هم مینویسم 😂
print(a)
@TorhamDevCH
😱34👍6🍾2👎1🌚1👻1😨1
TorhamDev | تورهام 😳
خب، یک چیز جالب که فهمیدم(قبلش نمیدونستم 🗿) رو این آقاعه که چشماش بسته است گفت. بزارید از این ماجرا شروع کنم، تا حالا برای شما پیش اومده که بخوایید یک tuple رو این شکلی بنویسید ولی کار نکنه؟ a = (1) اتفاقی که میوفته اینه ک a مساوی با integer یک میشه نه tupleای…
در پایتون شما هر iterator ای رو میتونید Unpack کنید. اما iterator چیه؟ و Unpacking یعنی چی؟
ساده بخام بگم هر آبجکتی که بشه رو حرکت کرد و دیتا گرفت iterator عه مثل لیست، دیکشنری، تاپل و ...
بهتر بخام بگم هر آبجکتی که متد
خب حالا unpacking کردن چیه؟ آنپک کردن یجورایی Map کردن محصوب میشه مثال زیر رو ببینید:
حالا که اینو میدونید بزاید نظر شمارو به چیز دیگه ای جلب کنم :)
مثال پایین رو ببینید:
نکته باحال و هیجان انگیز اینه که پایتون در اصل ورودی های فانشکن unpack میکنه و map میکنه به ورودی ها فانشکن :))) و یکی از دلایلی که نمیتونید بعد یک ورودی a=3 داخل فانشکن ورودی عادی بدون مقدار پاس بدید. چون دیگه نمیتونه unpack و map کنه :)
اگه چیز بیشتری در این باره میدونید تو کامنتها بگید🤝
این پست اگه 20 تا 🤯 بگیره پست بعدی میزارم😂(باج گیری)
@TorhamDevCH
ساده بخام بگم هر آبجکتی که بشه رو حرکت کرد و دیتا گرفت iterator عه مثل لیست، دیکشنری، تاپل و ...
بهتر بخام بگم هر آبجکتی که متد
iter و اگه اشتباه نکنم next رو داره.خب حالا unpacking کردن چیه؟ آنپک کردن یجورایی Map کردن محصوب میشه مثال زیر رو ببینید:
a, b, c = 1, 2, 3خب از پست قبلی میدونیم که پایتون با ویرگول(،) میاد tuple میسازه پس سمت راستِ مساو، یک tuple. حالا پایتون میاد این tuple رو آنپک میکنه و به متغییرها اون ورودی Map میکنه. دونه دونه و به ترتیب در نتیجه a میشه 1 و b میشه 2 و c میشه 3
حالا که اینو میدونید بزاید نظر شمارو به چیز دیگه ای جلب کنم :)
مثال پایین رو ببینید:
def test(*args):خروجی این کد چی میشه؟ اگه این کد اجرا کنیم خروجی مثل زیر باید بگیریم
print(args)
test(1, 2, 3)
(1, 2, 3)که آرهههه یک tuple عه :)))))
نکته باحال و هیجان انگیز اینه که پایتون در اصل ورودی های فانشکن unpack میکنه و map میکنه به ورودی ها فانشکن :))) و یکی از دلایلی که نمیتونید بعد یک ورودی a=3 داخل فانشکن ورودی عادی بدون مقدار پاس بدید. چون دیگه نمیتونه unpack و map کنه :)
اگه چیز بیشتری در این باره میدونید تو کامنتها بگید🤝
این پست اگه 20 تا 🤯 بگیره پست بعدی میزارم😂(باج گیری)
@TorhamDevCH
🤯31😁5👍1🌚1
Forwarded from جادی | Jadi
آی بی ام این امکان رو برای عموم فراهم کرده که با سیستم
IBM i
کار کنن. اگر دوست دارین توی این سایت اکانت باز کنین و درک وسیعتری از سیستم عامل ها پیدا کنین؛ به هرحال کار کردن روی پاور سیستم و امکان نوشتن سی و فرترن روش جالبه (:
https://pub400.com/
IBM i
کار کنن. اگر دوست دارین توی این سایت اکانت باز کنین و درک وسیعتری از سیستم عامل ها پیدا کنین؛ به هرحال کار کردن روی پاور سیستم و امکان نوشتن سی و فرترن روش جالبه (:
https://pub400.com/
Pub400
PUB400.COM - Your public IBM i server
Welcome to PUB400.COM -
Your public IBM i 7.5 server - A free and public Server running IBM i 7.5 for everyone
Your public IBM i 7.5 server - A free and public Server running IBM i 7.5 for everyone
🔥2👎1
TorhamDev | تورهام 😳
من ne بودم ولی تو eq میخواستی 😔💔
ماجرا این هم برمیگرده به دوتا فانشکن پایتون که ne و eq هستن که میتونید توضیح فانکشن eq تو این پست:
چطوری آبجکتی خلق کنیم که با همه چیز برابر باشه؟
و فانکشن en دقیقا برعکس eq عه. eq مخفف equal عه و زمانی ران میشه که از == در پایتون استفاده میکنیم و ne مخفف not equal که وقتی از != استفاده میکنیم اجرا میشه.
@TorhamDevCH
چطوری آبجکتی خلق کنیم که با همه چیز برابر باشه؟
و فانکشن en دقیقا برعکس eq عه. eq مخفف equal عه و زمانی ران میشه که از == در پایتون استفاده میکنیم و ne مخفف not equal که وقتی از != استفاده میکنیم اجرا میشه.
@TorhamDevCH
Telegram
TorhamDev | تورهام
چطوری در پایتون آبجکتی خلق کنیم که با همه چیز مساوی باشه؟!
قبل اینکه شروع کنیم بزارید برگردیم به اصل همه چیز یک آبجکت است در پایتون. طبق این اصل هر چیزی در پایتون یک آجکت در نتیجه تعداد متفاوتی متد داره. برای مثال وقتی شما جلو یک چیز در پایتون پرانتز باز…
قبل اینکه شروع کنیم بزارید برگردیم به اصل همه چیز یک آبجکت است در پایتون. طبق این اصل هر چیزی در پایتون یک آجکت در نتیجه تعداد متفاوتی متد داره. برای مثال وقتی شما جلو یک چیز در پایتون پرانتز باز…
بچهها بچهها با نمره ۱۲.۲۹ مشروط نشدم😂🤝 فقط با ۲۹ آخرش و در کل هم ۳ تا امتحان
BROOO😂
BROOO😂
👍6👎1🔥1🍾1
Forwarded from Oh My Task! (Shahriar Shariati)
Gunicorn with Uvicorn inside
I'm up to reading the Gunicorn and Uvicorn source code and playing with the parameters to see the actual process/thread/coroutine management of those. I will write a detailed blog post about it soon but so far I wanna explain to you why it's recommended to use the Gunicorn web server with Uvicorn worker class.
The Gunicorn provides powerful worker management with lots of customizations. Gunicorn manages workers, and workers manage Python web applications. There are two types of workers which are sync and async. The term "async" here is a bit different than the async functions in Python. It's about the way worker serves the requests.
There are a couple of default worker classes in Gunicorn such as
Here is the moment that Uvicorn comes. Although the Uvicorn is a standalone web server that runs ASGI applications in Python, but it does not have the abilities of Gunicorn. The great thing that developers of Uvicorn have done is that they developed a Uvicorn worker class based on the basic Gunicorn worker class. So you can easily run the Gunicorn to manage Uvicorn workers, and use this worker to serve incoming requests with async web applications.
To do that you can simply run this command:
This command will spawn 4 Uvicorn workers and loads the ASGI application into them. So you have the performance of Gunicorn and Uvicorn together.
You might ask if we should avoid running our apps only with Uvicorn? The answer is not the same for different situations. Sometimes you wanna keep the running process of a web application flat and simple to put it as a single processing unit into Kubernetes pods or Docker containers for better management and debugging. So you should see your structure first.
@OhMyTask
I'm up to reading the Gunicorn and Uvicorn source code and playing with the parameters to see the actual process/thread/coroutine management of those. I will write a detailed blog post about it soon but so far I wanna explain to you why it's recommended to use the Gunicorn web server with Uvicorn worker class.
The Gunicorn provides powerful worker management with lots of customizations. Gunicorn manages workers, and workers manage Python web applications. There are two types of workers which are sync and async. The term "async" here is a bit different than the async functions in Python. It's about the way worker serves the requests.
There are a couple of default worker classes in Gunicorn such as
sync, eventlet, gevent, torando and gthread. There are differences between request and web application handling in these workers that I will explore in the upcoming blog post. However, none of them can run the async functions in Python. So you will lose the power of this handy process manager for just being in async code style.Here is the moment that Uvicorn comes. Although the Uvicorn is a standalone web server that runs ASGI applications in Python, but it does not have the abilities of Gunicorn. The great thing that developers of Uvicorn have done is that they developed a Uvicorn worker class based on the basic Gunicorn worker class. So you can easily run the Gunicorn to manage Uvicorn workers, and use this worker to serve incoming requests with async web applications.
To do that you can simply run this command:
gunicorn example:app -w 4 -k uvicorn.workers.UvicornWorker
This command will spawn 4 Uvicorn workers and loads the ASGI application into them. So you have the performance of Gunicorn and Uvicorn together.
You might ask if we should avoid running our apps only with Uvicorn? The answer is not the same for different situations. Sometimes you wanna keep the running process of a web application flat and simple to put it as a single processing unit into Kubernetes pods or Docker containers for better management and debugging. So you should see your structure first.
@OhMyTask
Talent is cheaper than table salt. What separates the talented individual from the successful one is a lot of hard work.
- Stephen King
👍3
محتواهایی که برای آموزش میبینی/میخوانی/میشنوی(میچشی؟🗿) فارسی با انگلیسی؟
Anonymous Poll
28%
فارسی
72%
انگلیسی