Skip to main content

Posts

Running node in browser-https://stackblitz.com

 Here comes the web browser development for web apps you can run your node project in web and do development as well  please tryout the node or any other web development using  https://stackblitz.com/ https://stackblitz.com/ run your scripts in the terminal Import your project from git hub and enjoy web over web development. see you soon.

Node and Auth0 - Integration

 so now we have completed all the steps for integration  since we have the node and auth0 as two separate things the integration happens in the app.js  we need to modify the app.js with some auth0 code  app.js / const http = require('http'); const express = require('express'); var router = require('express').Router(); const { auth } = require('express-openid-connect'); const app = express(); app.use('/', router); const hostname = '127.0.0.1'; const port = 3000; http.createServer(app)   .listen(port, () => {     console.log(`Listening on `);   }); const config = {   authRequired: false,   auth0Logout: true,   secret: 'a long, randomly-generated string stored in env',   baseURL: 'http://localhost:3000',   clientID: 'QxpAXsXkzy0Vm2VdT6dFFS0VOKdrah67',   issuerBaseURL: 'https://dev-bnga041p.us.auth0.com' }; console.log(config) // auth router attaches /login, /logout, and /callback routes to the baseURL app.u

Auth0

You might be wondering what is this auth0  it is used for authentication of you applications  could be any apps  1.SPA - Angular , React  2.web app 3.Node  here we will talk about the node use case and go with example  moving ahead for now  if your are not familiar with node dont worry its a funny exercise for now walk with me  we dont have to worry too much for authentication as the service is  provided from auth0   create your node app  install node  https://nodejs.org/en/download/package-manager/  choose your os and do the installation once installed check for the version ' node -v  ' i assume u have installed so that u wil get the version for now  since iam using LINUX this will look like root@strings-desktop:/home/strings/js# node -v v16.13.0 moving on to creating node app for now    create a file app.js and paste the contents  app.js/ const http = require('http'); const express = require('express'); const app = express(); const hostname = '127.0.0.1&#

Hough Lines

consider the image like this we need to find the lines on this image  the basic lines would be horizontal ,vertical and inclined line  we will try to use hough to detect using equations  ok before that we need to understand the image co ordinate  top left is 0,0 assume it is the third quadrant , for  better understanding i have drawn a to show how a pixel is calculated from top left pixel arrangement for image    this is level zoom of more than 1000 , in real world u cannot see the pixel (1pixel of size 1,1)  alright now we can need to see how to find the lines on the first image the triangle on a zoomed in pixel wil look like this  ok we will start with the horizontal line calculation  since the pixel calculation is in the quadrant  i will shift or plot the values in  the first quadrant for my calculation  when shifted will look like this , for horizontal line calculation the theta of r must be at 90 degrees to the horizontal line u can see the value in diagram r = x cos𝛳 + y sin 𝛳

Hough Transform - Introduction

 So what is hough lines or the transform ,  Hough Line Transform is a transform used to detect straight lines. consider a image where u need to find the lines straight lines ,could be horizontal , vertical , diagonal lines in the image u can do that via the hough transform   before that there is something called   Cartesian coordinate system: Parameters: ( m , b ) . Polar coordinate system: Parameters: ( r , θ ) ( r , θ )   if the line equation is y = m * x +b  in the cartesian  x, y  in the polar it is  x = r cos(𝛳) y = r sin(𝛳) . we will see about this in detail  from the diagram u can see the inclined line and 𝛳 are related as x = r cos(𝛳) , the adjacent side of 𝛳 y = r sin(𝛳), the opposite side of 𝛳  ' r ' the distance from the origin the reference point to the line which hits the line at 90 degrees  ok so by Pythagoras  r = sqrt ( x ^2 + y^2) substitute for x and y  r = sqrt  (r^2 *x^2 cos^2 𝛳 + r^2 * y^2sin^2𝛳) cos^2 𝛳 + ^sin^2𝛳 = 1 r = r   ok what we have p