Posts

Showing posts with the label tech

From Correlation to Causation through stories and math

Image
Correlation and causation are two concepts that people often mixup in their minds. I must admit that I myself have been guilty about this, and it unlikely that I would ever entirely grow out of it as it is wired deeply into our psychology. Let me use this article to briefly emphasise what the concepts of correlation and causation means, some interesting stories that have emerged from people misunderstanding these concepts and an algorithm that attempts to find causal relationship using correlation information. Here is a story that I heard a professor of mine, Prof. Dr. Ernst-Jan Camiel Wit, tell us during a lecture. There was a school that was involved in a study to see if providing free mid-day meals to students, which they could choose to be subscribed to this or not. At the end of the study, both the students who subscribed to it and did not where tested for different health indicators. It was observed that the students who chose to have meals from the programme had poorer health

From Correlation to Causation through stories and math

Image
Correlation and causation are two concepts that people often mixup in their minds. I must admit that I myself have been guilty about this, and it unlikely that I would ever entirely grow out of it as it is wired deeply into our psychology. Let me use this article to briefly emphasise what the concepts of correlation and causation means, some interesting stories that have emerged from people misunderstanding these concepts and an algorithm that attempts to find causal relationship using correlation information. Here is a story that I heard a professor of mine, Prof. Dr. Ernst-Jan Camiel Wit, tell us during a lecture. There was a school that was involved in a study to see if providing free mid-day meals to students, which they could choose to be subscribed to this or not. At the end of the study, both the students who subscribed to it and did not where tested for different health indicators. It was observed that the students who chose to have meals from the programme had poorer health

P2P Zero-Knowledge-Proof based Opensource Social Network - HexHoot

I find that the domain name that I purchased on an impulse, hexhoot.com, would be the ideal name for the p2p social network; both of which I described in some of my previous posts. I have been working on it during my pasttime for about a month now, and I decided to make it opensource. You can have a look at the project using the following link: https://github.com/zenineasa/hexhoot I have attempted to follow all the best development practices as much as I can. I have written tests, and, enabled continuous integration feature in GitHub to run all the tests, lint and copyright checks for the code changes that is being made. I also have captured all the foreseeable tasks in a Trello dashboard. This helps me keep track of all the bugs that I have detected and all the important tasks that need to be completed. There are quite a lot of tasks left to make this bug-free and feature-rich. I hope I will find enough time and motivation to do the same in the coming days.

Thinking about developing an opensource P2P social network

It has been a while since I made a blog post. I have been occupied by my academic work and I found using my past time on non-blogging related activities more rewarding. However, since it is summer break now, and I have mostly run out of things to do, I decided to get back to being creative and work on some project. Recently, I have been floating an idea about creating a social network that practically eliminates the requirement to have servers and databses. From a high-level, the idea is that users can host their profile on their phones and their connections can query data about the profile, send messages, form groups, and make wall post which can be viewed by anyone who is connected to the profile. I have seen a research paper summarising quite a few projects that has attempted to create something similar. However, I observed that these would at least have a server for authenticate a user; to tell confirm if the user is who he says he is. I believe this can be eliminated by allowing u

Regarding a Covid-19 related project that I worked on a few months ago

Image
A little over a year ago, I had written a blog post in this blog titled " COVID-19 Disease Spreading Simulation ". That was something that I worked on in a very short time frame. A few months after that, during a conversation with an old professor of mine, Dr. Jimson Mathew, we discussed modifying it further to create something really interesting. We started working on creating "A Framework for COVID-19 Cure or Vaccine Distribution Modeling, Analysis and Decision Making" in October 2020 and finished creating it and drafting a research paper about it in the first week of November 2020. We had submitted this to the Journal of Simulation, but the reviewers rejected the paper citing more information recently. Of course, we will be editing the paper and re-submitting it; however, I thought it would be better if I uploaded the project in the public domain so that anyone who would like to use it can do the same without having to wait. I have made this available on GitHub.

