Skip to content

Instantly share code, notes, and snippets.

@sakshamgurung
sakshamgurung / airports.json
Created May 21, 2023 13:16
Some dummy data on airports in Japan
[
{
"code": "AKJ",
"lat": "43.665",
"lon": "142.453",
"name": "Asahikawa Airport",
"city": "Asahikawa-shi",
"state": "Hokkaido Prefecture",
"country": "Japan",
"woeid": "28360516",
@sakshamgurung
sakshamgurung / WebServer.java
Created February 7, 2022 15:06
Connection class part III
// continue Connection class...
// helper method: getting the path to access the requested resource/information hosted by the server (aka routing)
private static Path getFilePath(String path) {
Matcher match = Pattern.compile("/watch/").matcher(path);
if(match.find()){
// replacing "watch" with "resources" because we have our videos inside that directory
path = path.replaceAll("/watch/", "./");
path = path + ".mp4";
return Paths.get(path);
@sakshamgurung
sakshamgurung / WebServer.java
Created February 7, 2022 15:06
Connection class part II
// continue Connection class...
// overiding run method from Thread class
public void run(){
// Initializing a Scanner class to read stream input from the
// socket connection between server and client
Scanner scan = new Scanner(this.in, "UTF-8");
try{
// separating the HTTP request header from rest of the HTTP message
// "\\r\\n\\r\\n" below refers to the 'empty line' from fig.1
@sakshamgurung
sakshamgurung / WebServer.java
Created February 7, 2022 15:05
Connection class part I
// Inside WebServer.java file
// Thread class is extended to use multi-threading facility
class Connection extends Thread {
DataInputStream in;
DataOutputStream out;
Socket clientSocket;
public Connection (Socket clientSocket) {
try {
this.clientSocket = clientSocket;
@sakshamgurung
sakshamgurung / WebServer.java
Created February 7, 2022 15:03
Webserver class
// Inside WebServer.java file
public class WebServer{
public static void main (String args[]) throws IOException NoSuchAlgorithmException {
int serverPort = 9090;
// allocating resources for server's socket and assigning a port number
ServerSocket listenSocket = new ServerSocket(serverPort);
try{
System.out.println("Server program started...");
while(true) {
// listening to the assigned port number and accepting
@sakshamgurung
sakshamgurung / WebServer.java
Created February 7, 2022 15:02
Imports for WebServer.java
// Inside WebServer.java file
// Some necessary imports
import java.net.*;
import java.io.*;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.security.NoSuchAlgorithmException;
<!-- ./public/cats.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Cat Paws</title>
</head>
<body>
<h1 style="text-align: center;">Cat-videos</h1>
<div style="display: flex; justify-content: center;">
<!-- ./public/index.html -->
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Cat Paws</title>
</head>
<body>
<div>
<h1 style="text-align: center;">Cat Paws</h1>
/Organization
org-login-header
org-login-email
org-login-password
org-login-submit
org-login-password-error
org-login-email-error
org-login-submit-error
/Dashboard/Home
# staff.feature
# this is a background keyword learn more here: https://cucumber.io/docs/gherkin/reference/#background
Background:
Given a company has been created with following information and default attributes
# this is a data table you can learn more from: https://dev.to/jankaritech/datatables-used-in-a-gherkin-feature-file-2i89
| email | pkrwaste@gmail.com |
| mobileNo | 9816564565 |
| password | password |
And super admin has accepted the company
And company has logged in with email "" and password "" using the webUI