Skip to main content

Posts

Recent posts

Php Learning Time

 Differences of explode( ) and implode( ) in php: explode: একটা স্ট্রিংকে কোনো একটা সেপারেটরের বেসিসে অ্যারেতে কনভার্ট করে, যেমন  <?php $text="Hello How are you?"; print_r(explode(" ",$text)); ?> This will give output of  Array (     [0] => Hello     [1] => How     [2] => are     [3] => you? ) Differences of array_splice( ) and array_slice( ) ধরেন আসল অ্যারে হচ্ছে    $arr =[ "Hello" , "this" , "is" , "test" , "text" ];    এখন এটাকে স্লাইসিং করার জন্য আমরা উপরের দুইটা মেথড ই ব্যবহার করতে পারি , কিন্তু array_splice এটা ইউজ করলে অরজিনাল array ও চেঞ্জ হয়ে যাবে, মানে যদি আমরা এভাবে লিখি  $var2 = array_splice ( $arr , 0 , 2 );   তাইলে $var2 এর ভিতরে থাকবে ["Hello" , "this"] ,  আর অরজিনাল array তে বাকি থাকবে ["is", "test", "text"] কিন্তু যদি আমরা ইউজ করি তাহলে অরজিনাল array আগের মতোই থাকবে পাশাপাশি $var2 এর মধ্যে ভ্যালু গুলা এসে পড়বে  Array (     [0] => ...

Cyber Security Terms

CIA TRIAD:   Confidentiality : ম্যাসেজ গেছে, হ্যাকার দেখতে পেল কিন্তু ম্যাসেজটা এনক্রিপ্ট করা তাই কি লিখা বুঝতে পারলো না । যাকে ম্যাসেজ   পাঠাবো সে ছাড়া অন্য কেউ বুঝতে পারবে না। Integrity : যে ম্যাসেজ পাঠাবো সেটাই যাবে এর মাঝে কেউ ম্যাসেজ চেঞ্জ করতে পারবে না, Hi লেখলে , Hi ই যাবে, কেউ Hi কে Bye করে দিতে পারবে না। Authentication : ম্যাসেজ যে আসলে যার কাছ থেকে আসার কথা তার কাছ থেকেই এসেছে এটা নিশ্চিত হউয়া।   1.2.2 Simple Symmetric Encryption: The Substitution Cipher এটার কন্সেপ্ট অনেক ইজি , ধরেন আমি আমার বন্ধুর সাথে Substitution Cipher ইউজ করে কথা বলতে চাই, আমি আমার বন্ধুকে আগে থেকেই বলে রাখবো , শুন আমার ম্যসেজে A মানে হচ্ছে G , B মানে হচ্ছে P , এভাবে যেকোনো অক্ষরকে অন্য অক্ষর দিয়ে Replace করে দিব, কোন অক্ষর মানে আমার কাছে কি এটা আমার বন্ধু কেউ বলে দিব আগে থেকেই, কিন্তু হ্যাকারতো জানবে না আমার কাছে কোন অক্ষরের মানে কি , তাই না? এজন্য সে ম্যাসেজ দেখলেও বুঝতে পারবে না , কোন অক্ষরকে কি ধরেছি এটার একটা Table বানিয়ে বন্ধু আগেই দিয়ে রাখবো, এইখানে এই ট...

Cloudinary linked

 Backend: const express = require (" express "); const app = express (); const cors = require (" cors ") const dotenv = require (' dotenv '); const cloudinary = require (" cloudinary "). v2 ; dotenv . config (); app . use ( cors ()) cloudinary . config ({     cloud_name: process . env . CLOUDINARY_NAME ,     api_key: process . env . CLOUDINARY_API_KEY ,     api_secret: process . env . CLOUDINARY_API_SECRECT }) app . use ( express . json ({limit:" 50mb "})); app . use ( express . urlencoded ({limit:" 50mb ",extended: true })) app . post (" /upload ", async ( req , res ) => {     try {         const fileStr = req . body . data ;         const uploadedResponse = await cloudinary . uploader . upload ( fileStr ,{upload_preset:" dev_setup "})         console . log ( uploadedResponse );         res . json ( uploadedResponse . url )     } catch ( er...

React Upload

  const express = require (" express "); const app = express (); const multer = require (' multer '); const path = require (" path "); const { GridFsStorage } = require (" multer-gridfs-storage "); const { request } = require (" http "); const cors = require (" cors ") app . use ( cors ()) // storage const storage =new GridFsStorage ({     url:' mongodb+srv://user:user@cluster0.ayogb.mongodb.net/myFirstDatabase?retryWrites=true&w=majority ',     options:{useNewUrlParser: true , useUnifiedTopology: true },     file :( request , file ) => {         const match = [' image/png ',' image/jpg ',' image/jpeg ']         if ( match . indexOf ( file . mimetype ) ==- 1 ){             return `${ Date . now () } profile ${ file . orginalname }`;         }         else {             return {     ...

File Uploads

 HTML part: <! DOCTYPE html > < html lang =" en "> < head >     < meta charset =" UTF-8 ">     < meta http-equiv =" X-UA-Compatible " content =" IE=edge ">     < meta name =" viewport " content =" width=device-width, initial-scale=1.0 ">     < title >File Upload</ title > </ head > < body >     < form action =" http://localhost:3500/ "     method =" post "     enctype =" multipart/form-data "     >     < input type =" file " name =" avatar " id ="">     < button type =" submit ">Submit</ button >         </ form >     < script src =" script.js "></ script > </ body > </ html > NODEJS part const express = require (" express "); const app = express (); const multer = require (' multer '); const path = requir...

Q1

 // Dijkstra's Algorithm in C #include <stdio.h> #define INFINITY 9999 #define MAX 10 void Dijkstra(int Graph[MAX][MAX], int n, int start); void Dijkstra(int Graph[MAX][MAX], int n, int start) {   int cost[MAX][MAX], distance[MAX], pred[MAX];   int visited[MAX], count, mindistance, nextnode, i, j;   // Creating cost matrix   for (i = 0; i < n; i++)     for (j = 0; j < n; j++)       if (Graph[i][j] == 0)         cost[i][j] = INFINITY;       else         cost[i][j] = Graph[i][j];   for (i = 0; i < n; i++) {     distance[i] = cost[start][i];     pred[i] = start;     visited[i] = 0;   }   distance[start] = 0;   visited[start] = 1;   count = 1;   while (count < n - 1) {     mindistance = INFINITY;     for (i = 0; i < n; i++)       if (distance[i] < mindistance && ...