25 Dec, 2024
In this artical we are discuss about what is modules and how to use modules in Python. The propensity of computer code is to expand. We can conclude that code…
The ACID properties—Atomicity, Consistency, Isolation, and Durability—are fundamental principles that ensure reliable transactions in a database. To know more about ACID Properties, This article focuses on two key properties: Atomicity…
MySQL has InnoDB storage engine, that strictly follow the ACID Model to prevent data corruption and results distortion from unexpected occurrences like hardware failures and software crashes. You don’t have…
A key idea in software development is the singleton design pattern, which offers a straightforward method of guaranteeing a class has a single instance and a global access point. This…
Within the profession of software engineering, design patterns are essential resources that help architects as well as developers effectively address common issues. The Factory Design Pattern is one such pattern…

Hide Div using Javascript

To hide a div element using JavaScript, you can set its style. Display property to “none“.  Here’s an example: <!DOCTYPE html> <html> <head> <title>Hide a div with JavaScript</title> <script> function hideDiv() { var divElement = document.getElementById(“myDiv”); divElement.style.display = “none”; } </script> </head><body> <div id=”myDiv”> <p>This is the content of my div element.</p> </div> <button onclick=”hideDiv()”>Hide […]

Share your Love
1 min read

Node.js Response.WriteHead function

Up until now all we’ve been sending into the writeHead function is the status code. However, it can take additional parameters like ‘Content-Length’, ‘Content-Type’. var http = require(‘http’); var fs = require(‘fs’); http.createServer(function(request, response) { response.writeHead(200, {‘Content-Type’: ‘text/html’} ); fs.readFile(‘index.html’, function(err, contents) { response.write(contents); response.end(); }); }).listen(8080); Share your Love     

Share your Love
1 min read

Node.js Read File from Server

Now, showing you how to create an HTTP non-blocking server and how to read a file of the non-blocking filesystem. var http = require(‘http’); var fs = require(‘fs’); http.createServer(function(request, response) { response.writeHead(200); fs.readFile(‘index.html’, function(err, contents) { response.write(contents); response.end(); }); }).listen(8080); Generate Request curl http://localhost:8080 Share your Love     

Share your Love
1 min read