Skip to main content

Posts

Showing posts from January, 2022

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 && ...

aaa

 Assalamualaikum sir, Our project was online classroom.  We have already showed you these features. After the third phase we have some new implementations. I will demonstrate the administration part  of the project. Basically our business idea regarding this project depends on this part.  In this part we have a super admin who can create more admins and allocate them some restrictions creating students and faculties.