Drawing in the Air

Drawing in the air For someone who is completely unaware about image processing, this project would seem something out of the world. The people with some understanding about how to read an image pixel by pixel would have some understanding about what I am doing here. I am building a program in JavaScript that takes input from the computer's webcam and create a tool that lets you draw in the air and that gets displayed on the computer. For this, we will have a special pen to which we code our program to detect. To get started, let's use the <video> tag to receive the video feed from the camera, which I will later make invisible.. We'll also have two <canvas> tags that would each hold the current video frame and the drawing output from the tool respectively. We shall also have a button that clears data from the second canvas that has the drawing output. <video autoplay="true" id="videoElement"></video> <canvas id="canvas&quo

Smart Containers - An old project during my college days that could make Amazon better

Image
A few months ago, my friend Dhawal shared a page from Amazon Business introducing their product named Dash Smart Shelf. The system enables businesses to manager their inventories by keeping a track of stuffs in the shelves over time and automatically doing the reordering. The principle behind the product is to have a weight-sensing Wi-Fi-enabled smart scale that is placed on a shelf to track the inventory. The method involved is reasonably simple. A shop owner can have as many of these devices as the different products he/she wishes to store. That would be a lot of sensors. Dhawal and I had worked on a project that would enable reducing the number of sensors involved in order to do the same. In our setup, there would be just two weight sensors placed at a distance and a platform on top of the sensors. We divide the platform into any number and we can determine where each product is placed and if anything is taken away from it, it would automatically change the values. This could

Interactive Monty Hall Problem Implementation

Image
I may have watched too many videos about Monty Hall problem on YouTube. Many vloggers have attempted to explain the solution to the problem using their skills. I did not search for whether someone has published this before, but I am going to attempt to create a virtual version of the problem in this blog, although it is likely that at least a few people did create this. Some information from WikiPedia: The problem was originally posed (and solved) in a letter by Steve Selvin to the American Statistician in 1975. There was a game show named  Let's Make a Deal , created and produced by Stefan Hatos and Monty Hall, the latter serving as its host for nearly 30 years. I have not watched the show, and I am not sure if the entire show was just about this problem or not. The problem statement is as follows: Suppose you're on a game show, and you're given the choice of three doors: Behind one door is a car; behind the others, goats. You pick a door, say No. 1, and the ho

COVID-19 Disease Spreading Simulation

