This Web page represents a Form validation in a naughty way, Where the button moves right or left if the user has not filled the form and he tried to click on the button to submit.
Let’s break down the above code in parts and explain the code:
HTML Structure:
<head> Section: In Head we have <style> tag where we define CSS, and <script> we have javascript code where we define function.
CSS Styling:
The CSS styles define the appearance of the form components.
.outer: Represents the outer container with specific styling like margin, height, width, border, and relative positioning.
p: Applies styling to paragraphs within the form.
.in: Applies styling to input elements within the form.
#bt: Applies styling to the submit button with specific positioning, margin, and hover effects.
JavaScript:
The <script> tag includes JavaScript functions that add user event to the form like user hover over button to click it.
fa(): This function is called when the mouse hover on the submit button (onmouseenter). It checks if the email and password fields are empty. If either is empty, it calls the function f() and changes the border color of the corresponding input fields to red. It also updates the button text.
f(): This function is used to toggle the position of the submit button (#bt) between two positions. It is invoked when the email and password fields are empty.
HTML Body:
Form Elements:
<div class="outer">: Represents the outer container of the form.
<h1>: Displays a heading for the form.
<p>: Represents paragraphs for the email and password input fields.
<input>: Defines input fields for email and password with specific IDs (email and pass).
<input type="submit">: Represents the submit button with an onmouseenter event calling the fa() function and an onclick event displaying an alert. The button has the ID bt.
Summary:
In summary, This code is for fun and practicing HTML, CSS and JS for beginners by creating a form with a dynamic submit button that moves when form is empty and use tries to click on the button by hovering. The JavaScript functions are used for form validation, changing button positions, and updating styles based on user interactions. The form includes fields for email and password, and the submit button triggers JavaScript functions to validate the form and provide visual feedback to the user.
Hi Welcome to Proto Coders Point, In this tutorial, we’ll building a simple stylish Digital + analog clock using HTML, CSS, and JS. This clock features distinct hour, minute, and second hands will show a numerical indicators where will show current hours, minute & second as a hand of the clock, providing a visually appealing and functional timekeeping display as animation.
Have a look at below gif image how our clock will look
Let’s start with the HTML structure. The clock is contained within a <div> element with the ID “clock” .Within this div, we have three child div’s which classes named a “hour-line,” “minute-line,” and “second-line,”. This 3 div.’s representing the hour, minute, and second hands of the clock, respectively. Additionally, within each line div, there are child div which classes names as “clock_number” to display numerical indicators.
CSS Styling
The CSS code is used to give styling and appearance to the clock design. The clock will have a square shape border, and each hand (hour, minute, and second) is represented by a digital number line with a specific dimensions and positions a the center of the square border. The transform-origin property ensures that the rotation occurs around the base of each line.
JavaScript and jQuery
The JavaScript code is used to update the clock’s hands based on the current time. For this we have a function updateClock that retrieves the current hour, minute, and second and perform calculation for each hand rotations in a proper angle for each hand. The angles we get is then applied using jQuery to rotate the lines. The numerical indicators are updated accordingly.
The setInterval function is used to call the updateClock function every second, ensuring that the clock hands are continuously updated in real-time.
Hi Guy’s Welcome to Proto Coders Point. It this fast growing digital era the importance of concise and shareable URL’s cannot be overstated. If you are trying to make you web address URL manageable or want to share the link of any content on social media or want to embed the URL in a email, but share a URL that is too long is very annoying thing. There for Shortened URL Plays a crucial role. So In this article we learn how to build a URL Shortener Application in flutter.
How to user flutter URL Shortener
Our Flutter URL Shortener Application we have 3 pages.
Registration.
Login.
Dashboard.
In Registration Page we simply have a form that the user can fill to register himself into our application using Flutter registration page.
In Login page user can enter his login credential and get logged in into the flutter to make use of URL Shortener.
In Dashboard we have 2 section. First section user can use to submit his LongURL and get ShortURL. Second section we can show all the data i.e. short URL created by that user.
Libraries need to created URL Shorten project in flutter
In pubspec.yaml file under dependencies we need to add below 2 library.
get:
get_storage:
We are going to make use of getx and get storage package
getx: used to make http calls to back api to store and retrieve data from backend nodejs server.
get storage:used to share logged in user data within the application storage same like sharedPreference.
Flutter URL Shortener Project Structure
In above flutter project I have 4 dart files namely:
main.dart
registration.dart
login.dart
dashboard.dart
main.dart
This is the starting point of our flutter application, Here we will check if the user has already signed into the application before, If the user data exist in get_storage (shared preferences) we will redirect the user to dashboard page else will redirect user to login page.
In login page we have 2 text field where the user can enter login credential i.e. email & password and a button on click will call a function that hit back-end NodeJS Login API.
After hitting the backEnd API if user exist in our MongoDB database will send the user data as response to frontEnd, and then store the user data into flutter app storage space using GetStorage package so that the used will be signIn into the application when he visit next time.
In the world of web application development, building a URL shortener server is best for beginners who wants to learn for scratch and also best for collage student who want to submit a project. A URL shortener project takes long URLs and provides a shortened link, making links more manageable and shareable in short form links. In this article, we will help you in developing a nodejs application in building a URL shortener using Node.js, Express, and MongoDB.
Video Playlist on building URL Shortener in Flutter + NodeJS with MongoDB Database
Project Structure
The NodeJS project will be organized into folders such as config, model, and routers for better code structure.
config: In config folder we have a file db.js that is responsible for mongodb database connectivity.
model: In model folder we have files that define mongodb database schema, Here we have 2 file namely url.model.js and user.model.js.
routers: In router folder we have RESTAPI for url and user apis.
app.js and index.js: This main root / starting point of our nodejs express URL shortener application in nodejs.
Node Module / Libraries required for building URL shortener Application
body-parser: used for parse incoming request bodies from client or front-end.
express: used to simplify the creation of nodejs express server and creating API and routers.
mongoose: used to connect or interact with MongoDB database, creating mongodb collection schema.
shortid: used for generating unique random identifier, that we can used as shortURL.
Enter below command to install this nodeJS Modules or Libraries
npm install body-parser cors express mongoose shortid
URL Shortener in NodeJS using ExpressJS and MongoDB
Refer above project structure and create respective files under the folders.
config >db.js
This file is responsible to get connected to mongodb database using nodejs mongoose library. This connection is exported so that the connection can we used in model file as below.
urlSubmit: Using this we can convert long URL into shorturl, Basically this API is used for LongURL submition and get shortURL of it. This API accept 2 parameters: userId & longUrl then generate a shortId i.e a random id which we can use as shortURL. This whole data will be stored into Mongodb database.
/:url: this api is a parameterized API, for example support a longURL is submitted and uses get the shortURL it, Now the user can us url like this http://localhost:3000/xya12id to redirect himself to longURL.
getUserURLList: This API will return all the URL’s been submitted by the user, This is been used to show or display the list of URL in Frontend (URL Shortener Flutter App).
Node.JS as you know is single threaded, asynchronous, event-driven architecture, Is so popular JavaScript JavaScript runtime environment for building high performance web application or back-end application like express server or Rest API’s.
You are here to know how can I increase the security level of my NodeJS express server by whitelisting IP to use our node server.
In this NodeJS article let’s explore how to enhance security of our NodeJS Express by adding middleware to check the whitelisted IP and allow only specific Client IP address to access our server.
Video Tutorial
The code complete source code with explanation is as below
The above code make use of ExpressJS to run a NodeJS server, which makes use of middleware function checkIpAccess thta is responsible to check the client request IP address if that IP exist in our allowed whitelisted IP list then grant the user to use our nodejs server else return a status error 403 that is forbidden.
Benefits of IP Whitelisting
Implementing IP whitelisting in your Node.js Express server offers several security advantages:
Access Control: Only requests originating from the specified IP address are permitted, providing a level of access control.
Reduced Attack Surface: By restricting access to a single IP, you minimize the potential attack surface, making it more challenging for unauthorized users to interact with your server.
Enhanced Security: IP whitelisting is an additional layer of security, complementing other security measures you may have in place.