Clean Code

Clean functions are the first line of organization in any program.

Image for post
Image for post
image from pexels

Hello coders, today I will teach you something that will help you and your colleagues. This article is the second of a two part series, you can find the first part here. Let’s jump in and learn how to code clean functions! Here are my tips:

Keep it Small

The first rule of the function is that they should be small. How small they should be? There is no hard and fast number for this. But as Uncle Bob suggests it should hardly ever be 20 lines long.

Do One Thing

Functions should do one thing and They should do it well. A function should perform just one responsibility. How can we understand if the function is performing more than one responsibility? If the function is doing the steps that are just one step below the stated name of the function then the function is doing one thing. …

Best practices for naming variables, functions, classes, and more

Image for post
Image for post
Photo by Florian Olivo on Unsplash

Welcome to the first part of the clean code series. This series will be highly inspired by and sometimes embarrassingly copied from the Clean Code book by Robert C. Martin (Uncle Bob). I highly recommend reading the book. This series is nowhere near to the original book.

The book has a lot of code examples, and most of them are provided in Java. I will not go through all the code examples, but if I do use some, I will translate or make examples using Python.

What Is Clean Code?

Clean code should have:

  • Full test coverage
  • Complete error handling
  • No duplications
  • High expressiveness
  • A minimal number of entities such as class, function, methods, and…

Do faster training with less RAM in Colab

Image for post
Image for post
Photo by Franki Chamaki on Unsplash.

In the current era of deep learning, data is the biggest problem. If the data size is small, then it’s obviously a big problem for training a deep neural network. Even if the data size is huge, it’s still a big problem for people who don’t have enough resources.

The problem that comes with a huge amount of data is that there are not enough resources to load the data into memory. Most of us train our models in Colab, which initially only gives us 12 GB of memory (sometimes 25/35 GB). …

Image for post
Image for post
Photo by Debby Hudson on Unsplash

Don’t be fooled by the title. I am preparing for mathematics from Class 1. It was a clickbait and you fall for it 🤣. So don’t go away. Just follow along, maybe you will find something useful.

If you are here to hear that 170 out of 170 in GRE Quant is easy, it’s not. Sorry to disappoint you. But there is another catch — how much difficult it is, totally depends on your previous foundation. For me, as I am a student of Computer Science and had some mathematical sense from my 5+ years of competitive programming, it was not that much hard (Show off 🤣). …

Productivity tools to boost your day to day life

Image for post
Image for post

We use different productive tools in our day to day life. As a full-time software engineer, part-time researcher, tiny-time tech entrepreneur, I mostly spend my daily life coding/typing on my MacBook or taking notes on my notepad. So when it comes to be productive, I am totally dependent on the apps I use on my laptop or mobile. I have done a lot of researches before resulting in the next few apps -

1. Notion

When it comes to productivity, hands down, Notion is the best app you can use. It is so versatile, that it can be used for anything. From your daily to-do list app, to your class note-taking app. How do you use it, why do you use it, when do you use it, it’s totally up to you. The app has a high learning curve than other apps. But on the contrary, it’s offering more options than the others and every bit of time you give behind it will be worth it. I mostly use it as my daily-note taking app, for planning long term tasks, for a checklist of next events. …

Definitive Guide

Step by step guide to integrate Facebook login on React & Node.js

Image for post
Image for post

Yes, there are a lot of posts regarding Facebook login with passport.js. But, I didn’t find anything where the frontend and backend are on different servers, like React as frontend, and Node.js as Backend. That costs me a lot of time. Hopefully, this post will save you some time.

In this article we’ll use:

  • React as Frontend (you can use anything)
  • Node.js as Backend (express)
  • Passport.js as Facebook Login strategy

The full source code is available here.

Configure the Backend

Run yarn init -y to initialize package.json. Then, install express, passport, and passport-facebook by running this command:

yarn add express express-session passport passport-facebook

Install other utilities with:

yarn add cookie-parser…

Image for post
Image for post

আমরা অনেকেই এখন মেশিন লার্নিং অথবা ডিপ লার্নিং নিয়ে কাজ করি। কিন্তু আমরা সচরাচর যে প্রবলেমে পড়ি সেটা হল আমাদের পিসি নিয়ে। আমরা খুব হাই কনফিগারড পিসি ব্যবহার করি না যে আমরা চাইলেই আমাদের মডেল রান করতে পারব। তো Google আমাদের জন্য খুব সুন্দর একটা ব্যবস্থা করে দিয়েছে। আমরা চাইলেই আমাদের মডেল গুগলে রান করতে পারি। এই জন্য আমাদের পর্যায়ক্রমে নিচের স্টেপ গুলা ফলো করতে হবে।

১। গুগলে একাউন্ট ওপেন করতে হবে

প্রথমত আমাদের গুগলে একটা একাউন্ট ওপেন করতে হবে। গুগল প্রতি নতুন একাউন্ট এর সাথে আমাদেরকে ৩০০ ডলার ফ্রি দেই। কিন্তু এখানে প্রবলেম হলে আমাদের একাউন্ট টা একটিভেট করার জন্য একটা ক্রেডিট কার্ড থাকতে হবে। তো আমরা এই লিঙ্কে যেয়ে একাউন্ট একটিভেট করে নেই। কার যদি অনেকগুলা ক্রেডিট কার্ড থাকে তাহলে সে চাইলে অনেক গুলা গুগল একাউন্ট খুলে প্রতি বার ৩০০$ ফ্রি পেতে…

Image for post
Image for post

Hey guys, whats up? Previously I came up with SPOJ code downloader. You can checkout the post here. Today I have developed another script to download all of your accepted solutions from LightOJ. It will download all of yours accepted solutions using crawling. The features of the script are —

  1. Download all of your accepted codes on LightOJ.
  2. If there are multiple submission for a single problem, then it downloads all.
  3. The file name architecture will be ProblemId-ProblemName-SubmissionId
  4. File extensions will be cpp for C++ programs, c for C programs and java for JAVA programs.
  5. If you download now and later solve more problems, then if you execute the script in the same place, it wont download the previous codes. The submission ids will be saved on a text file name “downloaded” on the same folder. …

Image for post
Image for post

Those who have done or doing competitive programming, is somehow familiar with SPOJ online judge. Some of the people have solved a lot of problems there. But there are many people who have not started in a structured way or somehow lost all of their accepted codes. But there is a special feature in SPOJ, that we can see or download all of our accepted solutions from our submission page. But it will be really cumbersome to download them manually.

So here is I am to rescue. I have developed a python script to download all of your accepted codes in a structured way. …

Image for post

এটা হল Flask নিয়ে দ্বিতীয় পর্ব। প্রথম পর্বের লেখা এর জন্য এই লিঙ্কে এ যেতে পারেন

আজকে আমরা দেখব কিভাবে আমরা GET ছাড়া অন্য মেথড গুলা use করতে পারি এবং postman দিয়ে সব গুলা Rest API কিভাবে চেক করতে পারি।

গত পর্বেই আমরা দেখছি যে আমাদের কাছে বেসিক্যালি ৪ টাইপ এর মেথড আছে। So, আমরা একটা একটা করে দেখি।


GET নাম থেকেই আমরা বুঝতে পারছি যে এই টা দিয়ে আমরা মেইনলি ডাটা পড়ে নিয়ে আসব। তো ডাটা পড়ে নিয়ে আসব মানে তো ঠিক বুঝলাম না। মানে আমি যেই ডাটা চাই তাই client-end কে সেন্ড করব এবং client-end ওই ডাটা দিয়ে user side এ ভিউ শো…


Shubhashis Roy Dipta

Get all my articles free on —

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store