Image
At the moment, the world is fighting COVID-19. There have been many scientists who made simulations to demonstrate how the disease would spread. There was one simulation which I liked. It was a video in which people were put up as a dot that moved around the canvas. I want to reproduce that in JavaScript and make it tunable.  View this in a new tab:  Click Here First, let us create a canvas  div, in which all the people would exist. I am feeling a bit lazy to create a separate stylesheet. I will keep all the styles within the HTML Tags. <div id="canvas" style="position: absolute; width: 500px; height: 500px; background: #efefef"></div> Next, let us define a class named Person. The person starts at a random coordinate and moves in a random direction. const maxVel = 5; class Person{     constructor(){         this.div = document.createElement("div");         this.div.style.width = "4px";         this.div.style.hei

da Vinci of the 21st Century

Image
According to many sources, Leonardo Da Vinci is known for hiding secret codes and messages in his art work. In the modern era, digital canvases and images have a greater role to play. An image of width w  and height h  contains w  x h pixels. Changing the RGB values by a small value would not be detectable to naked eye. In this blog post, let me show you how to encrypt and decrypt messages using this principle. We'll do both encryption and decryption using JavaScript. To get started with, I downloaded a very nice picture of Mona Lisa from Wikipedia (. I also created an image with black text in a white background, which I shall not show here ( message.jpg ). Next, I setup a good HTML platform to run back to back JavaScript commands, which would automatically load all the images I need. To avoid CORS issue, I have been running a SimpleHTTPServer to open up the webpage. <html> <body> <img src="725px-Mona_Lisa,_by_Leonardo_da_Vinci,_from_C2RMF_retouc

Image to a string in JavaScript

Image
There may be various methods to convert an image into a one dimensional data. JavaScript enables you to convert and store images in string format and most modern browsers would be able to render that image. For instance, the following string contains Google's logo. You can check this by copy-pasting it on a browser addressbar. It is possible that some of you may think the the image could be loaded from an external website. For those people, I would like to recommend them to turn their internet off and paste the following on their addressbar. data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALgAAAA8CAYAAADVEnAJAAAOvklEQVR42u1dCZBcRRluyM4Sbg9QuUTFYAhy7Zs3G2Nw5r2ZTWKMWBCXQ5QzIncEFIqjGGtnZpdwaEUOIYcFlBwVRBA5wh7hUIIQCFgkJCAWBUWSnZ3N9d7MXgk7/p/sZje72/3umR2rv6quDOyb1zXd3/v77+///37MD0STxapYY6FWT+ev0zP5h7W0sTqWyWdjGaNA/13UU0Yf/ZvT08bbWjr/GH2+Qc8YJyv3FUNMQmK8Qk8XIrGM+Qc9ld8CIjttn33PvC/elD+JSUiMFxAp64igL4GkvrW08TytADVMouIQfnRucazGKg11qe6v62nzryBkIC1l9NO/d0eT2f2YhCR4ia32T2MpMw8iBt20TP79eIN5

Estimating the value of Pi using Monte Carlo Method

Image
The very first moment I was shown this, I was amazed. Estimating something using random events is pretty amazing. The first time I did this in MATLAB, but now, I think I will attempt to do the same in JavaScript. The undelying concept of Monte Carlo Method is to use randomness to determine the value. The method is often used to solve problems that are hard to determine exactly, when there is enough statistical data available. Let us define a square centered at the origin with side of length 2. A circle centered at the origin is inscribed in this square. The assumption that we are using in this method is that if we randomly take a few points within the square, the ratio of the number of points that falls within the circle to the total points taken is equal to that of the area of the square and the circle. That is, Area of square / area of circle = totalRandomSamples / totalPointsInCircle Let us write a JavaScript program that could do perform this with a huge number

Programming bouncing ball in JavaScript

While studying Newton's laws of motion during my schooldays, I found some of the questions related to bouncing ball quite fascinating. The sheer number of different kinds of questions that one could come up with just a ball bouncing on the ground is quite a lot. My attempt is to create the example as simple as possible. I would not be defining additional classes; I would be using the position value which is already present in the DOM Element  and adding velocity as a parameter to the DOM Element . First, let us define the HTML and CSS to get the visual appearance of the ball and the floor right. <html> <style> #ball{     position: absolute;     left: 50%;     top: 0;     width: 50px;     height: 50px;     border-radius: 50%;     background: #005eff; } #floor{     position: absolute;     bottom: 2px;     background: #000;     width: 100%;     height: 20px; } </style> <body>     <div id="ball"></div>     <

Slideshow on Google Images

Image
I opened Google Images and searched for Batman , which is probably my favourite Super Hero. I had connected my laptop to a TV screen and I wanted to see all the images as a slideshow. And, just like many other posts in this blog, I started using the Chrome Developer Tools. I clicked on the first image. The image was being displayed on the side and a button to move to the next image came in. I right-clicked on the button and did an Inspect  and I found that the button was having classes  KJaJCe irc-rab . I ran the following command to see if there are other elements with the same class. document.getElementsByClassName('KJaJCe irc-rab') I saw that there were three elements, but the button to go to the next image was always having an index of 1 . So, I went ahead and did the following: a = document.getElementsByClassName('KJaJCe irc-rab')[1]; a.click(); Each time I ran a.click  it showed me the next pic on the right-hand side and I was convinced that if I