Debugging is a very important part while building an application. It helps you to find the point where you might end up with something unexpected behavior in your code. There are a lot of ways to do that in different languages. Today we gonna play with Javascript debugging. Javascript is a client-side language(also used for backend and many more). So you can use any of the latest browsers to see your debugging result. Let’s start debugging.
While reading this article via any browser you can start your first debugging with the help of your browser. Just right-click on the page and select the ‘Inspect’ option or simply you can hit Control+Shift+I for windows and Linux or Command+Option+I for mac to go there. …
In my last article, I talked about how you can minimize your controller by putting the code out from it and put it somewhere else. And to do that I refactored the method length from 50+ line to 5–8 line. Rest of the code we put in a FormRequest class. And it worked perfectly.
Today we gonna discuss some methods of FormRequest class of Laravel which are really helpful if you know how to use them. To make a fresh new FormRequest class we need to fire the command below:
php artisan make:request YourRequest
This command will create a new YourRequest class under your app\Http\Requests directory with two methods in it. One is the authorize() method and the other is the rules() method. Let's have a quick overview of them. …
Refactoring is always a tough job to do. It gets even worst if they are not in the proper format and things are not in the right place. When working with my teams I often found codes that are messy and not properly organized. The main reason behind it not to think before you write them up.
When building software most of us take the help of a framework. Nothing wrong with that. A framework helps us to build faster and guide us to put the code where it belongs. But again, it will not restrict you from writing bad code. I am personally a big fan of Laravel. It is more structured and great for faster developments. …
(The answers to confusions)
Hello there, do you know the most popular programming language of 2020 according to Stackoverflow? Ok, I will give you a hint. Which language was top on popularity last year? You guessed it right. Yes, it is the “Javascript”. Stackoverflow does a survey every year since 2011(from 2013 they compare popularity among programming languages) and when it comes to the popularity of programming languages, Javascript has a tremendous record being top. But today we are not here to talk about the popularity of javascript, rather than we will focus on a very common topic of confusion among the newbie devs about javascript. …
(Part-1: Concepts about API and JWT)
Howdy, Are you a Laravel dev? Or learning Laravel in deep? Then you must hear the term API, right? API (Application Programming Interface) is a very common thing nowadays in the world of software development. Modern web applications can’t think of it. It's a great medium for data sharing and data authenticity. If you are/want to be a backend developer, learning to integrate API is a must. But how to make them?
As API is an intermediate level concept, I am assuming you are pretty familiar with PHP and Object-Oriented Programming (OOP), Composer and you build/started building pieces of stuff using Laravel. If you’re not familiar with them I highly recommend you to learn them first. For a clear understanding, I broke down this tutorial into two parts. In this part, I will discuss the concept/methodology behind API building and JWT. And in the part 2, I will implement them using JWT and Laravel. …
(Part-2: Implementation of JWT along with Laravel)
Hi there, welcome back. In part 1 we talked about the basic concept of API and JWT. If you haven’t read that give that a shot as this is a sequence of that part and this part focus on the hands-on implementation of API rather than discussing concepts.
Ok, so we know what is API, JWT, and what stateless authentication is. Let’s move on to the next step, making API. And as we discussed in the previous part that you need to have knowledge of the composer. …
‘পাগল’ শব্দটি শুনলেই আমরা একটা রুক্ষ, খুস্ক চেহারা চিন্তা করে ফেলি। মানসিক ভাবে যে হবে বিপর্যস্ত। কিন্তু ‘পাগল’ শব্দটি কি শুধু ঋণাত্মক অর্থেই ব্যাবহার করি থাকি আমরা? না, অনেক সময় কাউকে ভালো বা আহ্লাদ করেও কিন্তু ‘পাগল’ বলে থাকি। যেমন ‘খেলা পাগল’, ‘বই পাগল’, ‘গণিত পাগল’ কিংবা ‘বউ পাগল’। জিতু নামে আমার এক বন্ধু আছে যাকে আমরা বন্ধুরা মিলে ‘গণিত পাগল’ বলে থাকি। আজকে সেই ‘গণিত পাগল’ বন্ধুর ‘গণিত’ এর কিছু operator এর সাথে প্রোগ্রামিং জগতের কিছু operator তুলনার পাশাপাশি প্রোগ্রামিং এর বিভিন্ন operator সম্পর্কে আলোচনা করার চেষ্টা করব।
অপারেটর (operator) এর সংজ্ঞা অনেকভাবে দেয়া যায়। যেমন ধরুন যে গাড়ি চালায় সেও কিন্তু একজন অপারেটর, আবার যে বিমান চালায় তাকেও কিন্তু বিমানের অপারেটর বলা যেতে পারে। বাংলায় operator এর অর্থ হল চালক বা চালনাকারী। ক্ষেত্র বিশেষে কার্যকারকও বলা হয়ে থাকে। তাহলে অপারেটর বলতে কি বুঝাচ্ছে? সাধারন অর্থে অপারেটর হচ্ছে যার দ্বারা অপারেশান করে থাকি আমরা। গণিতের কথা চিন্তা করুন, গণিতে অপারেশান হচ্ছে যোগ, বিয়োগ, গুন, ভাগ ইত্যাদি। আর এগুলো করতে সাহায্য করে যে সেই হচ্ছে অপারেটর অর্থাৎ +,-,x এবং / । প্রোগ্রামিং এ অপারেটর হচ্ছে কিছু চিহ্ন যা প্রোগ্রামে আমাদেরকে গাণিতিক কিংবা লজিক ভিত্তিক অপারেশান করতে সাহায্য করে। অন্যভাবে বলা যায়, অপারেটর আমাদের হয়ে কম্পিউটারকে বলে দেয় যে আমরা কোন গাণিতিক বা লজিকাল অপারেশন করতে চাচ্ছি। আর গণিতের এই +,-,x,/ এগুলোকে প্রোগ্রামিং এ বলা হয়ে থাকে এরিথমেটিক অপারেটর (arithmetic operator)। আসুন এক নজরে দেখে নেই প্রোগ্রামিং এর বিভিন্ন অপারেটর…
গতবারের আর্টিকেলে কথা বলেছিলাম if-else তথা কন্ডিশনাল স্টেটমেন্ট (conditional statement) নিয়ে। আজকে সেই টপিকের বাকি অংশ নিয়ে আলোচনা করার চেষ্টা করব।
সুমন আর তার মামার কথোপকথনের কথাই ধরা যাক। মামা সুমনকে মিষ্টি আনতে পাঠালে সুমন মামার দিকে যে প্রশ্নগুলো ছুড়ে দিয়েছিল তারিই মধ্যে আজকের বিষয়বস্তু লুকিয়ে আছে। যারা গল্পটি জানেন না তাদের জন্য আর একবার বলা যাক।
সুমন কে তার মামা কিছু টাকা হাতে দিয়ে বলল যা দোকান থেকে মিষ্টি নিয়ে আয়। সুমন মামাকে জিজ্ঞেস করল কি মিষ্টি আনবে সে, উত্তরে মামা বলল “চমচম”। সুমনঃ “যদি চমচম না পাই?”, “তাহলে রসমালাই”- মামার উত্তর। “মামা যদি সেটাও না পাই?” মামা কিছুক্ষণ ভেবে বলল “তাহলে কালো জ্যাম”। সুমনের আবার পাল্টা প্রশ্ন “যদি সেটাও না পাই?”। …
সুমন কে তার মামা কিছু টাকা হাতে দিয়ে বলল যা দোকান থেকে মিষ্টি নিয়ে আয়। সুমন মামাকে জিজ্ঞেস করল কি মিষ্টি আনবে সে, উত্তরে মামা বলল “চমচম”। সুমনঃ “যদি চমচম না পাই?”, “তাহলে রসমালাই”- মামার উত্তর। “মামা যদি সেটাও না পাই?” মামা কিছুক্ষণ ভেবে বলল “তাহলে কালো জ্যাম”। সুমনের আবার পাল্টা প্রশ্ন “যদি সেটাও না পাই?”। এবার মামা রেগে গেলেন। বললেন “না পেলে মুড়ি কিনে আনিস, মুড়ি খাব!!”।
অতঃপর সুমন মিষ্টি কেনার উদ্দেশে রউনা হল। সুমনের এই প্রশ্ন গুলো কি অবান্তর ছিল? যদি একটু ভেবে দেখেন তবে নিশ্চয়ই উত্তর টা “না” হবে, কারন সুমনের এই প্রশ্ন করার পিছনে কারন হল সে নিশ্চিত হতে চেয়ে ছিল মামা কি চাচ্ছে। আর এই সিদ্ধান্ত নিতেই তার এই প্রশ্ন করা। সুমনের মত আমরাও কিন্তু প্রতিদিন সিদ্ধান্ত হিনতায় ভুগি। এটা খাব না ওটা, এটা পরব না ওটা, এখানে যাব না ওখানে, যদি এটা পাই তাহলে এটা করব নাহলে ওটা করব, আর কত কি। এবং এই ‘যদি’ আর ‘নাহলে’র উপর ভিত্তি করে আমরা আমাদের সিদ্ধান্ত নিয়ে থাকি। ঠিক একই ভাবে প্রোগ্রামিং জগতে আমাদের সিদ্ধান্তু (decision) নেয়ার প্রয়োজন হয়। যদি এটা হয় তবে এটা কর, নাহলে ওটা কর। যেমন, ফেসবুক’র কথাই ধরুন না, যদি লগইন করার সময় ইউজারনাম আর পাসওয়ার্ড ঠিক থাকে তবে প্রোফাইল এ নিয়ে যাও অথবা পুনরাই লগইন করতে বল। এই যে সিদ্ধান্ত নিচ্ছি এটাকেই প্রোগ্রামিং এর ভাষায় বলে কন্ডিশনাল স্টেটমেন্ট। আজকে কথা বলব এই কন্ডিশনাল স্টেটমেন্ট…
About